Skip to content

BCAM-CFD/GENERICFoam-PINN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hammering at the Entropy: A GENERIC-Guided Approach to Learning Polymeric Rheological Constitutive Equations Using PINNs

Description

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).

Contents

  • GenericRheoFoamPINN A modified version of the rheoFoam solver (OpenFOAM v9), extended to interact with PyTorch by calling the local python_script.py file.

  • GenericPINN A new constitutive equation incorporating the GENERIC formalism, featuring the use of the auxiliary variable $\sigma$.

  • pythonPal A customized version of pythonPal used to connect OpenFOAM to Python via pybind11. 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-analytical
    • 02_PINN-training
    • 03_OB-PINNs

    These test case relies on the GenericPINN constitutive equation and the GenericRheoFoamPINN solver.

Workflow Description

1. 01_OB-analytical (Wi = 0.2)

  • Run with SOLUTION_THEORETICAL=True set inside python_script.py, which forces the use of the analytical solution implemented in rheoPINN.py.
  • At time step 50, a file named cellData.csv is generated using the writeCellData function defined in system/controlDict.
  • This file serves as training data for the PINN in the next stage.

2. 02_PINN-training

  • The PINN is trained using the cellData.csv from the analytical simulation.
  • The resulting trained model is stored as trained_solution.pth.

3. 03_OB-PINNs (Wi = 0.19)

  • A new simulation is performed using the previously trained PINN model.
  • Demonstrates the model’s generalization to a slightly different Weissenberg number.

About

rheoFoam based modification to integrate Physics Informed Neural Network in the GENERIC compliant form

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors