Skip to content
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

Physics-informed neural networks for data-driven fluid model #2444

Open
wants to merge 35 commits into
base: develop
Choose a base branch
from

Conversation

EvertBunschoten
Copy link
Member

@EvertBunschoten EvertBunschoten commented Feb 14, 2025

Proposed Changes

The data-driven fluid model in SU2 has been upgraded with the ability to use physics-informed neural networks (PINN's) to compute the fluid thermodynamic state for NICFD flows. This functionality was presented during the 2024 SU2 conference and the issues regarding non-physical behavior have been addressed.

The use of PINN makes the data-driven fluid model substantially more robust and efficient for flow and adjoint simulations of flows of fluids in the non-ideal thermodynamic state.

PINN's can be trained using SU2 DataMiner for any fluid or compatible mixture of fluids available in the CoolProp library. An elaborate tutorial integrating SU2 DataMiner with the data-driven fluid solver in SU2 will follow soon!

Related Work

Also added the pressure ramp functionality to the Riemann-type boundary condition.

PR Checklist

Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.

  • I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson).
  • My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/).
  • I used the pre-commit hook to prevent dirty commits and used pre-commit run --all to format old commits.
  • I have added a test case that demonstrates my contribution, if necessary.
  • I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp), if necessary.

Comment on lines -309 to +315
SU2_MPI::Error("Outlet pressure ramp only implemented for NRBC", CURRENT_FUNCTION);
config->SetRiemann_Var1(outPres, Marker_Tag);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EvertBunschoten I made some modifcations to this part of the code in #2419 , I'll try close it today.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update: finished now.

@EvertBunschoten EvertBunschoten marked this pull request as ready for review February 17, 2025 22:00
@EvertBunschoten EvertBunschoten changed the title [WIP]Physics-informed neural networks for data-driven fluid model Physics-informed neural networks for data-driven fluid model Feb 17, 2025
Comment on lines 4000 to 4010
/*!
* \brief Get initial density value for Newton solver in data-driven fluid model.
* \return Initial density value.
*/
su2double GetInitialDensity_DataDriven(void) const { return DataDriven_rho_init; }

/*!
* \brief Get initial static value for Newton solver in data-driven fluid model.
* \return Initial static value.
*/
su2double GetInitialEnergy_DataDriven(void) const { return DataDriven_e_init; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make a dedicated struct to store the _DataDriven config options and replace all _DataDriven accessors which are becoming numerous.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've replaced the accessors for the CDataDrivenFluid fluid model now with structs. I did a similar thing for the CFluidFlamelet fluid model.

su2double drhode_p = -dPde_rho/dPdrho_e;
su2double dTde_p = dTde_rho + dTdrho_e*drhode_p;
su2double dhde_p = dhde_rho + drhode_p*dhdrho_e;
Cp = dhde_p / dTde_p;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are Cv and Cp local variables? Why are they not preaccumulated? Do you have any adjoint verification cases yet to be playing with preaccumulation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially copied the preaccumulation from the Peng-Robinson fluid model. I added some unit tests for fluid model consistency and I'm planning to add some AD unit tests as well.

Comment on lines 337 to 338
void CDataDrivenFluid::Run_Newton_Solver(su2double Y1_target, su2double Y2_target, su2double& Y1, su2double& Y2,
su2double& dY1drho, su2double& dY1de, su2double& dY2drho, su2double& dY2de) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are some of these passed by value and others by non-const reference? Are they outputs?
Why aren't they preaccumulated either as input or output?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They could indeed be passed by const value and const reference, since none of them are outputs. I still need to verify whether I did the preaccumulation correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants