CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

chtMultiRegionFOAM-boundary condition error

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By msarkar
  • 1 Post By r08n

Reply
 
LinkBack Thread Tools Display Modes
Old   June 28, 2010, 01:26
Default chtMultiRegionFOAM-boundary condition error
  #1
Member
 
MSarkar
Join Date: Dec 2009
Posts: 99
Rep Power: 7
msarkar is on a distinguished road
Hello FOAMERS,

I am trying to simulate a 2D electronic component cooling system. Where I have three different solids (2 ICs and 1 PCB) regions and rest are air, one inlet and one outlet. The ICs are generating constant heat. Could anyone help me to define heat generation in a solid region using chtMultiRegionFoam? Currently I am trying with constant temperature in ICs but I am getting error as follows:

--> FOAM FATAL ERROR:

gradientInternalCoeffs cannot be called for a calculatedFvPatchField
on patch bottomAir_to_rightAir of field h in file "/home2/msarkar/OpenFOAM/msarkar-1.6.x/run/project/project3/run1/0.001/bottomAir/h"
You are probably trying to solve for a field with a default boundary condition.

From function calculatedFvPatchField<Type>::gradientInternalCoef fs() const
in file /home2/galleon/freefoam_pu_build/include/finiteVolume/../../../freefoam/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C at line 187.

FOAM exiting

I did not understand this error as I did not define the field h anywhere. I guess it is defined somewhere inside the code but I am not sure where it is. Any help on this regard would be very much appreciated.

The computational domain is attached here. The domain has seven different regions - three solid and four air fields.

Thanks
M. Sarkar
Attached Images
File Type: jpg comp_domain.jpg (16.1 KB, 109 views)
unnikrsn likes this.
msarkar is offline   Reply With Quote

Old   June 28, 2010, 03:31
Default
  #2
Member
 
Robertas N.
Join Date: Mar 2009
Location: Kaunas, Lithuania
Posts: 52
Rep Power: 8
r08n is on a distinguished road
The field 'h' is defined in file 'fluid/setRegionFluidFields.H' as

basicPsiThermo& thermo = thermoFluid[i];
volScalarField& h = thermo.h();

and then it's used in 'fluid/hEqn.H'. What boundary conditions did you set?
If you have a constant heat generation, maybe you can define a heat source in solid
regions? For this purpose you could modify the equation in 'solid/solveSolid.H' to be
like this:

tmp<fvScalarMatrix> TEqn
( fvm::ddt(rho*cp, T) == fvm::laplacian(K, T) + Q );

and declare a heat source field Q. This field can be initialized before running the case
using 'setField' or assigned straight in the code.

I used this approach myself but I'm not sure how reliable it is.
r08n is offline   Reply With Quote

Old   June 28, 2010, 04:49
Default
  #3
Member
 
MSarkar
Join Date: Dec 2009
Posts: 99
Rep Power: 7
msarkar is on a distinguished road
Hi Robertas,


Thanks a ton for your reply. I think there is no option to define any boundary conditions for h. Then why it is giving the following error and how to resolve this? Do I need to modify the code anywhere for this?



--> FOAM FATAL ERROR:

gradientInternalCoeffs cannot be called for a calculatedFvPatchField
on patch bottomAir_to_rightAir of field h in file "/home2/msarkar/OpenFOAM/msarkar-1.6.x/run/project/project3/run1/0.001/bottomAir/h"
You are probably trying to solve for a field with a default boundary condition.

From function calculatedFvPatchField<Type>::gradientInternalCoef fs() const
in file /home2/galleon/freefoam_pu_build/include/finiteVolume/../../../freefoam/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C at line 187.

FOAM exiting




Quote:
Originally Posted by r08n View Post
What boundary conditions did you set?
If you have a constant heat generation, maybe you can define a heat source in solid
regions? For this purpose you could modify the equation in 'solid/solveSolid.H' to be
like this:

tmp<fvScalarMatrix> TEqn
( fvm::ddt(rho*cp, T) == fvm::laplacian(K, T) + Q );

