CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Heat transfer with solid elements conduction (https://www.cfd-online.com/Forums/openfoam-solving/58173-heat-transfer-solid-elements-conduction.html)

hsieh March 14, 2005 15:23

HI, Can OpenFOAM handles th
 
HI,

Can OpenFOAM handles this type of problem:

Solid elements and fluid elements. Heat Conduction within solid elements and natural/force convection within fluid elements.

Thanks!

Pei

henry March 15, 2005 07:10

We have done some work in this
 
We have done some work in this area particularly for catalytic-converters. We could produce some nice wrapping to make this easier to do and the coupling between the regions can be done in several ways some of which we have done and other we have the scaffolding for. One of the biggest remaining problems is the mesh generation and conversion process because we would need fluid and solid meshes which match at the interface.

We would be happy to work in this field if we can find sponsors.

hsieh March 15, 2005 08:37

Hi, Henry, We do quite a fe
 
Hi, Henry,

We do quite a few thermal analysis of a refrigerate chamber with heat sink on the outside to take away heat. In this case, we need to model solid elements for conduction and fluid elements for natural convection.

I think it will good for OpenFOAM to have this capability. We do not have any money left in the budget this year, but, I will try my best to find some money for this development next year. Thanks!

Pei

helmut March 16, 2005 16:03

Hi Henry, We're also intere
 
Hi Henry,

We're also interested in this kind of problem, but from what I read I get the impression I can't have material boundaries in the mesh. Do I have to have separate meshes for the solid and fluid regions? Could you elaborate on the several ways you have tried coupling the regions?

Regards,
Helmut

henry March 16, 2005 16:22

What do you mean by having mat
 
What do you mean by having material boundaries in the mesh? How do you envisage distinguishing the fluid and solid region and formulating the equations for them if you have a single mesh?

hsieh March 16, 2005 17:04

Hi, My experience with anot
 
Hi,

My experience with another software is the following:

Solid mesh and fluid mesh are generated separately. After that, a layer of zero thickness elements need to be generated between solid elements and fluid elements (these elements serve as coupling between solid elements and fluid elements).

It is not necessary for the solid elements and fluid elements at the common face to match.

pei

helmut March 16, 2005 17:21

What I mean by material bounda
 
What I mean by material boundaries is having different material properties in different volume regions of the mesh, and two adjoining regions would have an interface defined by a face patch. Boundary conditions on the face patches would be used for solving fluid flow within the fluid regions. Heat transfer would be calculated over the whole mesh, albeit with a jump discontinuity in conductivity at the material interfaces.

henry March 16, 2005 17:49

What you are proposing here ca
 
What you are proposing here can be done in the current version of OpenFOAM by introducing a phase-fraction into the fluid equations which is 1 in the fluid zone and zero in the solid zone and adjusting physical properties appropriately. You will also need a face-zone for the solid interface to apply the correct drag onto the fluid. All this is possible and has been done but is not very elegant or efficient.

An alternative is to have two meshes one for the solid and one for the fluid and transfer the boundary conditions explicitly between the two. This is also possible and has been done in OpenFOAM and is even easier in in the 1.1 release now that multiple meshes can be handled by the same time class. However the explicit BC update can produce slow convergence.

Another two-mesh approach would be to have one mesh for the fluid and one mesh for the thermal equation, i.e. a mesh of everything, and transfer fields between the two. This gives implicit coupling between the regions for the thermal equation but sufferes from a modest storage overhead and the need for quite a bit of mapping code but is also possible in OpenFOAM but has not yet been tried.

The fourth approach is to have two meshes as for the second approach but to introduce implicit coupling by combining the thermal equation matrices of the two regions which could be done in several ways. This is my prefered approach for the future but we haven't written all the scaffolding for it yet.

almanstoetter March 17, 2005 04:47

Henry, you said (in section
 
Henry,

you said (in section two of your answer), using two meshes one for the solid and one for the fluid and transfer the boundary conditions explicitly between the two has already been done and is also easier with 1.1 version of OpenFOAM. Where do I find this exisiting implementation for OpenFOAM ?

henry March 17, 2005 04:54

Sorry my mistake, I mean it ha
 
Sorry my mistake, I mean it has been done in FOAM a very long time ago but that work has not been upgraded to OpenFOAM. With the new mutli-mesh handling in OpenFOAM it can be done better so I wouldn't coose to upgrade what I did before.

almanstoetter March 17, 2005 04:57

Henry, you said (in section
 
Henry,

you said (in section two of your answer), using two meshes one for the solid and one for the fluid and transfer the boundary conditions explicitly between the two has already been done and is also easier with 1.1 version of OpenFOAM. Where do I find this exisiting implementation for OpenFOAM ?

henry March 17, 2005 05:05

Sorry my mistake, I mean it ha
 
Sorry my mistake, I mean it has been done in FOAM a very long time ago but that work has not been upgraded to OpenFOAM. With the new mutli-mesh handling in OpenFOAM it can be done better so I wouldn't coose to upgrade what I did before.

sergei June 24, 2005 05:39

Hi Henry, I am new to FOAM, a
 
Hi Henry,
I am new to FOAM, and only starting to look at the code. First impression (after a few simulations) - it is a great tool, even compared to STAR (joking).
I am not quite sure about the FOAM data structure yet, but is it not convenient to have also cell tables? In this way, (solid) cells may have a certain additional information (inherently build-in scalar, like you suggest) and one can use certain equations (solvers) on a given cell table. Patches between cell types is also very convenient. In this way the multi-physics coupling will be much easy.
I have also a question related to the volumetric sources (may be not completely for this topic, so). Is there a relatively simple way of defining a source term on a given volume? (For instance, if I would like to fix velocity to a constant value, let say, to zero making cells "solid").

Well I have some more questions, but will look for an appropriate topic.

Thank in advance
Sergei

mattijs June 24, 2005 12:38

As said above we would prefer
 
As said above we would prefer to do this with multiple meshes (or rather regions) with implicit coupling.

single mesh with cell regions:
+ can have addressing across cell regions

multiple meshes with implicit coupling:
+ regions are automatically topologically separate
+ adheres to the OpenFoam way of having 'normal' internal faces and patch faces requiring special handling
+ allows different fields and properties in different regions
- requires special ordering across coupling patch

On the meshing side there should be no difference. We can already split a mesh into pieces (subsetMesh, splitMesh) and add together meshes (mergeMeshes, stitchMesh)

liu June 24, 2005 14:50

This reminds me Flow3D (which
 
This reminds me Flow3D (which is excellent in modeling free surface^_^). Which I also like very much is the way it deal with meshes. It uses a so called "FAVOR" method which essentially blockes the solid object and boundary on a struectured grid. I believe there is some indicator variable like gamma we have in the interFoam solver to indicate fluid region and blockage. The fluid boundary is like the free surface. The only problem is how to reconstruct this "surface" every time step.

I am wondering if this can be uesed in FOAM.

Just a thought.

sergei June 27, 2005 09:38

Mattijs, Thank you for your a
 
Mattijs,
Thank you for your answer. Probably, you are right, because I don't have much experience writing solvers for CFD. I have been looking at this from the point of view of a user. Cell tables are very handy to have when pre- and post-processing (you can add easily sources, define properties of materials, etc.)

But here, Liu is right, if you indeed are planning to introduce in the future chimera-like meshes, the approach of FOAM is then will be superior.

Mattijs, do you have a "higher" layer, which would allow to introduce source terms (for scalar, momentum, etc.) into equations, like user sub-routines in fortran (I am a fortran programmer)?
Or the user has to modify standard solvers to include these.
I am looking for something, like user functions in Fluent.

hsieh June 27, 2005 09:47

Hi, Sergei, I was a Fluent
 
Hi, Sergei,

I was a Fluent user for many years and thought that the UDF was great. But, that is because you do not have the source code of Fluent.

With OpenFOAM, you can easily modify the source code, recompile and you have the solver you want.

pei

sergei June 27, 2005 12:59

Pei, Thanks for the answer. S
 
Pei,
Thanks for the answer. So, there is no such an "upper layer". I understand now a bit better how FOAM works.

My example with Fluent was probably not very nice one (I have only marginal experience with it). However, in codes using Fortran (90), user coding with dynamic linking is quite convenient.

Sergei

panara July 1, 2005 10:54

I would like to simulate a con
 
I would like to simulate a conjugate heat transfer problem using the option formulated by Henry Weller in this discussion that I report below:

'An alternative is to have two meshes one for the solid and one for the fluid and transfer the boundary conditions explicitly between the two. This is also possible and has been done in OpenFOAM and is even easier in in the 1.1 release now that multiple meshes can be handled by the same time class'

can I have some hints on how to do that?
At the moment I am quite lost in the time, polymesh, and IO classes =(

regards,

Daniele

mattijs July 1, 2005 11:32

Read in your two meshes. Ge
 
Read in your two meshes.

Get the correct fvPatch and the corresponging field on it on both sides. Find out the correspondence between the faces on both sides (using the face centres) and use this to transfer your boundary field. Use these transferred values as fixedValue boundary values.

// Select face centres of patch (see fvMesh.H)
mesh.Cf().boundaryField()[patchI];

// Select patch field (see GeometricField.H)
p.boundaryField()[patchI];

// Assign to fixedValue boundary condition
p.boundaryField()[patchI] == ...

shu July 1, 2005 12:58

Hi Henrry, I am trying the
 
Hi Henrry,

I am trying the first method that you mentioned on March 16, 2005, because in this way I don't need to transfer the boundary condition in every timestep. It works well with two different thermal conductivities for the thermal equation. In order to set the (no-slip) boundary condition on the interface for the fluid, I defined the interface as a boundary additionally. But this additional boundary is ignored during the computation. Is it not correct to take the interface as boundary? How can I do it correctly?

BTW, What do you mean with "... a face-zone for the solid interface to apply the correct drag onto the fluid"? How can I set up this "face-zone"?

Thanks in advance!

Bitan

panara July 1, 2005 13:40

Thanks Mattijs, but how to re
 
Thanks Mattijs,
but how to read two meshes? I am a bit confused how to push the program to read the mesh from a different location than the default directory..

can you give me also an hint on how to handle the input output of the mesh?

I guess that I should modify the createMesh.H in order to have two mesh objects... but I am not sure how =(

Thanks in advance

Daniele

mattijs July 1, 2005 14:09

1. create two different Time i
 
1. create two different Time instances, say runTime1 and runTime2. Then separately load meshes:

fvMesh mesh1
(
IOobject
(
fvMesh::defaultRegion,
runTime1.timeName(),
runTime1,
IOobject::MUST_READ
)
);

and similar for mesh2.


2. or nicer: have one runTime with two mesh regions. Change the fvMesh::defaultRegion into "region1" and "region2" and put your meshes in
constant/region1/polyMesh and constant/region2/polyMesh

I have never tried this so good luck ;-)

mattijs July 1, 2005 15:20

I had a go at option 2. It is
 
I had a go at option 2. It is just two simpleFoams running in the same time loop. It is just an example of how to create two regions, the regions are not coupled!

http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif simpleFoam-twoMeshes.tgz

panara July 1, 2005 15:43

Thanks very much!! that helps
 
Thanks very much!!
that helps me a lot in understanding the code!!
=)

many thanks =)
Daniele

panara July 5, 2005 11:35

Dear all, I would like to i
 
Dear all,

I would like to implement an explicit coupling for conjugate heat transfer in open Foam.

I would like to solve the conductive equation in a region 1 and the NS equation in region2 and exchange the temperature BC in order to have

T1=T2 and
k1*grad(T1)=k2*grad(T2)

is that a good way for the couppling?

Can anybody suggest me an efficient way to do it in open Foam and/or bibliography on the subject?

Thanks in advance,

Daniele

panara July 6, 2005 08:48

Dear all, How is it possible
 
Dear all,
How is it possible to access and modify the value of a fixedGradient boundary condition?

I am asking because I would like to compute the gradient of the temperature in a region and use it as a boundary condition for the other region using a fixedGradient BC.

Is it possible?

Daniele

almanstoetter July 6, 2005 09:33

Daniele, I think you can se
 
Daniele,

I think you can set the fixedGradient BC the following way:

if(TMesh1.boundaryField()[patchIMesh1].type() == "fixedGradient"){
fixedGradientFvPatchScalarField& bufferMesh1=
refCast<fixedgradientfvpatchscalarfield>(TMesh1.bo undaryField()[patchIMesh1]);
scalarField& gradMesh1 = bufferMesh1.gradient();
scalarField& patchlambdaFieldMesh1 = lambdaFieldMesh1.boundaryField()[patchIMesh1];
forAll (bufferMesh1, faceI)
{
gradMesh1[faceI] = ...
}
}


To couple two regions with different temperatures, a possibility would be to set the gradient from one side as a BC on the other side, calculate the temperature distribution and set the average between the new temperature for this boundary and the boundary on the other (old) side as a new boundary condition on the other side. Run the whole as an iterative process until the temperature difference between both sides is below a certain small value.
When you have finished your implementation could you please post it in here ? I think there are also other people interested in it.

Juergen

panara July 6, 2005 10:28

Thanks very much for your sugg
 
Thanks very much for your suggestion, and if I manage to finish this implementation I will post it for sure!!

The problem is that I am a new C++ programmer..

I tryed your suggestion and I got the following error message:
conjugateFoam.C:91: error: `fixedGradientFvPatchScalarField' undeclared (first use this function)
conjugateFoam.C:91: error: (Each undeclared identifier is reported only once for each function it appears in.)
conjugateFoam.C:91: error: `buffer' undeclared (first use this function)
conjugateFoam.C:91: error: `fixedGradientFvPatchScalarfield' undeclared (first use this function)
conjugateFoam.C:91: error: template argument 1 is invalid
conjugateFoam.C:91: error: no matching function for call to `refCast(Foam::fvPatchField<foam::scalar>&)

I know it is a stupid error due to some include things...
but when I tryed to include fixedGradientFvPatchField.H I got other terrible error messages...

Can anybody help me?

Daniele

almanstoetter July 6, 2005 11:34

What other error messages ? Is
 
What other error messages ? Is the file fixedGradientFvPatchField.H found by the compiler ?

Juergen

panara July 6, 2005 13:16

I am solving two laplacian foa
 
I am solving two laplacian foam in two different regions and I am trying to couple them.

I have modified the laplacian foam in order to handle two grid regions mesh1 and mesh2 and I am solving for T1 and T2.

(This is the file)

http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif conjugateFoam.C

the program works fine without the following lines:

# include "fixedGradientFvPatchField.H"
...
fixedGradientFvPatchScalarField& bufferMesh1=
refCast<fixedgradientfvpatchscalarfield>(T2.bounda ryField()[bottomReg2]);

whit the lines above instead I get the following error messages:

SOURCE_DIR=.
SOURCE=conjugateFoam.C ; g++ -m32 -Dlinux -Wall -W -Wno-unused-parameter -O3 -ffast-math -DNoRepository -ftemplate-depth-30 -I/opt/OpenFOAM/OpenFOAM-1.1/src/OpenFOAM/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-1.1/src/cfdTools/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxOpt/conjugateFoam.o
In file included from conjugateFoam.C:48:
/opt/OpenFOAM/OpenFOAM-1.1/src/OpenFOAM/lnInclude/fixedGradientFvPatchField.H: In function `int main(int, char**)':
/opt/OpenFOAM/OpenFOAM-1.1/src/OpenFOAM/lnInclude/fixedGradientFvPatchField.H:43: error: unknown namespace `<declaration>'
/opt/OpenFOAM/OpenFOAM-1.1/src/OpenFOAM/lnInclude/fixedGradientFvPatchField.H:42: error: expected primary-expression before "namespace"
/opt/OpenFOAM/OpenFOAM-1.1/src/OpenFOAM/lnInclude/fixedGradientFvPatchField.H:42: error: expected `;' before "namespace"
In file included from /opt/OpenFOAM/OpenFOAM-1.1/src/OpenFOAM/lnInclude/fixedGradientFvPatchField.H:197,
from conjugateFoam.C:48:
/opt/OpenFOAM/OpenFOAM-1.1/src/OpenFOAM/lnInclude/fixedGradientFvPatchField.C:35: error: unknown namespace `<declaration>'
/opt/OpenFOAM/OpenFOAM-1.1/src/OpenFOAM/lnInclude/fixedGradientFvPatchField.C:34: error: expected primary-expression before "namespace"
/opt/OpenFOAM/OpenFOAM-1.1/src/OpenFOAM/lnInclude/fixedGradientFvPatchField.C:34: error: expected `;' before "namespace"
conjugateFoam.C:91: error: `fixedGradientFvPatchScalarField' undeclared (first use this function)
conjugateFoam.C:91: error: (Each undeclared identifier is reported only once for each function it appears in.)
conjugateFoam.C:91: error: `bufferMesh1' undeclared (first use this function)
conjugateFoam.C:92: error: `fixedgradientfvpatchscalarfield' undeclared (first use this function)
conjugateFoam.C:92: error: template argument 1 is invalid
conjugateFoam.C:92: error: no matching function for call to `refCast(Foam::fvPatchField<foam::scalar>&)'
make: *** [Make/linuxOpt/conjugateFoam.o] Error 1


I know it is a stupid mistake but anybody can help?

Thanks Daniele

almanstoetter July 7, 2005 04:54

Danielle, there are two err
 
Danielle,

there are two errors in your file:

1. Put the # include "fixedGradientFvPatchField.H" before the main() just right after the #include "fvCFD.H" to avoid the namespace errors.

2. There is a typo in your declaration of bufferMesh1. In the refCast<...> you use fixedgradientfvpatchscalarfield, but it should be fixedGradientFvPatchScalarField

Juergen

panara July 7, 2005 05:09

Thanks for your help, I apreci
 
Thanks for your help, I apreciate...

I tryed also correcting the errors you said but this is the output..

SOURCE_DIR=.
SOURCE=conjugateFoam.C ; g++ -m32 -Dlinux -Wall -W -Wno-unused-parameter -O3 -ffast-math -DNoRepository -ftemplate-depth-30 -I/opt/OpenFOAM/OpenFOAM-1.1/src/OpenFOAM/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-1.1/src/cfdTools/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxOpt/conjugateFoam.o
conjugateFoam.C: In function `int main(int, char**)':
conjugateFoam.C:92: error: `fixedGradientFvPatchScalarField' undeclared (first use this function)
conjugateFoam.C:92: error: (Each undeclared identifier is reported only once for each function it appears in.)
conjugateFoam.C:92: error: `buffer' undeclared (first use this function)
conjugateFoam.C:93: error: template argument 1 is invalid
conjugateFoam.C:93: error: no matching function for call to `refCast(Foam::fvPatchField<foam::scalar>&)'
make: *** [Make/linuxOpt/conjugateFoam.o] Error 1

May be I have to modify somehow the files in the Make directory?

at the moment I have in files the following:

conjugateFoam.C

EXE = $(FOAM_USER_APPBIN)/conjugateFoam

and in options:
EXE_INC = \
-I$(LIB_SRC)/cfdTools/lnInclude


EXE_LIBS = \
-lcfdTools


are them correct?

Thanks again, Daniele

almanstoetter July 7, 2005 05:36

Danielle, I have added some
 
Danielle,

I have added some of the missing *.H files nedded by your conjugateFoam.C and compiled it without errors. Here is the tgz-ball:

http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif conjugateFoam.tgz

Juergen

panara July 7, 2005 06:31

You are right!! now it works!!
 
You are right!! now it works!! =)

I was including fixedGradienFvPatchField.H and not fixedGradientFvPatchFields.H !!!

Thanks again!! =)
Daniele

panara July 7, 2005 14:26

In the following I am attachin
 
In the following I am attaching the solver and the case I am working on.
The solver is not at all tested!!

The case I am working on is a 2D case consisting of two simple coupled long bar with
different conductivity as sketched below:
<blockquote><blockquote><blockquote><blockquote><b lockquote>fix T2
</blockquote></blockquote></blockquote></blockquote></blockquote>
<blockquote><blockquote>__________________________ _
</blockquote></blockquote>
no heat flux | region2 ( fixed conductivity DT2 ) | no heat flux
<blockquote><blockquote>-----------------------------------------
</blockquote></blockquote>
fix T for reg1 (from reg2), fix gradT for reg2 (from reg1)
<blockquote><blockquote>__________________________ _
</blockquote></blockquote>
no heat flux | region1 ( fixed conductivity DT1 ) | no heat flux
<blockquote><blockquote>-----------------------------------------
</blockquote></blockquote>
<blockquote><blockquote><blockquote><blockquote><b lockquote>fix T1
</blockquote></blockquote></blockquote></blockquote></blockquote>

I run two laplacian foam for two different meshes (region1 and region2) and at the end of the time step I pass the Temperature at the boundary from region2 to region1 and the temperature gradient (scaled by the ratio of the conductivity DT1/DT2) from region1 to region2.

Or at list that is what I have tryed to do...
Any comment and/or suggestion is wellcome,

this is the solver:
http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif conjugateFoam.tgz
this is the case:
http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif conjugate2bars.tgz

Daniele

olivier July 14, 2005 11:16

Hi Daniele how can I generat
 
Hi Daniele
how can I generate the mesh in your case
blockMesh dont work !
thank you for your help

panara July 14, 2005 11:38

you can create the two mesh se
 
you can create the two mesh separately copying the polymesh directory from region1/ (region2/) to its parent directory.

Then you can run block mesh and you can move back the polymesh directory in the region1/ (region2/) subdirectory.

Another way could be to modify blockmesh to read and write in the non default directory.. I did it but in a very hugly way that works for one region per time... when I will find the time to make it in a better way I will upload the new blockmesh program..

Daniele

li July 18, 2005 23:06

Hi Daniele Can you tell me h
 
Hi Daniele
Can you tell me how to post process?
thank u

georg July 27, 2005 16:06

Hello everybody, i have a p
 
Hello everybody,

i have a problem with laplacianFoam and hope somebody can help me.

I am trying to simulate heat transfer in a solid.
As boundary conditions there are three surfaces with fixed temperature. For the diffusivity of the used V2A - Steel i found 3.93e-6 [m^2/s].

In my simulation i find values of -1e2 to 1e34 for T!!! Where can be my mistake?

With kind regards!


All times are GMT -4. The time now is 04:44.