Code Monkey home page Code Monkey logo

geo-fno's Introduction

PyPI

Neural Operator

neuraloperator is a comprehensive library for learning neural operators in PyTorch. It is the official implementation for Fourier Neural Operators and Tensorized Neural Operators.

Unlike regular neural networks, neural operators enable learning mapping between function spaces, and this library provides all of the tools to do so on your own data.

NeuralOperators are also resolution invariant, so your trained operator can be applied on data of any resolution.

Installation

Just clone the repository and install locally (in editable mode so changes in the code are immediately reflected without having to reinstall):

git clone https://github.com/NeuralOperator/neuraloperator
cd neuraloperator
pip install -e .
pip install -r requirements.txt

You can also just pip install the library:

pip install neuraloperator

Quickstart

After you've installed the library, you can start training operators seemlessly:

from neuralop.models import FNO

operator = FNO(n_modes=(16, 16), hidden_channels=64,
                in_channels=3, out_channels=1)

Tensorization is also provided out of the box: you can improve the previous models by simply using a Tucker Tensorized FNO with just a few parameters:

from neuralop.models import TFNO

operator = TFNO(n_modes=(16, 16), hidden_channels=64,
                in_channels=3,
                out_channels=1,
                factorization='tucker',
                implementation='factorized',
                rank=0.05)

This will use a Tucker factorization of the weights. The forward pass will be efficient by contracting directly the inputs with the factors of the decomposition. The Fourier layers will have 5% of the parameters of an equivalent, dense Fourier Neural Operator!

Checkout the documentation for more!

Using with weights and biases

Create a file in neuraloperator/config called wandb_api_key.txt and paste your Weights and Biases API key there. You can configure the project you want to use and your username in the main yaml configuration files.

Contributing code

All contributions are welcome! So if you spot a bug or even a typo or mistake in the documentation, please report it, and even better, open a Pull-Request on GitHub. Before you submit your changes, you should make sure your code adheres to our style-guide. The easiest way to do this is with black:

pip install black
black .

Running the tests

Testing and documentation are an essential part of this package and all functions come with uni-tests and documentation. The tests are ran using the pytest package. First install pytest:

pip install pytest

Then to run the test, simply run, in the terminal:

pytest -v neuralop

Citing

If you use NeuralOperator in an academic paper, please cite [1], [2]:

@misc{li2020fourier,
   title={Fourier Neural Operator for Parametric Partial Differential Equations},
   author={Zongyi Li and Nikola Kovachki and Kamyar Azizzadenesheli and Burigede Liu and Kaushik Bhattacharya and Andrew Stuart and Anima Anandkumar},
   year={2020},
   eprint={2010.08895},
   archivePrefix={arXiv},
   primaryClass={cs.LG}
}

@article{kovachki2021neural,
   author    = {Nikola B. Kovachki and
                  Zongyi Li and
                  Burigede Liu and
                  Kamyar Azizzadenesheli and
                  Kaushik Bhattacharya and
                  Andrew M. Stuart and
                  Anima Anandkumar},
   title     = {Neural Operator: Learning Maps Between Function Spaces},
   journal   = {CoRR},
   volume    = {abs/2108.08481},
   year      = {2021},
}
[1]Li, Z., Kovachki, N., Azizzadenesheli, K., Liu, B., Bhattacharya, K., Stuart, A., and Anandkumar A., “Fourier Neural Operator for Parametric Partial Differential Equations”, ICLR, 2021. doi:10.48550/arXiv.2010.08895.
[2]Kovachki, N., Li, Z., Liu, B., Azizzadenesheli, K., Bhattacharya, K., Stuart, A., and Anandkumar A., “Neural Operator: Learning Maps Between Function Spaces”, JMLR, 2021. doi:10.48550/arXiv.2108.08481.

geo-fno's People

Contributors

vanshtibrewal avatar zhengyu-huang avatar zongyi-li avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

geo-fno's Issues

About the description of the dataset

Thanks for the beautiful work!

I found that the network structure you used is consistent with FNO, just changing the form of the input data. I am having a hard time understanding why Geo-FNO works better than FNO, can you provide some details about the dataset?

Problems about some details

Excellent work! And I have some questions about some details.

  1. "The target output is stress." in section Hyper-elastic material in the paper. What does the stress mean here? Is it a Mises-stress or some type stress tensor? I guess it a Mises-stress, because in the code I found out_channel is set to 1.
  2. Could 2-dim geoFNO handle the problem of multichannel output? For example, given geometry and boundary, could the 2-dim FNO output a stress tensor?