and declare a heat source field Q. This field can be initialized before running the case
using 'setField' or assigned straight in the code.

I used this approach myself but I'm not sure how reliable it is.
Currently I am using the following boundary conditions at the interface of solid and air to run the simulation.
bottomAir_to_pcb
{
type solidWallMixedTemperatureCoupled;
neighbourFieldName T;
Kcond Kcond;
value uniform 300;
}
My intention is first run the case then change the source code if I need to do so to accommodate the heat generation part. If I understood your reply correctly, I have to modify the source code to accommodate the heat generation as specified and recompile the solver. There is no other way to define constant heat generation from solid parts, is that correct?
You mentioned that you used the above approach. I guess you also simulated similar type of case like me. Could you give me your case file? So I can see how you initialized the field Q.

Regards
M. Sarkar
msarkar is offline   Reply With Quote

Old   June 29, 2010, 06:26
Default
  #4
Member
 
Robertas N.
Join Date: Mar 2009
Location: Kaunas, Lithuania
Posts: 52
Rep Power: 8
r08n is on a distinguished road
The field 'h' is read from the thermophysical properties file; there is an equation for 'h' (fluid/hEqn.H), and the field 'h' is defined in fluid/setRegionFluidFields.H. Evidently, its boundary values are recalculated from other field values, therefore, it depends on how you set up BCs of other fields. I cannot tell anything about this specific error yet -- haven't dug so deep yet :-)

I attach a couple of cases that I have run myself. The 1st one contains two solid regions,
in contact with each other, hovering in the air. One of them has a heat source inside. You can set also a heat source inside another one -- edit the file heat2/Q; currently, the heat source is commented out there. Another case contains two solid regions with heat sources inside and an air flow inbetween. Both cases are 2D. Air is green, solids are blue and yellow, heat sources (inside solids) are red.
To run these cases, you'll have to recompile the chtMultiRegionFoam solver: here are the modified source files that should go into the 'solid' folder.

case1
case2
Attached Images
File Type: jpg 2heaters_0.0_sec_setup.jpg (43.1 KB, 59 views)
File Type: jpg wall_heaters_0.jpg (42.7 KB, 51 views)
Attached Files
File Type: h solveSolid.H (357 Bytes, 53 views)
File Type: h createSolidFields.H (2.8 KB, 46 views)
File Type: h setRegionSolidFields.H (398 Bytes, 41 views)
giosanta likes this.

Last edited by r08n; June 29, 2010 at 06:32. Reason: Added source files
r08n is offline   Reply With Quote

Old   June 30, 2010, 02:46
Default
  #5
Member
 
MSarkar
Join Date: Dec 2009
Posts: 99
Rep Power: 7
msarkar is on a distinguished road
Hi Robertas,

Thank you very much for sharing the source and case files. I will follow your instruction to accommodate heat generation inside solid and recompile the solver. I will also update you from my side and try to resolve the current error I am getting.

Once again thank you.

Regards
M. Sarkar
msarkar is offline   Reply With Quote

Old   June 30, 2010, 03:24
Default controlDict in chtMultiRegionFoam
  #6
Senior Member
 
maddalena's Avatar
 
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 12
maddalena is on a distinguished road
Hi Robertas,
I included heat source generation on chtMultiRegionFoam as well, the solver compiled fine and cases runs without error. I did it on my own, but changes are similar to the files you attached. the only things that is different is that I wrote solveSolid.H as:
Code:
        tmp<fvScalarMatrix> TEqn
        (
            fvm::ddt(rho*cp, T)
          - fvm::laplacian(K, T)
          - H
        );
        TEqn().relax();
        TEqn().solve();
However, when running the solver, the heat source effect is difficult to see: it requires a long simulating time to increase temperature of just a couple of Kelvin.
I guess the problem in my case is with controlDict parameters:
  • How to choose the max Courant number if the flow is steady?
  • How to choose the diffusivity number, included in OF 1.6.x? My guess: I should set maxDi = lower diffusivity of my regions * 0.1
  • How long the simulation should run to reach the steady state? My guess: at least 1.4 * the time required to all the region to reach the time constant of that region (63% of the steady state temperature)
