tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

Add channel-transport transport OpenFOAM

Open fsimonis opened this issue 1 year ago • 4 comments

This PR adds an OpenFOAM variant of the transport participant of the channel-transport tutorial.

The case uses a modified version of the scalarTransportFoam application. Main difference is that we assume U to change every timestep. Therefore we need to recompute $\phi$ every timestep.

@MakisH Can you give this PR a thorough review to make it as easy to use as possible?

Result:

Screencast_20251210_145936.webm

Checklist:

  • [ ] I added a summary of any user-facing changes (compared to the last release) in the changelog-entries/<PRnumber>.md.
  • [ ] I will remember to squash-and-merge, providing a useful summary of the changes of this PR.

edit: updated to the working state

fsimonis avatar Jul 11 '24 11:07 fsimonis

@fsimonis this seems to be close to merging. Does this need more work from your side, or just a new review iteration?

edit: Actually, no. There is still a blocking modeling issue.

MakisH avatar Jul 17 '25 14:07 MakisH

Just finished a co-working session with @fsimonis. I pushed some new commits, which make the custom solver work with dynamic meshes and adjusts the case to apply dynamic mesh refinement with dynamicRefineFvMesh, based on the magnitude of the gradient of the transported value.

The settings are in constant/dynamicMeshDict and are currently rather arbitrary. Next step would be to refine these. We worked with an uncoupled scalar transport case based on the pitzDaily tutorial. Here is the draft (also with arbitrary settings):

adaptivePitzDaily.tar.gz

Run with: rm -rf 0.* && blockMesh && dynamicScalarTransportFoam.

The next step would be to further understand and adjust the mesh refinement settings.

The coupled case currently fails, but this is expected since the adapter does not yet support remeshing (https://github.com/precice/openfoam-adapter/issues/382). I can start an implementation of that.

The accumulation of T at the outlet remains. Making the channel longer and refining the mesh showed that the accumulation is really on the last 2-3 layers of the mesh. Changing the system/fvSchemes strongly affected the behavior (to the worse):

divSchemes
{
    default         none;
-    div(phi,T)      Gauss linearUpwind grad(T);
+    div(phi,T)      Gauss linear grad(T);
}

However, the numerics and the boundary conditions are the same as in the pitzDaily case, so this might be unrelated. I would look next if the changes from the standard scalarTransportFoam have any effect (but I would expect not).

Some URLs for reference:

  • https://precice.org/couple-your-code-moving-or-changing-meshes.html
  • https://api.openfoam.com/2506/classFoam_1_1dynamicRefineFvMesh.html#details
  • https://openfoamwiki.net/index.php/Parameter_Definitions_-_dynamicRefineFvMesh

MakisH avatar Nov 26 '25 16:11 MakisH

I got the non-AMR version running. I moved the AMR specific changes to #689 and will revert this PR to the non-AMR version. Let's then first merge it and continue from there.

fsimonis avatar Dec 10 '25 14:12 fsimonis

@MakisH I think I implemented all suggestions. Could you review again?

fsimonis avatar Dec 10 '25 15:12 fsimonis