OpenFoam RAS models

Hi, I was wondering if you can help me find a tutorial example for using a turbulent model in OpenFoam and preCICE. All the examples seems to be laminar. I have tried to convert the flow over heated plate example to a turbulent, but it fails. is there something that I am missing?
Below is the link to my model and setting. you can find in the parent directory the solid participant named Solid-elmer

There is a documented issue regarding turbulent cases: Different dimensions for dimensions Issue in FSI when turbulence model is used - OpenFOAM adapter · Issue #158 · precice/openfoam-adapter · GitHub

I am trying to reproduce the issue, could you maybe help?

Hello Makis,

How can I help in this. If you have Elmer installed you can use Solid-elmer for the solid part. So one update on this is that, if i change the thermoPhysicalProperties it seems to converge. it seems that the turbulent model is more sensitive. I think playing with relation factors might help. Let me know how can I be of any help.

Thanks

Are you actually getting the same error (assuming you are getting an error in OpenFOAM), or does it simply eventually diverge?

What I need is an OpenFOAM-only setup that reproduces the problem.

So, the OpenFoam, OF, only( uncoupled) does not produce an error. The error arises when we couple OF with Elmer. I have created the uncoupled one. below is the residual plot for that.

image

By OpenFOAM-only, I meant an OpenFOAM-OpenFOAM coupled case (a very simple dummy example).

But what exactly do you mean by it fails?

by “it fails” I mean it fails divergence. Below is the output log from OF. I have also attached the residual plot here. This is the coupled version results. i.e. OF ↔ Elmer
image

/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2312                                  |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _e651d635-20240208 OPENFOAM=2312 patch=240220 version=2312
Arch   : "LSB;label=32;scalar=64"
Exec   : buoyantSimpleFoam
Date   : Jul 31 2024
Time   : 11:27:04
Host   : Espoo
PID    : 8606
I/O    : uncollated
Case   : /home/asepahvand/repo/elmer-adapter/Flow_Over_Heated_Plate_SS/Fluid-openfoam-turbulent
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


SIMPLE: convergence criteria
    field p_rgh	 tolerance 0.001
    field U	 tolerance 0.0001
    field h	 tolerance 0.0001
    field "(k|epsilon|omega)"	 tolerance 0.005

Reading thermophysical properties

Selecting thermodynamics package
{
    type            heRhoThermo;
    mixture         pureMixture;
    transport       const;
    thermo          hConst;
    equationOfState perfectGas;
    specie          specie;
    energy          sensibleEnthalpy;
}

Reading field U

Reading/calculating face flux field phi

Creating turbulence model

Selecting turbulence model type RAS
Selecting RAS turbulence model kEpsilon
bounding k, min: 0 max: 0 average: 0
RAS
{
    RASModel        kEpsilon;
    turbulence      on;
    printCoeffs     on;
    Cmu             0.09;
    C1              1.44;
    C2              1.92;
    C3              0;
    sigmak          1;
    sigmaEps        1.3;
}


Reading g

Reading hRef
Calculating field g.h

Reading field p_rgh

No MRF models present

Radiation model not active: radiationProperties not found
Selecting radiationModel none
No finite volume options present

Starting time loop

Authorization required, but no authorization protocol specified
Authorization required, but no authorization protocol specified
Authorization required, but no authorization protocol specified
---[preciceAdapter] Loaded the OpenFOAM-preCICE adapter - v1.3.1.
---[preciceAdapter] Reading preciceDict...
---[precice]  This is preCICE version 3.1.2
---[precice]  Revision info: no-info [git failed to run]
---[precice]  Build type: Release (without debug log)
---[precice]  Configuring preCICE with configuration "../precice-config.xml"
---[precice]  I am participant "Fluid"
---[precice]  Setting up primary communication to coupling partner/s
---[precice]  Primary ranks are connected
---[precice]  Setting up preliminary secondary communication to coupling partner/s
---[precice]  Prepare partition for mesh Fluid-Mesh
---[precice]  Gather mesh Fluid-Mesh
---[precice]  Send global mesh Fluid-Mesh
---[precice]  Receive global mesh Solid-Mesh
---[precice]  Setting up secondary communication to coupling partner/s
---[precice]  Secondary ranks are connected
---[precice]  Computing "nearest-neighbor" mapping from mesh "Solid-Mesh" to mesh "Fluid-Mesh" in "read" direction.
---[precice]  Mapping distance min:0.00461767 max:0.0589954 avg: 0.0354267 var: 0.000162694 cnt: 644
---[precice]  Mapping "Heat-Flux" for t=0 from "Solid-Mesh" to "Fluid-Mesh" (skipped zero sample)
---[precice]  Mapping "Heat-Flux" for t=1 from "Solid-Mesh" to "Fluid-Mesh"
---[precice]  iteration: 1, time-window: 1 of 1000, time: 0, time-window-size: 1, max-time-step-size: 1, ongoing: yes, time-window-complete: no, write-initial-data
---[preciceAdapter] preCICE was configured and initialized
---[preciceAdapter] Setting the solver's endTime to infinity to prevent early exits. Only preCICE will control the simulation's endTime. Any functionObject's end() method will be triggered by the adapter. You may disable this behavior in the adapter's configuration.
Time = 1

