Skip to content

Commit 4cc7992

Browse files
zilonglicfdJason Li
andauthored
Minor changes (#27)
* Added FIML airfoil dynamic stall tutotial * Added the FIML tutorial for airfoil dynamic stall. * Update preProcessing.sh * Deleted the steady case. * Deleted the sst-ref.txt file. --------- Co-authored-by: Jason Li <zilonglicfd@iastate.edu>
1 parent a562050 commit 4cc7992

192 files changed

Lines changed: 12296 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
# Check if the OpenFOAM enviroments are loaded
4+
if [ -z "$WM_PROJECT" ]; then
5+
echo "OpenFOAM environment not found, forgot to source the OpenFOAM bashrc?"
6+
exit
7+
fi
8+
9+
# generate mesh for aoa=4
10+
cd preparation-pitch-05/mesh/
11+
./genMesh.sh
12+
cp -r constant/polyMesh/ ../sa-pre/constant
13+
cp -r constant/polyMesh/ ../sst-pre/constant
14+
cd ../
15+
16+
# simulation preparation
17+
./simPre.sh
18+
./simPicthPre.sh
19+
./simRun.sh
20+
21+
cd ../preparation-pitch-035/
22+
# simulation preparation
23+
./simPre.sh
24+
./simPicthPre.sh
25+
./simRun.sh
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
while true
4+
do
5+
read -p "Delete everything and resume to the default setup (y/n)?" yn
6+
case $yn in
7+
[Yy]* )
8+
# clean everyting
9+
echo "Cleaning..."
10+
rm -rf */processor*
11+
exit
12+
;;
13+
[Nn]* ) exit;;
14+
* ) echo "Please answer yes or no.";;
15+
esac
16+
done
17+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
cd fiml && mpirun -np 4 python runScript_fiml.py && cd ..
3+
4+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*--------------------------------*- C++ -*---------------------------------*\
2+
| ======== | |
3+
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4+
| \ / O peration | Version: v1812 |
5+
| \ / A nd | Web: www.OpenFOAM.com |
6+
| \/ M anipulation | |
7+
\*--------------------------------------------------------------------------*/
8+
FoamFile
9+
{
10+
version 2.0;
11+
format ascii;
12+
class dictionary;
13+
location "constant";
14+
object transportProperties;
15+
}
16+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17+
18+
transportModel Newtonian;
19+
20+
nu 0.2e-5;
21+
Pr 0.7;
22+
Prt 1.0;
23+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*--------------------------------*- C++ -*---------------------------------*\
2+
| ======== | |
3+
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4+
| \ / O peration | Version: v1812 |
5+
| \ / A nd | Web: www.OpenFOAM.com |
6+
| \/ M anipulation | |
7+
\*--------------------------------------------------------------------------*/
8+
FoamFile
9+
{
10+
version 2.0;
11+
format ascii;
12+
class dictionary;
13+
location "constant";
14+
object turbulenceProperties;
15+
}
16+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17+
18+
simulationType RAS;
19+
RAS
20+
{
21+
RASModel SpalartAllmaras;
22+
turbulence on;
23+
printCoeffs off;
24+
}
25+
26+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Airfoil_DynamicStall/unsteady/predict/predict-pitch-rate-0.35/fiml/paraview.foam

