precice / tutorials

Various tutorial cases for the coupling library preCICE with real solvers. These files are meant to be rendered on precice.org, so don't look at the README files here.
https://www.precice.org/
GNU Lesser General Public License v3.0
103 stars 105 forks source link

Required Problem Parameters for flow-over-heated-plate #226

Closed HishamSaeed closed 3 years ago

HishamSaeed commented 3 years ago

Hi i am trying to couple openFOAM with Elmer FEM solver, i am using the flow over heated plate problem as a test problem. For this tutorial, i cannot find the density of the fluid as well as the solid which are required by Elmer solver, otherwise the solver stops and does not continue. I cannot calculate the fluid density from Prandtl number because the density cancels out in equation $$Pr = \nu / \alpha $$ , $$Pr = (\mu / \rho) / (\cp * k / \rho) $$ . For more details about Prandtl number equation: https://en.wikipedia.org/wiki/Prandtl_number

Also in the solid i cannot calculate it because alpha(thermal diffusivity) is provided as well as k(Heat Conductivity) but the cp(Heat Capacity) is not provided which also is required by Elmer. Is there a way to access these data or calculate it.

Thanks in advance Hisham

davidscn commented 3 years ago

According to OpenFOAM, the fluid density has initially a uniform value of 1 kg/m^3 (and of course varies during the course of the simulation). AFAIU you are running the solid participant, right? Does a density value of 1 kg/m^3 work for you?

BenjaminRodenberg commented 3 years ago

According to OpenFOAM, the fluid density has initially a uniform value of 1 kg/m^3 (and of course varies during the course of the simulation).

Then this information should also go into our documentation. I will open a PR on this.

BenjaminRodenberg commented 3 years ago

Does a density value of 1 kg/m^3 work for you?

From my perspective the density should not be required for solving the heat equation in the solid, if you are only interested in heat flux and temperature. In this case thermal diffusivity and thermal conductivity should be sufficient. So our current specification for the solid is complete from this perspective.

However, as soon as you are interested in the actual energy you either need the specific heat capacity or the density. Additionally, we do not know what different solvers require. Even if the FEniCS-based heat solver works without density, other solvers may compute the energy (even if we don't need it) and therefore the density will be required.

My opinion here: If we also provide a density for the solid, we are on the safe side and can assume that with most solvers one will be able to set up the case.

What I would still like to know: What does Elmer require for heat conduction in a solid? What about OpenFOAM? Is there a default value? Is density not required at all? Any input would be appreciated.

BenjaminRodenberg commented 3 years ago

Also in the solid i cannot calculate it because alpha(thermal diffusivity) is provided as well as k(Heat Conductivity) but the cp(Heat Capacity) is not provided which also is required by Elmer. Is there a way to access these data or calculate it.

From this I understand that:

@HishamSaeed Is this correct or am I misunderstanding something?

HishamSaeed commented 3 years ago

Also in the solid i cannot calculate it because alpha(thermal diffusivity) is provided as well as k(Heat Conductivity) but the cp(Heat Capacity) is not provided which also is required by Elmer. Is there a way to access these data or calculate it.

From this I understand that:

  • Elmer is the solid. It requires the specific heat capacity (cp) and therefore the user has to know density or specific heat capacity of the solid. This is currently not given in our documentation.
  • OpenFOAM is the fluid. As described by David, OpenFOAM defaults to rho = 1 kg/m^3, but this is not documented for our tutorial case. So not clearly specified.

@HishamSaeed Is this correct or am I misunderstanding something?

In my case, yes Elmer is the solid for the flow over heated plate, and Elmer always requires the density and heat capacity for the heat equation, i am not sure why. check the heat equation model in Models manual http://www.nic.funet.fi/pub/sci/physics/elmer/doc/ElmerModelsManual.pdf.

Possibly because it operates on the governing equation of incompressible fluid.

HishamSaeed commented 3 years ago

According to OpenFOAM, the fluid density has initially a uniform value of 1 kg/m^3 (and of course varies during the course of the simulation). AFAIU you are running the solid participant, right? Does a density value of 1 kg/m^3 work for you?

Yes, i am running the solid participant as Elmer, the density values for both the solid and fluid are 1kg/m^3. But i still have problems in the calculated velocity when both solvers are coupled.

davidscn commented 3 years ago

But i still have problems in the calculated velocity when both solvers are coupled.

Could you explain this a bit more in detail?

MakisH commented 3 years ago

According to OpenFOAM, the fluid density has initially a uniform value of 1 kg/m^3 (and of course varies during the course of the simulation). AFAIU you are running the solid participant, right? Does a density value of 1 kg/m^3 work for you?

But this is not defined directly, right? If it was, it should be in the constant directory. I think in this model, density is derived from a state equation, based on the rest of the parameters.

A citation here would be helpful.

BenjaminRodenberg commented 3 years ago

According to OpenFOAM, the fluid density has initially a uniform value of 1 kg/m^3 (and of course varies during the course of the simulation). AFAIU you are running the solid participant, right? Does a density value of 1 kg/m^3 work for you?

But this is not defined directly, right? If it was, it should be in the constant directory.

What about this part?

https://github.com/precice/tutorials/blob/6d90ae3eb179113beb400e472c8832e29a48db9b/flow-over-heated-plate/fluid-openfoam/constant/thermophysicalProperties#L31-L35

Maybe the density is "hidden" here. But I'm just guessing here and did not find a reference linking molar weight and nMoles (what does this mean?) to density.

edit From the user guide:

specie containing i.e. number of moles, nMoles, of the specie, and molecular weight, molWeight in units of g/mol;

MakisH commented 3 years ago

Exactly, one can use the molecular information in a state equation and compute e.g. the density. OpenFOAM does have state equations, here we set the p*V=nMoles*R*T (perfect gas):

equationOfState perfectGas;

One can usually then compute the density as:

nMoles / V = p / (R T),   rho = mass / V = nMoles * molWeight / V 
BenjaminRodenberg commented 3 years ago

I did a quick experiment with molWeight 24.0999 (bottom) vs. molWeight 24000.0999 (top) to find out whether it is actually a "don't care" or not:

Screenshot from 2021-08-11 17-37-37

There is a clearly visible difference.

Some more notes: I played around with the parameters a bit more:

From this I currently conclude that 1) nMoles is actually not needed, I was able to remove this parameter and 2) molWeight is the important parameter we have to look at.

BenjaminRodenberg commented 3 years ago

I think I found the correct connection between the fluid density and the molar mass. I've written down everything in latex for nicer typesetting and will provide it here as a reference:

Screenshot from 2021-08-12 08-10-48

davidscn commented 3 years ago

Thanks, should be resolved from now on.

davidscn commented 3 years ago

For the future: a nice overview of all parameters is also given in Lucias thesis on page 53