Fix the bug in plasticity_3d.py

It seems like we need to add the optimizer.step() in line 228 of plasticity_3d.py.
Without this line of code, the model cannot be optimized during training.

Advection equation on sphere

Hi guys, I am curious if you have some more details how you generated the data for the Advection equation on sphere example in the paper?
Thanks
Vitus

3D Spatial Case

Has this been tested on a 3D spatial case, such as CFD Velocity/Pressure fields around a 3D model (e.g., car) either in steady state or turbulent cases?

FNO2D outputs constant prediction value

I am trying to utilize FNO2D on my own set of data and got constant prediction as the model output. I have modified

Details:
in_channels = 3
out_channels = 1

We aim to map a non-gaussian random field to an output field.

The input field is a non-gaussian random field, with coefficients on each mesh points.
The output field have different coordinates of mesh points, with the solution a(x_out, y_out) on each mesh points.

Input data is of shape [Number of samples, Number of mesh points, 3], where 3 equates to having x values, y values and the coefficients of the non-gaussian random field.

the x_in, y_in coordinates of the input field were given as x_in to the model, and x_out, y_out coordinates were given as x_out to the model.

Problem:
The output solution on every mesh points is a single value. I investigated the output of each Fourier layer and noticed that the output values of each layer gets more similar (constant-ish) as it progresses through each Fourier layer.
I have tried increasing the Fourier modes in hopes to account for higher frequency variations in the input data, to no avail.

Any help or advice is appreciated!

ModuleNotFoundError: No module named 'utilities3'

root@90f5577d61db:/workspace/Geo-FNO/airfoils# python3 naca_geofno.py
Traceback (most recent call last):
File "/workspace/Geo-FNO/airfoils/naca_geofno.py", line 8, in
from utilities3 import *
ModuleNotFoundError: No module named 'utilities3'

What's wrong with me?

About the deformation of the pipe dataset

Thanks for the beautiful work!

I found that in the dataset of pipe, in the file "Pipe_Visual.ipynb", the deformation was written as "deformation = Spline(xx, thetas[i,:])", but I can't find the definition of Spline. Could you give the source cold of the Pipe?

some questions about Geo-FNO

@zongyi-li

I'm reading your paper on learned deformations.

Could you please check if my following understanding is correct?

In Geo-FNO, the input mesh is regarded as coming from some probability distribution. By sampling this probability distribution, we generate training data on different meshes. The neural network $\phi^{-1}_a$ learns to map these sampled meshes into a latent uniform space. When we encounter a new mesh, we use the learned neural network $\phi^{-1}_{a}$ to approximately map the new mesh into a uniform grid in latent space, where standard FNO operates and then we map the solution back into the physical domain. Since the mapping to the latent space $\phi^{-1}_{a}$ is not perfect, this may be a source of (small) error.

Also, I have the following questions:

  1. In equation (12) is $|\mathcal{T}^i|$ the volume/area of the mesh? Why is it in the denominator? Why is it necessary while going from (11) to (12) by approximating the integral? A simple approximation of the integral wouldn't have it in the denominator...

  2. What exactly is $\rho_a(x)$?

  3. I'm looking at the definition of $\phi^{-1}_a$ here and it doesn't seem that anything special is done to make sure that the output of $\phi^{-1}_a$ is uniform. It seems to learn to produce uniform output as a result of training. Is this correct?

Thanks,

-Nachiket

Discrepancy in Reproduced Error for Geo-FNO Model on Airfoil Dataset

Thank you for making the code and data accessible to the public!

I'm in the process of assessing FNO models with the airfoil and pipe examples and have successfully replicated the errors listed in Table 2 of your paper for both examples. However, I encountered a discrepancy with the Geo-FNO model on the airfoil dataset; the paper reports an error of 0.0138, but I observed an error of 0.01909. Could you please inform me about the PyTorch version used to obtain the results mentioned in your paper? For your reference, I am currently using PyTorch version 2.1.1 (with CUDA 11.8).

Thank you!

Question about the elas case

Thanks for the beautiful work!
Can you provide some explanation about the file 'Random_UnitCell_rr_10.npy'?
In the code, you mentioned that is the feature, so what is that meaning in the Hyper-elastic problem?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.