Hammering at the Entropy: A GENERIC-Guided Approach to Learning Polymeric Rheological Constitutive Equations Using PINNs
This repository contains a simplified, representative implementation of the code described in the article:
"Hammering at the Entropy: A GENERIC-Guided Approach to Learning Polymeric Rheological Constitutive Equations Using PINNs."
It includes a solver, a constitutive equation model, and an example workflow demonstrating the implementation, including some precomputed results (neural network training and simulations with and without the NN).
-
GenericRheoFoamPINN A modified version of the
rheoFoamsolver (OpenFOAM v9), extended to interact with PyTorch by calling the localpython_script.pyfile. -
GenericPINN A new constitutive equation incorporating the GENERIC formalism, featuring the use of the auxiliary variable
$\sigma$ . -
pythonPal A customized version of
pythonPalused to connect OpenFOAM to Python viapybind11. This interface is based on the work: "A General Approach for Running Python Codes in OpenFOAM Using an Embedded Pybind11 Python Interpreter" by S. Rodriguez and P. Cardiff. -
rheoPINN.py The Python script called by OpenFOAM to execute the Physics-Informed Neural Network (PINN).
-
test_case This directory contains three subfolders:
01_OB-analytical02_PINN-training03_OB-PINNs
These test case relies on the
GenericPINNconstitutive equation and theGenericRheoFoamPINNsolver.
- Run with
SOLUTION_THEORETICAL=Trueset insidepython_script.py, which forces the use of the analytical solution implemented inrheoPINN.py. - At time step 50, a file named
cellData.csvis generated using thewriteCellDatafunction defined insystem/controlDict. - This file serves as training data for the PINN in the next stage.
- The PINN is trained using the
cellData.csvfrom the analytical simulation. - The resulting trained model is stored as
trained_solution.pth.
- A new simulation is performed using the previously trained PINN model.
- Demonstrates the model’s generalization to a slightly different Weissenberg number.