Could you suggest a good setup for them?
Thanks

mad

PS: you set air/U as:
Code:
internalField   uniform (0 0 0);
but velocity is required to calculate the Courant Number. Indeed, when I tried to run the simulation, I get:
Code:
Region: air Courant Number mean: 0 max: 0
#0  Foam::error::printStack(Foam::Ostream&) in "/root/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/libOpenFOAM.so"
#1  Foam::sigFpe::sigFpeHandler(int) in "/root/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/libOpenFOAM.so"
#2  ?? in "/lib/libc.so.6"
#3  Foam::divide(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) in "/root/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/libOpenFOAM.so"
#4  void Foam::divide<Foam::fvsPatchField, Foam::surfaceMesh>(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) in "/root/OpenFOAM/root-1.6.x/applications/bin/linux64GccDPOpt/chtMultiRegionHeatSourceFoam"
#5  Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> > Foam::operator/<Foam::fvsPatchField, Foam::surfaceMesh>(Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> > const&, Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> > const&) in "/root/OpenFOAM/root-1.6.x/applications/bin/linux64GccDPOpt/chtMultiRegionHeatSourceFoam"
#6  Foam::solidRegionDiffNo(Foam::fvMesh const&, Foam::Time const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) in "/root/OpenFOAM/root-1.6.x/applications/bin/linux64GccDPOpt/chtMultiRegionHeatSourceFoam"
#7  main in "/root/OpenFOAM/root-1.6.x/applications/bin/linux64GccDPOpt/chtMultiRegionHeatSourceFoam"
#8  __libc_start_main in "/lib/libc.so.6"
#9  _start in "/root/OpenFOAM/root-1.6.x/applications/bin/linux64GccDPOpt/chtMultiRegionHeatSourceFoam"
Floating point exception
Thus my guess is to set U as something really small, but not zero. How did you solve it?
maddalena is offline   Reply With Quote

Old   July 2, 2010, 06:12
Default
  #7
Member
 
Robertas N.
Join Date: Mar 2009
Location: Kaunas, Lithuania
Posts: 52
Rep Power: 8
r08n is on a distinguished road
Hi, Maddalena,

Quote:
Originally Posted by maddalena View Post
However, when running the solver, the heat source effect is difficult to see: it requires a long simulating time to increase temperature of just a couple of Kelvin.
Did you try to compare the numerical results to analytical solution? You may try
to set up a case with only a solid region, so that there is no heat loss due to fluid
flow; or, it seems, if you set the thermal conductivity (K) to 0, heat will not be
transferred to fluid region.

Quote:
I guess the problem in my case is with controlDict parameters:
  • How to choose the max Courant number if the flow is steady?
  • How to choose the diffusivity number, included in OF 1.6.x? My guess: I should set maxDi = lower diffusivity of my regions * 0.1
  • How long the simulation should run to reach the steady state? My guess: at least 1.4 * the time required to all the region to reach the time constant of that region (63% of the steady state temperature)
Could you suggest a good setup for them?
Frankly, I didn't think too much about fine-tuning the parameters -- I just copied them from some tutorial, but I just wanted to test whether the heat transfer between different regions works at all. I'll try to select these parameters more carefully at later stages. I don't have much experience yet. And you didn't describe your case.

Quote:
PS: you set air/U as:
Code:
internalField   uniform (0 0 0);
but velocity is required to calculate the Courant Number. Indeed, when I tried to run the simulation, I get:
Thus my guess is to set U as something really small, but not zero. How did you solve it?
In my case, Courant number (Co) was initially =0 too. Do you think you have an error because Co=0? It would be very strange if such a trivial case as a completely immobile fluid would be numerically intractable
r08n is offline   Reply With Quote

Old   July 2, 2010, 07:41
Default
  #8
Senior Member
 
