Skip to content

Commit 1c6804b

Browse files
committed
put all
1 parent 9054c22 commit 1c6804b

File tree

374 files changed

+223326
-679
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

374 files changed

+223326
-679
lines changed

.history/run/meshMotion/diff_20251110174823.psvm

Lines changed: 22746 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
cd "${0%/*}" || exit # Run from this directory
3+
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
4+
#------------------------------------------------------------------------------
5+
6+
7+
8+
echo Copy the template case and set dynamicMesh for Machine Learning
9+
(
10+
cp -r ellipsoid3D
11+
12+
echo Set mesh motion settings to Laplace mesh motion
13+
cp constant/dynamicMeshDict.MachineLearningMeshMotion constant/dynamicMeshDict
14+
15+
runParallel $(getApplication)
16+
17+
cd ..
18+
19+
echo Copy data for comparison
20+
cp -r wingMotion2D_pimpleFoam mesh-motion_Laplace
21+
22+
echo Reset mesh motion settings
23+
git checkout wingMotion2D_pimpleFoam/constant/dynamicMeshDict
24+
25+
echo Create .foam file visualization in ParaView
26+
touch mesh-motion_Laplace/laplace.foam
27+
28+
echo Generate mesh quality metrics
29+
mpirun -np 4 checkMesh \
30+
-case mesh-motion_Laplace \
31+
-writeFields '(nonOrthoAngle skewness)' -parallel
32+
)
33+
34+
#------------------------------------------------------------------------------
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/sh
2+
cd "${0%/*}" || exit # Run from this directory
3+
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
4+
#------------------------------------------------------------------------------
5+
6+
./Allclean
7+
8+
./Allrun.pre
9+
10+
echo Delete previous results mesh-motion_Pinn
11+
rm -rf mesh-motion_Pinn
12+
13+
echo Use the constant/dynamicMesh.laplace settings and run the solver locally
14+
(
15+
cd wingMotion2D_pimpleFoam || exit
16+
17+
echo Set mesh motion settings to Pinn mesh motion
18+
cp constant/dynamicMeshDict.PinnMeshMotion constant/dynamicMeshDict
19+
20+
cd ..
21+
22+
echo Run the SmartSim python script that implements the Pinn+CFD algorithm
23+
python openfoam-smartsim-wingmotion_pinn.py
24+
25+
echo Copy data for comparison
26+
cp -r mesh-motion mesh-motion_Pinn
27+
28+
echo Reset mesh motion settings
29+
git checkout wingMotion2D_pimpleFoam/constant/dynamicMeshDict
30+
31+
echo Create .foam file for visualization in ParaView
32+
touch mesh-motion_Pinn/of_model/pinn.foam
33+
34+
echo Generating mesh quality metrics
35+
mpirun -np 4 checkMesh \
36+
-case mesh-motion_Pinn/of_model \
37+
-writeFields '(nonOrthoAngle skewness)' -parallel
38+
)
39+
40+
#------------------------------------------------------------------------------
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/sh
2+
cd "${0%/*}" || exit # Run from this directory
3+
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
4+
#------------------------------------------------------------------------------
5+
6+
./Allclean
7+
8+
./Allrun.pre
9+
10+
rm -rf mesh-motion_Laplace
11+
12+
echo Use the constant/dynamicMesh.laplace settings and run the solver locally
13+
(
14+
cd wingMotion2D_pimpleFoam || exit
15+
16+
echo Set mesh motion settings to Laplace mesh motion
17+
cp constant/dynamicMeshDict.LaplaceMeshMotion constant/dynamicMeshDict
18+
19+
runParallel $(getApplication)
20+
21+
cd ..
22+
23+
echo Copy data for comparison
24+
cp -r wingMotion2D_pimpleFoam mesh-motion_Laplace
25+
26+
echo Reset mesh motion settings
27+
git checkout wingMotion2D_pimpleFoam/constant/dynamicMeshDict
28+
29+
echo Create .foam file visualization in ParaView
30+
touch mesh-motion_Laplace/laplace.foam
31+
32+
echo Generate mesh quality metrics
33+
mpirun -np 4 checkMesh \
34+
-case mesh-motion_Laplace \
35+
-writeFields '(nonOrthoAngle skewness)' -parallel
36+
)
37+
38+
#------------------------------------------------------------------------------
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Running
2+
3+
The 2D wing is rapidly translated and rotated, causing significant mesh deformation. The deformation is implemented as
4+
5+
1. Laplace deformation available in OpenFOAM
6+
2. MLP Machine-Learning deformation, combining Pytorch and OpenFOAM via SmartSim/SmartRedis.
7+
8+
To run Laplace deformation make sure SmartSim env and OpenFOAM env are sourced, then
9+
10+
```
11+
wingMotion> ./Allrun.LaplaceMeshMotion
12+
```
13+
14+
this creates `mesh-motion_Laplace` - a folder that is an OpenFOAM simulation, for Laplace deformation, we don't need SmartSim/SmartRedis.
15+
16+
Tor run the SmartSim MLP mesh deformation, run
17+
18+
```
19+
wingMotion> ./Allrun.MachineLearningMeshMotion
20+
```
21+
22+
which creates `mesh-motion_MachineLearning`, which has sub-folders for the SmartSim orchestrator, for the openfoam model (`of_model`, OpenFOAM simulation case), and the MLP training script (`training_app`).
23+
24+
25+
Both `Allrun.LaplaceMeshMotion` and `Allrun.MachineLearningMeshMotion` will compute mesh quality metrics (most important ones are non-orthogonality and skewness), and `.foam` files that ParaView needs to recognize OpenFOAM folders. A paraview state file is prepared that compares the decrease in non-orthogonality, visualizing the difference between Laplace non-orthogonality and MLP non-orthogonality, run it as
26+
27+
```
28+
wingMotion> paraview --state=visualize-non-orth-difference.pvsm
29+
```
30+
31+
This will show how the Laplace causes an increase of non-orthogonality at the worst possible place - next to the airfoil. The increase is up to 35 degrees, w.r.t a simple MLP.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Running
2+
3+
The 2D wing is rapidly translated and rotated, causing significant mesh deformation. The deformation is implemented as
4+
5+
1. Laplace deformation available in OpenFOAM
6+
2. MLP Machine-Learning deformation, combining Pytorch and OpenFOAM via SmartSim/SmartRedis.
7+
8+
To run Laplace deformation make sure SmartSim env and OpenFOAM env are sourced, then
9+
10+
```
11+
wingMotion> ./Allrun.LaplaceMeshMotion
12+
```
13+
14+
this creates `mesh-motion_Laplace` - a folder that is an OpenFOAM simulation, for Laplace deformation, we don't need SmartSim/SmartRedis.
15+
16+
Tor run the SmartSim MLP mesh deformation, run
17+
18+
```
19+
wingMotion> ./Allrun.MachineLearningMeshMotion
20+
```
21+
22+
which creates `mesh-motion_MachineLearning`, which has sub-folders for the SmartSim orchestrator, for the openfoam model (`of_model`, OpenFOAM simulation case), and the MLP training script (`training_app`).
23+
24+
25+
Both `Allrun.LaplaceMeshMotion` and `Allrun.MachineLearningMeshMotion` will compute mesh quality metrics (most important ones are non-orthogonality and skewness), and `.foam` files that ParaView needs to recognize OpenFOAM folders. A paraview state file is prepared that compares the decrease in non-orthogonality, visualizing the difference between Laplace non-orthogonality and MLP non-orthogonality, run it as
26+
27+
```
28+
wingMotion> paraview --state=diff.pvsm
29+
```
30+
31+
This will show how the Laplace causes an increase of non-orthogonality at the worst possible place - next to the airfoil. The increase is up to 35 degrees, w.r.t a simple MLP.

0 commit comments

Comments
 (0)