thunil / deep-flow-prediction Goto Github PK
View Code? Open in Web Editor NEWA framework for fluid flow (Reynolds-averaged Navier Stokes) predictions with deep learning
License: Apache License 2.0
A framework for fluid flow (Reynolds-averaged Navier Stokes) predictions with deep learning
License: Apache License 2.0
Hi,
Thanks for sharing your great work! I am trying to use your pretrained models for prediction with the test airfoils. What I have tried so far is to load the model and state dict like this:
import torch
from train.DfpNet import TurbNetG
netG = TurbNetG()
model = netG.load_state_dict(torch.load('model_data05_exp50.pt'))
What I get is an error like this with missing and mismatched layer sizes:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-5-0bda212c0edc> in <module>
----> 1 model = netG.load_state_dict(torch.load('model_data05_exp50.pt'))
~/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/torch/nn/modules/module.py in load_state_dict(self, state_dict, strict)
1222 if len(error_msgs) > 0:
1223 raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
-> 1224 self.__class__.__name__, "\n\t".join(error_msgs)))
1225 return _IncompatibleKeys(missing_keys, unexpected_keys)
1226
RuntimeError: Error(s) in loading state_dict for TurbNetG:
Missing key(s) in state_dict: "layer2b.layer2b_conv.weight", "layer2b.layer2b_conv.bias", "layer2b.layer2b_bn.weight", "layer2b.layer2b_bn.bias", "layer2b.layer2b_bn.running_mean", "layer2b.layer2b_bn.running_var", "dlayer2b.dlayer2b_tconv.weight", "dlayer2b.dlayer2b_tconv.bias", "dlayer2b.dlayer2b_bn.weight", "dlayer2b.dlayer2b_bn.bias", "dlayer2b.dlayer2b_bn.running_mean", "dlayer2b.dlayer2b_bn.running_var".
Unexpected key(s) in state_dict: "layer2x.layer2x_conv.weight", "layer2x.layer2x_conv.bias", "layer2x.layer2x_bn.weight", "layer2x.layer2x_bn.bias", "layer2x.layer2x_bn.running_mean", "layer2x.layer2x_bn.running_var", "layer2x.layer2x_bn.num_batches_tracked", "dlayer2x.dlayer2x_tconv.weight", "dlayer2x.dlayer2x_tconv.bias", "dlayer2x.dlayer2x_bn.weight", "dlayer2x.dlayer2x_bn.bias", "dlayer2x.dlayer2x_bn.running_mean", "dlayer2x.dlayer2x_bn.running_var", "dlayer2x.dlayer2x_bn.num_batches_tracked".
size mismatch for layer1.layer1_conv.weight: copying a param with shape torch.Size([32, 3, 4, 4]) from checkpoint, the shape in current model is torch.Size([64, 3, 4, 4]).
size mismatch for layer1.layer1_conv.bias: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([64]).
size mismatch for layer2.layer2_conv.weight: copying a param with shape torch.Size([64, 32, 4, 4]) from checkpoint, the shape in current model is torch.Size([128, 64, 4, 4]).
size mismatch for layer2.layer2_conv.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for layer2.layer2_bn.weight: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for layer2.layer2_bn.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for layer2.layer2_bn.running_mean: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for layer2.layer2_bn.running_var: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for layer3.layer3_conv.weight: copying a param with shape torch.Size([128, 64, 4, 4]) from checkpoint, the shape in current model is torch.Size([256, 128, 4, 4]).
size mismatch for layer3.layer3_conv.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for layer3.layer3_bn.weight: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for layer3.layer3_bn.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for layer3.layer3_bn.running_mean: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for layer3.layer3_bn.running_var: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for layer4.layer4_conv.weight: copying a param with shape torch.Size([256, 128, 2, 2]) from checkpoint, the shape in current model is torch.Size([512, 256, 4, 4]).
size mismatch for layer4.layer4_conv.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for layer4.layer4_bn.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for layer4.layer4_bn.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for layer4.layer4_bn.running_mean: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for layer4.layer4_bn.running_var: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for layer5.layer5_conv.weight: copying a param with shape torch.Size([256, 256, 2, 2]) from checkpoint, the shape in current model is torch.Size([512, 512, 2, 2]).
size mismatch for layer5.layer5_conv.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for layer5.layer5_bn.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for layer5.layer5_bn.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for layer5.layer5_bn.running_mean: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for layer5.layer5_bn.running_var: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for layer6.layer6_conv.weight: copying a param with shape torch.Size([256, 256, 2, 2]) from checkpoint, the shape in current model is torch.Size([512, 512, 2, 2]).
size mismatch for layer6.layer6_conv.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for dlayer6.dlayer6_tconv.weight: copying a param with shape torch.Size([256, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 512, 1, 1]).
size mismatch for dlayer6.dlayer6_tconv.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for dlayer6.dlayer6_bn.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for dlayer6.dlayer6_bn.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for dlayer6.dlayer6_bn.running_mean: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for dlayer6.dlayer6_bn.running_var: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for dlayer5.dlayer5_tconv.weight: copying a param with shape torch.Size([256, 512, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 1024, 1, 1]).
size mismatch for dlayer5.dlayer5_tconv.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for dlayer5.dlayer5_bn.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for dlayer5.dlayer5_bn.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for dlayer5.dlayer5_bn.running_mean: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for dlayer5.dlayer5_bn.running_var: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for dlayer4.dlayer4_tconv.weight: copying a param with shape torch.Size([128, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 1024, 3, 3]).
size mismatch for dlayer4.dlayer4_tconv.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for dlayer4.dlayer4_bn.weight: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for dlayer4.dlayer4_bn.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for dlayer4.dlayer4_bn.running_mean: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for dlayer4.dlayer4_bn.running_var: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for dlayer3.dlayer3_tconv.weight: copying a param with shape torch.Size([64, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 512, 3, 3]).
size mismatch for dlayer3.dlayer3_tconv.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for dlayer3.dlayer3_bn.weight: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for dlayer3.dlayer3_bn.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for dlayer3.dlayer3_bn.running_mean: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for dlayer3.dlayer3_bn.running_var: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for dlayer2.dlayer2_tconv.weight: copying a param with shape torch.Size([32, 128, 3, 3]) from checkpoint, the shape in current model is torch.Size([64, 256, 3, 3]).
size mismatch for dlayer2.dlayer2_tconv.bias: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([64]).
size mismatch for dlayer2.dlayer2_bn.weight: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([64]).
size mismatch for dlayer2.dlayer2_bn.bias: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([64]).
size mismatch for dlayer2.dlayer2_bn.running_mean: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([64]).
size mismatch for dlayer2.dlayer2_bn.running_var: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([64]).
size mismatch for dlayer1.dlayer1_tconv.weight: copying a param with shape torch.Size([64, 3, 4, 4]) from checkpoint, the shape in current model is torch.Size([128, 3, 4, 4]).
Submitting this issue to hopefully prevent future headaches for others but this can be closed.
If you receive this error message gmshToFoam command not found
and then the subsequent error during conversion to OpenFoam mesh!
message, and are able to run commands like simpleFoam and paraFoam, check the case field when running the command simpleFoam
.
/---------------------------------------------------------------------------
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 5.x |
| \ / A nd | Web: www.OpenFOAM.org |
| \/ M anipulation | |
*---------------------------------------------------------------------------*/
....
Case : /Deep-Flow-Prediction/data/OpenFOAM/0
...
For some reason, during installation, openFoam defaulted to using ..../data/OpenFOAM/0 rather than ..../data/OpenFOAM/
You can fix this by running
simpleFoam -case
When trying to load the pretrained model (link given in readme), I'm getting the following key mismatch error.
I'm on commit 653b81a (HEAD) added pre-trained model link
(previous version of the model)
wget https://ge.in.tum.de/download/2019-deepFlowPred/model_data05_exp50
import torch
from DfpNet import TurbNetG
netG = TurbNetG(channelExponent=5)
netG.load_state_dict(torch.load("model_data05_exp50"))
RuntimeError: Error(s) in loading state_dict for TurbNetG:
Missing key(s) in state_dict: "layer2b.layer2b_conv.weight", "layer2b.layer2b_conv.bias", "layer2b.layer2b_bn.weight", "layer2b.layer2b_bn.bias", "layer2b.layer2b_bn.running_mean", "layer2b.layer2b_bn.running_var", "dlayer2b.dlayer2b_tconv.weight", "dlayer2b.dlayer2b_tconv.bias", "dlayer2b.dlayer2b_bn.weight", "dlayer2b.dlayer2b_bn.bias", "dlayer2b.dlayer2b_bn.running_mean", "dlayer2b.dlayer2b_bn.running_var".
Unexpected key(s) in state_dict: "layer2x.layer2x_conv.weight", "layer2x.layer2x_conv.bias", "layer2x.layer2x_bn.weight", "layer2x.layer2x_bn.bias", "layer2x.layer2x_bn.running_mean", "layer2x.layer2x_bn.running_var", "layer2x.layer2x_bn.num_batches_tracked", "dlayer2x.dlayer2x_tconv.weight", "dlayer2x.dlayer2x_tconv.bias", "dlayer2x.dlayer2x_bn.weight", "dlayer2x.dlayer2x_bn.bias", "dlayer2x.dlayer2x_bn.running_mean", "dlayer2x.dlayer2x_bn.running_var", "dlayer2x.dlayer2x_bn.num_batches_tracked".
Hi, I have 2 questions regarding running the models.
The 1st is do do with training a model from scratch. When setting prop, what effect do the values given in line 38 of dataset.py have? I assume they mix the data in different proportions from the different directories however I'm not sure what the 1000 value does if this is the case.
I'm also trying to implement the given pre-trained models.
I'm trying to input a batch of test data into the model. This is what the models predicting, it doesn't seem to predict any of the flow fields.
I suspect the issue is due to the model not compiling properly but I'm not sure.
To compile the model I had to switch the compiling method to strict when running runTest.py (line 72).
When running the code unedited, I received a Run time error loading state_dict
due to missing keys - "layer2b.layer2b_conv.weight", "layer2b.layer2b_conv.bias",...
and unexpected keys - "layer2x.layer2x_conv.weight", "layer2x.layer2x_conv.bias",...
Could you advise on how I should resolve these issues?
Hello, your code helps me to get closer applying deep learning to N-S flow solver. thank you in advance.
While I was generating the data with OpenFOAM 5, I got the error that "OpenFOAM/postProcessing/internalCloud/500/cloud_p.xy" is missing. I think this is the file contains the point cloud to be used for extracting N-S solution. Will you share this file here?
Hi,
pls correct me if i'm wrong, but I think there is a small error in the data normalisation, where the norm of v is computed with the pressure values instead of v1.
Would be glad if you could verify.
Thanks
Deep-Flow-Prediction/train/dataset.py
Line 117 in c3123d1
Warning: Extrusion of periodic curves is not supported with the built-in kernel.
...
Warning: Skipping unknown surface 1026 in physical surface 7
I don't quite follow why the last few lines such as Physical Surface("back") = {1027}.
Why is it named 1027? It seems to be a random number, and this 1027 number is not referenced anywhere else...
However it seems that the code still runs? Could somebody explain this section please, thanks.
PS: I am using gmsh2 and openfoam10, so I modified something to get it work (some functions in gmsh2 only works for openfoam5).
Attempting to follow the instructions and download the airfoils by running the script ./download_arifoil.sh
ends in a 404 error:
--2022-03-16 14:12:50-- http://m-selig.ae.illinois.edu/ads/archives/coord_seligFmt.tar.gz
Resolving m-selig.ae.illinois.edu (m-selig.ae.illinois.edu)... 18.220.149.166
Connecting to m-selig.ae.illinois.edu (m-selig.ae.illinois.edu)|18.220.149.166|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://m-selig.ae.illinois.edu/ads/archives/coord_seligFmt.tar.gz [following]
--2022-03-16 14:12:51-- https://m-selig.ae.illinois.edu/ads/archives/coord_seligFmt.tar.gz
Connecting to m-selig.ae.illinois.edu (m-selig.ae.illinois.edu)|18.220.149.166|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-03-16 14:12:51 ERROR 404: Not Found.
Have these files been upload elsewhere?
Thanks!
Hi, I try to launch dataGen.py with OpenFOAM version 6.0 and the following error occurs :
--> FOAM FATAL IO ERROR:
keyword freestreamValue is undefined in dictionary "/home/pierre/EF/DataSet/data/OpenFOAM/0/p.boundaryField.inlet"
file: /home/pierre/EF/DataSet/data/OpenFOAM/0/p.boundaryField.inlet from line 25 to line 25.
From function const Foam::entry& Foam::dictionary::lookupEntry(const Foam::word&, bool, bool) const
in file db/dictionary/dictionary.C at line 566.
FOAM exiting
Traceback (most recent call last):
File "./dataGen.py", line 172, in <module>
outputProcessing(basename, fsX, fsY, imageIndex=n)
File "./dataGen.py", line 93, in outputProcessing
ar = np.loadtxt(pfile)
File "/home/pierre/.conda/envs/PyTorch-learning/lib/python3.7/site-packages/numpy/lib/npyio.py", line 955, in loadtxt
fh = np.lib._datasource.open(fname, 'rt', encoding=encoding)
File "/home/pierre/.conda/envs/PyTorch-learning/lib/python3.7/site-packages/numpy/lib/_datasource.py", line 266, in open
return ds.open(path, mode, encoding=encoding, newline=newline)
File "/home/pierre/.conda/envs/PyTorch-learning/lib/python3.7/site-packages/numpy/lib/_datasource.py", line 624, in open
raise IOError("%s not found." % path)
It seems that a freestream value is required for OpenFOAM simulations.
Hi,
The download links to the two pre-trained models seemed to not work. Could you take a look?
Thank you!
Hello,
First of all, thank you for sharing your model!
When I try to download the Airfoils dataset so that I could generate my own data for training I get the following error from the execution of download_airfoils.sh
script:
Location: https://m-selig.ae.illinois.edu/ads/archives/coord_seligFmt.tar.gz [following]
--2022-08-01 13:08:12-- https://m-selig.ae.illinois.edu/ads/archives/coord_seligFmt.tar.gz
Connecting to m-selig.ae.illinois.edu (m-selig.ae.illinois.edu)|18.220.149.166|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-08-01 13:08:12 ERROR 404: Not Found.
It seems like the URL is no longer valid?
Is it possible to re-upload the airfoils data for the generator?
Best regards,
Adam
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.