DILUPBiCGStab:  Solving for h, Initial residual = 1, Final residual = 0.002709157, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 0.9521238, Final residual = 0.004541214, No Iterations 4
time step continuity errors : sum local = 0.08735349, global = -0.02052023, cumulative = -0.02052023
rho min/max : 0.3136911 1.277954
DILUPBiCGStab:  Solving for epsilon, Initial residual = 1, Final residual = 2.24561e-16, No Iterations 1
DILUPBiCGStab:  Solving for k, Initial residual = 1, Final residual = 1.348963e-16, No Iterations 1
bounding k, min: 0 max: 7e-16 average: 7e-16
ExecutionTime = 0.59 s  ClockTime = 28 s

---[precice]  Time window completed
---[precice]  Mapping "Heat-Flux" for t=2 from "Solid-Mesh" to "Fluid-Mesh"
---[precice]  iteration: 1, time-window: 2 of 1000, time: 1, time-window-size: 1, max-time-step-size: 1, ongoing: yes, time-window-complete: yes,
Time = 2

DILUPBiCGStab:  Solving for h, Initial residual = 0.6156185, Final residual = 0.001612667, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 0.8773015, Final residual = 0.004147935, No Iterations 4
time step continuity errors : sum local = 0.04510688, global = -0.009084887, cumulative = -0.02960511
rho min/max : 0.006458056 1.474623
DILUPBiCGStab:  Solving for epsilon, Initial residual = 1, Final residual = 1.190204e-16, No Iterations 1
DILUPBiCGStab:  Solving for k, Initial residual = 1, Final residual = 1.337728e-16, No Iterations 1
bounding k, min: 0 max: 7.000002e-16 average: 7e-16
ExecutionTime = 0.7 s  ClockTime = 28 s

---[precice]  Time window completed
---[precice]  Mapping "Heat-Flux" for t=3 from "Solid-Mesh" to "Fluid-Mesh"
---[precice]  iteration: 1, time-window: 3 of 1000, time: 2, time-window-size: 1, max-time-step-size: 1, ongoing: yes, time-window-complete: yes,
Time = 3

DILUPBiCGStab:  Solving for h, Initial residual = 0.7870738, Final residual = 0.002909863, No Iterations 1
GAMG:  Solving for p_rgh, Initial residual = 0.6974444, Final residual = 0.003606763, No Iterations 4
time step continuity errors : sum local = 0.0152969, global = -0.00490986, cumulative = -0.03451497
rho min/max : -4.825616 16.66059
DILUPBiCGStab:  Solving for epsilon, Initial residual = 1, Final residual = 1.426847e-16, No Iterations 1
DILUPBiCGStab:  Solving for k, Initial residual = 1, Final residual = 1.359623e-16, No Iterations 1
bounding k, min: 0 max: 1.300001e-15 average: 7.002997e-16
ExecutionTime = 0.8 s  ClockTime = 29 s

---[precice]  Time window completed
---[precice]  Mapping "Heat-Flux" for t=4 from "Solid-Mesh" to "Fluid-Mesh"
---[precice]  iteration: 1, time-window: 4 of 1000, time: 3, time-window-size: 1, max-time-step-size: 1, ongoing: yes, time-window-complete: yes,
Time = 4

DILUPBiCGStab:  Solving for h, Initial residual = 0.8568435, Final residual = 0.002125651, No Iterations 1


--> FOAM FATAL ERROR: (openfoam-2312 patch=240220)
Negative initial temperature T0: -74.70512

    From Foam::scalar Foam::species::thermo<Thermo, Type>::T(Foam::scalar, Foam::scalar, Foam::scalar, Foam::scalar (Foam::species::thermo<Thermo, Type>::*)(Foam::scalar, Foam::scalar) const, Foam::scalar (Foam::species::thermo<Thermo, Type>::*)(Foam::scalar, Foam::scalar) const, Foam::scalar (Foam::species::thermo<Thermo, Type>::*)(Foam::scalar) const) const [with Thermo = Foam::hConstThermo<Foam::perfectGas<Foam::specie> >; Type = Foam::sensibleEnthalpy; Foam::scalar = double; Foam::species::thermo<Thermo, Type> = Foam::species::thermo<Foam::hConstThermo<Foam::perfectGas<Foam::specie> >, Foam::sensibleEnthalpy>]
    in file ./src/thermophysicalModels/specie/lnInclude/thermoI.H at line 57.

FOAM aborting

