Skip to content

Data-driven fluid modeling using physics-informed neural networks #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
###############################################################################################
# # _____ __ _____ ____ __ __ ____ # #
# # / ___// / / /__ \ / __ \____ _/ /_____ _/ |/ (_)___ ___ _____ # #
# # \__ \/ / / /__/ / / / / / __ `/ __/ __ `/ /|_/ / / __ \/ _ \/ ___/ # #
# # ___/ / /_/ // __/ / /_/ / /_/ / /_/ /_/ / / / / / / / / __/ / # #
# # /____/\____//____/ /_____/\__,_/\__/\__,_/_/ /_/_/_/ /_/\___/_/ # #
# # # #
###############################################################################################

############################# FILE NAME: 0:generate_config.py #################################
#=============================================================================================#
# author: Evert Bunschoten |
# :PhD Candidate , |
# :Flight Power and Propulsion |
# :TU Delft, |
# :The Netherlands |
# |
# |
# Description: |
# Generate configuration for defining a physics-informed neural network for modeling the |
# fluid properties of siloxane MM in NICFD with the data-driven fluid model in SU2. |
# |
# Version: 2.0.0 |
# |
#=============================================================================================#

from su2dataminer.config import Config_NICFD

# The fluid data for siloxane MM are generated with the CoolProp module using the Helmoltz
# equation of state.
fluid_name = "MM"
EoS_type = "HEOS"

Config = Config_NICFD()
Config.SetFluid(fluid_name)
Config.SetEquationOfState(EoS_type)

# Fluid data are generated on a density-energy grid rather than pressure-temperature.
Config.UsePTGrid(False)

# Display configuration settings and save config object.
Config.SetConfigName("SU2DataMiner_MM")
Config.PrintBanner()
Config.SaveConfig()
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
###############################################################################################
# # _____ __ _____ ____ __ __ ____ # #
# # / ___// / / /__ \ / __ \____ _/ /_____ _/ |/ (_)___ ___ _____ # #
# # \__ \/ / / /__/ / / / / / __ `/ __/ __ `/ /|_/ / / __ \/ _ \/ ___/ # #
# # ___/ / /_/ // __/ / /_/ / /_/ / /_/ /_/ / / / / / / / / __/ / # #
# # /____/\____//____/ /_____/\__,_/\__/\__,_/_/ /_/_/_/ /_/\___/_/ # #
# # # #
###############################################################################################

########################### FILE NAME: 1:generate_fluid_data.py ###############################
#=============================================================================================#
# author: Evert Bunschoten |
# :PhD Candidate , |
# :Flight Power and Propulsion |
# :TU Delft, |
# :The Netherlands |
# |
# |
# Description: |
# Generate the single-phase fluid data for siloxane MM which is used to train the |
# physics-informed neural network. |
# |
# Version: 2.0.0 |
# |
#=============================================================================================#

from su2dataminer.config import Config_NICFD
from su2dataminer.generate_data import DataGenerator_CoolProp

# Load SU2 DataMiner configuration.
Config = Config_NICFD("SU2DataMiner_MM.cfg")

# Initiate data generator.
DG = DataGenerator_CoolProp(Config)
DG.PreprocessData()
DG.ComputeData()

# Visualize and save fluid data.
DG.VisualizeFluidData()
DG.SaveData()
53 changes: 53 additions & 0 deletions compressible_flow/NICFD_nozzle/PhysicsInformed/2:train_PINN.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
###############################################################################################
# # _____ __ _____ ____ __ __ ____ # #
# # / ___// / / /__ \ / __ \____ _/ /_____ _/ |/ (_)___ ___ _____ # #
# # \__ \/ / / /__/ / / / / / __ `/ __/ __ `/ /|_/ / / __ \/ _ \/ ___/ # #
# # ___/ / /_/ // __/ / /_/ / /_/ / /_/ /_/ / / / / / / / / __/ / # #
# # /____/\____//____/ /_____/\__,_/\__/\__,_/_/ /_/_/_/ /_/\___/_/ # #
# # # #
###############################################################################################

################################ FILE NAME: 2:train_PINN.py ###################################
#=============================================================================================#
# author: Evert Bunschoten |
# :PhD Candidate , |
# :Flight Power and Propulsion |
# :TU Delft, |
# :The Netherlands |
# |
# |
# Description: |
# Initate physics-informed machine learning process for training the neural network used to |
# model the fluid properties of siloxane MM in NICFD with the SU2 data-driven fluid model. |
# |
# Version: 2.0.0 |
# |
#=============================================================================================#

from su2dataminer.config import Config_NICFD
from su2dataminer.manifold import TrainMLP_NICFD

# Load SU2 DataMiner configuration.
Config = Config_NICFD("SU2DataMiner_MM.cfg")

# Set learning rate parameters and define network architecture.
Eval = TrainMLP_NICFD(Config)

# Initial learning rate: 10^-3, learning rate decay parameter: 9.8787, mini-batch size: 2^6.
Eval.SetAlphaExpo(-3.0)
Eval.SetLRDecay(+9.8787e-01)
Eval.SetBatchExpo(6)

# Network architecture: two hidden layers with 12 nodes.
Eval.SetHiddenLayers([12,12])
# Hidden layer activation function: exp(x)
Eval.SetActivationFunction("exponential")
# Display training progress in the terminal.
Eval.SetVerbose(1)

# Initiate training process.
Eval.CommenceTraining()
Eval.TrainPostprocessing()

Config.UpdateMLPHyperParams(Eval)
Config.SaveConfig()
Loading