Skip to content

Commit 3e37639

Browse files
Updated tutorial documentation
1 parent c3a1097 commit 3e37639

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

_tutorials/compressible_flow/NICFD_nozzle/NICFD_nozzle_datadriven.md

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ The following steps explain how to train physics-informed neural networks for da
4949
Similar to SU2, SU2 DataMiner uses a configuration file to store information regarding the type of fluid, the resolution of the training data set, and the hyperparameters of the networks. Running the script [0:generate_config.py](https://github.com/su2code/Tutorials/tree/master/compressible_flow/NICFD_nozzle/PhysicsInformed/0:generate_config.py) generates the SU2 DataMiner configuration used in this tutorial and is saved as a binary file named ```SU2DataMiner_MM.cfg```.
5050

5151
### 2. Generate Training Data
52-
The thermodynamic state data used to train the network for the data-driven fluid simulation is generated using the Helmholtz equation of state evalauted through the python module for CoolProp. The thermodynamic state data are generated on a density-static energy grid for the gas and supercritical phase between the minimum and maximum density of the fluid supported by CoolProp.
52+
The thermodynamic state data used to train the network for the data-driven fluid simulation is generated using the Helmholtz equation of state evalauted through the python module for CoolProp. The thermodynamic state data are generated on a density-static energy grid for the gas and supercritical phase between the minimum and maximum density of the fluid supported by CoolProp. The ranges for density and energy or pressure and temperature within which training data are generated can be manually specified.
5353

5454
By running the script [1:generate_fluid_data.py](https://github.com/su2code/Tutorials/tree/master/compressible_flow/NICFD_nozzle/PhysicsInformed/1:generate_fluid_data.py) will generate the thermodynamic state data used for the training of the network and generate contour plots of the temperature, pressure, and speed of sound. The complete set of thermodynamic state data is stored in the file titled *fluid_data_full.csv*. 80% of the randomly sampled fluid data is used to update the weights of the network during training, 10% is used to monitor the convergence of the training process, and the remaining 10% is used to validate the accuracy of the network upon completion of the training process. The complete data set contains approximately 2.3e5 unique data points.
5555

@@ -59,7 +59,7 @@ Figure (1): Section of training data set near the critial point ('cp').
5959

6060
### 3. Train physics-informed neural network
6161
The network used in this tutorial uses two hidden layers with 12 nodes each. The exponential function is used as the hidden layer activation function. This is an unusual choice, but is motivated by the fact that it reduces the computational cost required to calculate the network Jacobian and Hessian during the CFD solution process.
62-
The training process uses an exponential decay function for the learning rate, with an initial value of 1e-3. During each update step, the weights and biases of the network are adjusted according to the value of the loss function evaluated on a batch of 64 training data points.
62+
The training process uses an exponential decay function for the learning rate, with an initial value of 1e-3. During each update step, the weights and biases of the network are adjusted according to the value of the loss function evaluated on a batch of 64 training data points. The hidden layer architecture and learning rate of the network used in this tutorial were selected through trial and error.
6363
More details regarding the training method are presented in the [literature](https://doi.org/10.1016/j.compfluid.2025.106932).
6464

6565
The training progress can be followed from the terminal, but can also be monitored from the training convergence plots that are periodically updated under ```Worker_0/Model_0/```.
@@ -68,15 +68,24 @@ After training, the weights and biases of the network are stored in the SU2 Data
6868

6969
IMAGE: training history plot, predicted vs training data
7070

71+
![TrainingHistory](../../tutorials_files/compressible_flow/NICFD_nozzle_datadriven/images/TrainingHistory.png)
72+
Figure (2): Training convergence history
73+
74+
75+
![Z_comparison](../../tutorials_files/compressible_flow/NICFD_nozzle_datadriven/images/Z_contours_comp.png)
76+
Figure (3): Compressibility factor from reference data (black) and evaluated by data-driven equation of state (red).
77+
78+
7179
### 4. Preparation of the Simulation
7280

7381
To run data-driven fluid simulations in SU2, you need the SU2 configuration file, the mesh, and the file describing the multilayer perceptron. Running the script [3:prepare_simulation.py](https://github.com/su2code/Tutorials/tree/master/compressible_flow/NICFD_nozzle/PhysicsInformed/3:prepare_simulation.py) generates the computational mesh, writes the SU2 configuration file, and writes the ASII file containing the weights and biases of the network.
7482

7583
The mesh is generated using gmesh in which the computational domain is generated accoring to the nozzle contour. The nozzle wall is modeled as a non-slip surface and prism layer refinement is applied to resolve the boundary layer.
7684

77-
IMAGE: highlight of mesh
85+
![mesh_highlight](../../tutorials_files/compressible_flow/NICFD_nozzle_datadriven/images/mesh_highlight.png)
86+
Figure (4): Computational mesh used for the nozzle flow simulation (top) and highlight of the throat area near the wall (bottom).
7887

79-
The inflow condition is modeled as a non-reflective Giles boundary condition where the pressure and temperature of the critical point of the fluid are imposed as the stagnation pressure and stagnation temperature. The outflow is also modeled as a non-reflective Giles boundary condition, where a static pressure 10 times lower than the inflow pressure is imposed.
88+
The inflow condition is modeled as a non-reflective Giles boundary condition where the pressure and temperature of the critical point of the fluid are imposed as the stagnation pressure and stagnation temperature. The outflow is also modeled as a non-reflective Giles boundary condition, where a static pressure 10 times lower than the inflow pressure is imposed. To improve the stability of the solution process, the pressure imposed at the outflow boundary ramps down from the inflow stagnation pressure to the target value over the course of the first 200 flow iterations.
8089

8190
The data-driven fluid model with the physics-informed entropy-based equation of state is enabled through the following options in the [SU2 configuration file](https://github.com/su2code/Tutorials/tree/master/compressible_flow/NICFD_nozzle/PhysicsInformed/config_NICFD_PINN.cfg):
8291
```
@@ -87,21 +96,20 @@ FILENAMES_INTERPOLATOR= MLP_siloxane_MM.mlp
8796
```
8897
where the ```USE_PINN= YES``` option enables the use of a physics-informed neural network for thermodynamic state calculations. The file ```MLP_siloxane_MM.mlp``` is the ASII file which describes the network architecture and the network weights and biases. At the start of the SU2 solution process, the network weigths and biases are imported into SU2 through the MLPCpp sub-module.
8998

90-
IMAGE: inflow-outflow isentrope compared to training data
9199

92100
### 5. Run SU2
93101
The simulation us run by the following command
94102
```
95103
mpirun -n <NP> SU2_CFD config_NICFD_PINN.cfg
96104
```
97-
where ```<NP>``` is the number of cores.
105+
where ```<NP>``` is the number of cores. [Figure 5](#mesh_highlight) shows the residual trends of the flow solution of the course of 10k iterations.
98106

99-
IMAGE: simulation convergence trends
107+
![mesh_highlight](../../tutorials_files/compressible_flow/NICFD_nozzle_datadriven/images/convergence_history.png)
108+
Figure (5): Convergence history of the SU2 simulation.
100109

101-
### Results
102-
103-
IMAGE: flow field
104110

105-
IMAGE: solution w.r.t. training data
111+
### Results
106112

107-
IMAGE: comparison to CoolProp solution
113+
The Mach number and compressibility factor of the flow solution is visualized in the image below. The flow expands to supersonic speeds in the divergent section of the nozzle, where the compressibility factor approaches a value of 1.0, while the compressibility factor is significantly lower in the convergent section of the nozzle.
114+
![mesh_highlight](../../tutorials_files/compressible_flow/NICFD_nozzle_datadriven/images/Mach_Z.png)
115+
Figure (6): Mach number of the flow solution (top) and compressibility factor of the fluid (bottom).

0 commit comments

Comments
 (0)