[stack trace]
=============
#1  Foam::error::simpleExit(int, bool) in /usr/lib/openfoam/openfoam2312/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so
#2  ? in /usr/lib/openfoam/openfoam2312/platforms/linux64GccDPInt32Opt/lib/libfluidThermophysicalModels.so
#3  ? in /usr/lib/openfoam/openfoam2312/platforms/linux64GccDPInt32Opt/lib/libfluidThermophysicalModels.so
#4  ? in /usr/lib/openfoam/openfoam2312/platforms/linux64GccDPInt32Opt/lib/libfluidThermophysicalModels.so
#5  ? in /usr/lib/openfoam/openfoam2312/platforms/linux64GccDPInt32Opt/bin/buoyantSimpleFoam
#6  ? in /lib/x86_64-linux-gnu/libc.so.6
#7  __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
#8  ? in /usr/lib/openfoam/openfoam2312/platforms/linux64GccDPInt32Opt/bin/buoyantSimpleFoam
=============
[Espoo:08606] *** Process received signal ***
[Espoo:08606] Signal: Aborted (6)
[Espoo:08606] Signal code:  (-6)
[Espoo:08606] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x78a8ef042520]
[Espoo:08606] [ 1] /lib/x86_64-linux-gnu/libc.so.6(pthread_kill+0x12c)[0x78a8ef0969fc]
[Espoo:08606] [ 2] /lib/x86_64-linux-gnu/libc.so.6(raise+0x16)[0x78a8ef042476]
[Espoo:08606] [ 3] /lib/x86_64-linux-gnu/libc.so.6(abort+0xd3)[0x78a8ef0287f3]
[Espoo:08606] [ 4] /usr/lib/openfoam/openfoam2312/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam5error10simpleExitEib+0x17d)[0x78a8efa5a64d]
[Espoo:08606] [ 5] /usr/lib/openfoam/openfoam2312/platforms/linux64GccDPInt32Opt/lib/libfluidThermophysicalModels.so(+0x50f3c7)[0x78a8f130f3c7]
[Espoo:08606] [ 6] /usr/lib/openfoam/openfoam2312/platforms/linux64GccDPInt32Opt/lib/libfluidThermophysicalModels.so(+0x29f578)[0x78a8f109f578]
[Espoo:08606] [ 7] /usr/lib/openfoam/openfoam2312/platforms/linux64GccDPInt32Opt/lib/libfluidThermophysicalModels.so(+0x38981b)[0x78a8f118981b]
[Espoo:08606] [ 8] buoyantSimpleFoam(+0x211c5)[0x63d980c851c5]
[Espoo:08606] [ 9] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x78a8ef029d90]
[Espoo:08606] [10] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x78a8ef029e40]
[Espoo:08606] [11] buoyantSimpleFoam(+0x28255)[0x63d980c8c255]
[Espoo:08606] *** End of error message ***
Aborted (core dumped)
Killing PID 8603

Alright, then this is a completely different problem than the one I originally mentioned, and it might be specific to this simulation setup.

Some observations about your setup:

  • You are using a steady-state solver (buoyantSimpleFoam)
  • Reading heat-flux, writing temperature
  • The error you end up with is Negative initial temperature T0: -74.70512

Note that the heat flux is read in the CHT/HeatFlux.C file:

The difference in your case compared to our tutorials is probably which kind of KappaEff is used (should be the compressible one):

You could try checking if these values make sense. You can also enable debug messages in the OpenFOAM adapter (see a comment in the beginning of the Allwmake script).

I cannot really help much more at this stage, but please experiment a bit and document your findings here. This might give some clues.

Okay, thank you for looking into this. Will update if I find anything.

1 Like

Hello Mike,

I made a transient case to be more conforming with the original one. But, it still fails on turbulent model. you can find the case in elmer-adapter/Flow_Over_Heated_Plate_3D at development · tapegoji/elmer-adapter · GitHub.

The solid participant is Solid-openfoam and the fluid participant is Fluid-openfoam-turbulent.

I am at the end of the rope here. the turbulent models that I have tried, transient or steadysteate fail when coupled using preCICE. I can’t think of anythink else. what is going on. they fail after the first few iterations.

Regards,

–Ali

Any progress on this?

Hello Ali,
I am simulating a flexible foil using OF and Calculix and every time I run a turbulent model ( K-omega SST or any other model) for a coupled case using Precice I face the same issue, taking into account that the uncoupled case works fine either laminar or turbulent. Did you find a way to solve this?
Karim

Hi Karim,

Unfortunately, I was not able to solve it yet. I got some answers but seemed not clear. I had the exact same issue. I have put it on pause and was hoping I get a chance to work on it later. Let me know if you find a solution. We need to look into the source code of the adapter I think.

Hi @tapegoji and @Karim_Ahmed,

any information on reproducing these issues based on one of the current tutorials would really help.

I do not have the capacity to debug this at the moment, but we can debug this together here or (ideally) on GitHub. Of course, if anyone understands where the issue lies, pull requests are welcome.

The most relevant file is the class that computes the forces:

which is called from Force.C.

Relevant is also the checkpointing of various fields, which happens in Adapter.C.