Whitespace-only changes.
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
#!/usr/bin/env python
2+
"""
3+
Run Python tests for optimization integration
4+
"""
5+
6+
from mpi4py import MPI
7+
import os
8+
import numpy as np
9+
#from testFunctions import *
10+
11+
import openmdao.api as om
12+
from openmdao.api import Group
13+
from mphys.multipoint import Multipoint
14+
from dafoam.mphys.mphys_dafoam import DAFoamBuilderUnsteady
15+
from mphys.scenario_aerodynamic import ScenarioAerodynamic
16+
from pygeo.mphys import OM_DVGEOCOMP
17+
18+
def run_tests(om, Top, comm, daOptions):
19+
20+
# adjoint-deriv
21+
prob = om.Problem()
22+
prob.model = Top()
23+
prob.setup()
24+
prob.run_model()
25+
26+
27+
gcomm = MPI.COMM_WORLD
28+
29+
# aero setup
30+
U0 = 10.0
31+
A0 = 0.1
32+
LRef = 1.0
33+
34+
# Set the parameters for optimization
35+
daOptions = {
36+
"solverName": "DAPimpleDyMFoam",
37+
"useAD": {"mode": "reverse", "seedIndex": 0, "dvName": "beta"},
38+
"primalBC": {
39+
"useWallFunction": False,
40+
},
41+
"checkMeshThreshold": {
42+
"maxAspectRatio": 2000.0,
43+
"maxNonOrth": 70.0,
44+
"maxSkewness": 4.0,
45+
"maxIncorrectlyOrientedFaces": 0,
46+
},
47+
"dynamicMesh": {
48+
"active": True,
49+
"mode": "rotation",
50+
"center": [0.25, 0.0, 0.0],
51+
"axis": "z",
52+
"omega": -0.35,
53+
},
54+
"unsteadyAdjoint": {
55+
"mode": "timeAccurate",
56+
"PCMatPrecomputeInterval": 5,
57+
"PCMatUpdateInterval": 1,
58+
"readZeroFields": True,
59+
"additionalOutput": ["betaFINuTilda"],
60+
"reduceIO": True,
61+
},
62+
"tensorflow": {
63+
"active": True,
64+
"dummy_nn_model": {
65+
"predictBatchSize": 500,
66+
"nInputs": 4,
67+
},
68+
},
69+
"regressionModel": {
70+
"active": True,
71+
"dummy_nn_model": {
72+
"modelType": "externalTensorFlow",
73+
"inputNames": ["PoD", "VoS", "chiSA", "PSoSS"],
74+
"outputName": "betaFINuTilda",
75+
"hiddenLayerNeurons": [100, 100],
76+
"inputShift": [0.0, 0.0, 0.0, 0.0],
77+
"inputScale": [1.0, 1.0, 1.0, 1.0],
78+
"outputShift": 1.0,
79+
"outputScale": 1.0,
80+
"activationFunction": "tanh",
81+
"printInputInfo": True,
82+
"writeFeatures": True,
83+
"outputUpperBound": 1e1,
84+
"outputLowerBound": -1e1,
85+
"defaultOutputValue": 1.0,
86+
},
87+
},
88+
"function": {
89+
"CD": {
90+
"type": "force",
91+
"source": "patchToFace",
92+
"patches": ["wing"],
93+
"directionMode": "fixedDirection",
94+
"direction": [1.0, 0.0, 0.0],
95+
"scale": 1.0 / (0.5 * U0 * U0 * A0),
96+
"addToAdjoint": False,
97+
},
98+
"CL": {
99+
"type": "force",
100+
"source": "patchToFace",
101+
"patches": ["wing"],
102+
"directionMode": "fixedDirection",
103+
"direction": [0.0, 1.0, 0.0],
104+
"scale": 1.0 / (0.5 * U0 * U0 * A0),
105+
"addToAdjoint": False,
106+
},
107+
"CMZ": {
108+
"type": "moment",
109+
"source": "patchToFace",
110+
"patches": ["wing"],
111+
"axis": [0.0, 0.0, 1.0],
112+
"center": [0.25, 0.0, 0.05],
113+
"scale": 1.0 / (0.5 * U0 * U0 * A0 * LRef),
114+
"addToAdjoint": False,
115+
},
116+
},
117+
"adjStateOrdering": "cell",
118+
"adjEqnOption": {
119+
"gmresRelTol": 1.0e-4,
120+
"gmresMaxIters": 1000,
121+
"pcFillLevel": 1,
122+
"jacMatReOrdering": "natural",
123+
"useNonZeroInitGuess": False,
124+
"useMGSO": True,
125+
},
126+
"unsteadyCompOutput": {
127+
"CD": ["CD"],
128+
},
129+
}
130+
131+
132+
class Top(Group):
133+
def setup(self):
134+
135+
self.add_subsystem(
136+
"scenario",
137+
DAFoamBuilderUnsteady(solver_options=daOptions, mesh_options=None),
138+
promotes=["*"],
139+
)
140+
141+
# run the adjoint and forward ref
142+
run_tests(om, Top, gcomm, daOptions)
143+

0 commit comments

Comments
 (0)