precice / openfoam-adapter

OpenFOAM-preCICE adapter
https://precice.org/adapter-openfoam-overview.html
GNU General Public License v3.0
135 stars 80 forks source link

Add phase variable and flux coupling for interFOAM in the FF module #308

Closed thesamriel closed 8 months ago

thesamriel commented 10 months ago

TODO list:

Coupling of Alpha:

Coupling of interFoam solvers does not work perfectly. Below screenshots show a very basic test scenario of a laminar flow through a 2-D pipe with the top half being air and the bottom half being incoming water. Gravity is set to 0 to avoid the creation of vortices. The top image always shows the monolithic simulation, the bottom one the coupled simulation.

Time Alpha Pressure
5s Selection_091 Selection_092
9.5s Selection_090 Selection_087
20s Selection_089 Selection_088

Coupling of the phase variable Alpha works with Dirichlet-Neumann coupling, however there are some flow artefacts when the air-water-interface crosses the coupling interface. However, I suspect the problem to be not in the coupling perse, but rather in the interFoam outlet boundary conditions. This is because, the fluid also behaves strange at the outlet of the monolithic version.

Coupling of Phi:

Coupling was tested by adding it to normal FF-coupling. I also used it for better stability in the breaking dam scenario presented at Coupled Conference. I don't have/know a proper scenario, where coupling of Phi can be demonstrated. Nonetheless, the functionality is there and might be useful to some users.

Test case:

The interfoam pipe test case from above can be found on the interfoam-pipe branch of the tutorials repository. It also includes the option to additionally couple phi, which will change the results marginally. Note how the water is held back or reflected at the outlet as well. Figuring out the correct outlet boundary condition might help improve the coupling as well. Found a discussion on this here, but not a proper solution.

MakisH commented 10 months ago

Thanks for the PR, @thesamriel! Nice to finally have it here! Could you please also add a testcase in the tutorials?

thesamriel commented 10 months ago

I added the test case to the tutorials. See at the bottom of the updated description of the PR here.

thesamriel commented 10 months ago

The only thing I don't like is the name of the variables, but from what I understand from the code these are already set by OpenFOAM. Still, it could be helpful to add some code documentation on what these variables are and where to use them. Alpha is a volume fraction for multi-phase flows?

I'm also not too convinced about the names, these are just the terms used by OpnFOAM. Phi could be renamed to Flux or FaceFlux. Alpha could be renamed to VolumeFraction but I'm not so sure how much I like that.

MakisH commented 10 months ago

I added the test case to the tutorials. See at the bottom of the updated description of the PR here.

Please also start a PR, so that I can add comments there (and merge it). It currently seems to only be a branch.

MakisH commented 8 months ago

The only thing I don't like is the name of the variables, but from what I understand from the code these are already set by OpenFOAM. Still, it could be helpful to add some code documentation on what these variables are and where to use them. Alpha is a volume fraction for multi-phase flows?

I'm also not too convinced about the names, these are just the terms used by OpnFOAM. Phi could be renamed to Flux or FaceFlux. Alpha could be renamed to VolumeFraction but I'm not so sure how much I like that.

This is the first adapter that supports multiphase flows in flow coupling, and these names are clear in the OpenFOAM community. I think we can keep them like this for now, and deprecate them in the future, if a need pops up.