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)

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 10:39.