maddalena's Avatar
 
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 12
maddalena is on a distinguished road
Hi Robertas,
Quote:
Did you try to compare the numerical results to analytical solution? You may try to set up a case with only a solid region, so that there is no heat loss due to fluid flow; or, it seems, if you set the thermal conductivity (K) to 0, heat will not be transferred to fluid region.
In the end I decided to copy the chtMultiRegionFoam tutorial(multiRegionHeater) , set all the temperatures to 300K and add a volume heat generation. That worked, so I guess my problem is connected with the geometry discretization or with parameters tuning.
Quote:
Frankly, I didn't think too much about fine-tuning the parameters -- I just copied them from some tutorial, but I just wanted to test whether the heat transfer between different regions works at all. I'll try to select these parameters more carefully at later stages. I don't have much experience yet. And you didn't describe your case.
I have a general idea on how to set parameters now, but I need a more complex case (with more than one material) to test if my guesses are ok. Still, have doubts on how to generate a good mesh. What I have found up to now is summarized here: Meshing Guidelines There is no agreement on cht problem meshing... So no news from this point of view...
Quote:
In my case, Courant number (Co) was initially =0 too. Do you think you have an error because Co=0? It would be very strange if such a trivial case as a completely immobile fluid would be numerically intractable
Well, this was at least what happened to me. on the multiRegionHeater tutorial I removed every velocity component, and the floatingPointError apperared. If Co = 0 the solver cannot calculate the first time step, and the solution neither. However, I see that you set U = 0 everywhere in your case... Was that simulation ok for you? It was not for me...
Cheers,

mad
maddalena is offline   Reply With Quote

Old   August 3, 2010, 11:28
Default
  #9
Senior Member
 
maddalena's Avatar
 
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 12
maddalena is on a distinguished road
Quote:
Originally Posted by r08n View Post
I attach a couple of cases that I have run myself. The 1st one contains two solid regions, in contact with each other, hovering in the air. One of them has a heat source inside. You can set also a heat source inside another one -- edit the file heat2/Q; currently, the heat source is commented out there. Another case contains two solid regions with heat sources inside and an air flow inbetween. Both cases are 2D. Air is green, solids are blue and yellow, heat sources (inside solids) are red.
Hi Robertas,
sorry if I come back on the same point again, but I am getting hard time to have the chtMultiRegionFoam + heat source working. In particular, I have difficulties on obtaining a time vs temperature variation with the well known exponential behavior. In my simple case, I have a linear variation of it!
Do you have ever experienced anything like that? If so, can you tell me what the problem was? You can find a more detailed explanation of my case on http://www.cfd-online.com/Forums/ope...egionfoam.html.
Thank you of any suggestion you could give to me.

regards,

mad
maddalena is offline   Reply With Quote

Old   April 2, 2012, 11:51
Default
  #10
Senior Member
 
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 149
Rep Power: 6
mm.abdollahzadeh is on a distinguished road
today i tried to test a case with chtMultiregionFoam.
my case includes natural convection in an enclosure with a block at the bottom. the bottom surface of block was heated.
the strange thing is that the temperature is not passing throgh solid zone to fluid zone. I am using turbulentTemperatureCoupledBaffleMixed as the boundary condition on the interface of soid and liquid zone.
I thinck there should be sth related to boundary condition. I will be too much thankful to recive you oponions .
mm.abdollahzadeh is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Native ParaView Reader Bugs tj22 OpenFOAM Paraview & paraFoam 267 July 20, 2015 22:29
vorticity boundary condition bearcharge Main CFD Forum 0 May 14, 2010 11:32
OF 1.6 | Ubuntu 9.10 (64bit) | GLIBCXX_3.4.11 not found piprus OpenFOAM Installation 22 February 25, 2010 14:43
Installation of Netgen in SuSE Linux 92 edvardsenpriv Open Source Meshers: Gmsh, Netgen, CGNS, ... 23 January 16, 2009 07:12
Problems of Duns Codes! Martin J Main CFD Forum 8 August 14, 2003 23:19


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