CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   chtMultiRegionFOAM-boundary condition error (https://www.cfd-online.com/Forums/openfoam/77576-chtmultiregionfoam-boundary-condition-error.html)

msarkar June 28, 2010 01:26

chtMultiRegionFOAM-boundary condition error
 
1 Attachment(s)
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

r08n June 28, 2010 03:31

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.

msarkar June 28, 2010 04:49

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 (Post 264765)
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

r08n June 29, 2010 06:26

5 Attachment(s)
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

msarkar June 30, 2010 02:46

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

maddalena June 30, 2010 03:24

controlDict in chtMultiRegionFoam
 
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?

r08n July 2, 2010 06:12

Hi, Maddalena,

Quote:

Originally Posted by maddalena (Post 265084)
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 :eek:

maddalena July 2, 2010 07:41

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: http://www.cfd-online.com/Forums/flu...uidelines.html 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 :eek:
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 August 3, 2010 11:28

Quote:

Originally Posted by r08n (Post 264927)
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! :eek:
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

mm.abdollahzadeh April 2, 2012 11:51

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 :).


All times are GMT -4. The time now is 03:00.