Aurel65460 |
March 2, 2021 04:14 |
GroovyBC gradientExpression issues
Dear all,
I am a beginner in OpenFoam simulation and i want to model heat transfer problem with laplacianFoam solver.
The geometry is pretty easy : a 3D rectangle of an uniform material with radiation and convection on every faces.
On the top face, the convection coefficient is considered as a gaussian function of space varying along the simulation. To do that i want to use the GroovyBC function.
My T file is :
Code:
dimensions [0 0 0 1 0 0 0];
internalField uniform 300;
boundaryField
{
inlet
{
type groovyBC;
variables "k=16;sigma=5.67e-8;E=0.7;Tinf=300;Tfluid=700;A=6600;sig=0.07;hamb=3300;x0=0.165;y0=0.2;x=pos().x;y=pos().y;h=hamb+A*exp(-(pow((x-x0),2)/(2*pow(sig,2))+pow((y-y0),2)/(2*pow(sig,2))));";
gradientExpression "(h/k)*(Tfluid-T)+(sigma/k)*E*(pow(Tinf,4)-pow(T,4))";
fractionExpression "0";
}
outlet
{
type groovyBC;
variables "h=20;k=16;sigma=5.67e-8;E=0.7;Tinf=300;";
gradientExpression "h/k*(Tinf-T)+(sigma/k)*E*(pow(Tinf,4)-pow(T,4))";
fractionExpression "0";
}
upperWallAndLowerWall
{
type groovyBC;
variables "h=20;k=16;sigma=5.67e-8;E=0.7;Tinf=300;";
gradientExpression "h/k*(Tinf-T)+(sigma/k)*E*(pow(Tinf,4)-pow(T,4))";
fractionExpression "0";
}
frontAndBack
{
type groovyBC;
variables "h=20;k=16;sigma=5.67e-8;E=0.7;Tinf=300;";
gradientExpression "h/k*(Tinf-T)+(sigma/k)*E*(pow(Tinf,4)-pow(T,4))";
fractionExpression "0";
}
}
When i run the simulation, at a time step (depending of the values), i have the following error :
Code:
Time = 1
DICPCG: Solving for T, Initial residual = 1, Final residual = 8.46407e-07, No Iterations 29
#0 Foam::error::printStack(Foam::Ostream&) at ??:?
#1 Foam::sigFpe::sigHandler(int) at ??:?
#2 ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3 ? in "/lib/x86_64-linux-gnu/libm.so.6"
#4 powf64 in "/lib/x86_64-linux-gnu/libm.so.6"
#5 Foam::pow(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) at ??:?
#6 Foam::pow(Foam::UList<double> const&, Foam::UList<double> const&) at ??:?
#7 parserPatch::PatchValueExpressionParser::parse() at ??:?
#8 Foam::PatchValueExpressionDriver::parseInternal(int) at ??:?
#9 Foam::CommonValueExpressionDriver::parse(Foam::exprString const&, Foam::word const&) at ??:?
#10 Foam::tmp<Foam::Field<double> > Foam::CommonValueExpressionDriver::evaluate<double>(Foam::exprString const&, bool) at ??:?
#11 Foam::groovyBCFvPatchField<double>::updateCoeffs() at ??:?
#12 Foam::fvMatrix<double>::fvMatrix(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::dimensionSet const&) in "/opt/openfoam7/platforms/linux64GccDPInt32Opt/bin/laplacianFoam"
#13 ? in "/opt/openfoam7/platforms/linux64GccDPInt32Opt/bin/laplacianFoam"
#14 ? in "/opt/openfoam7/platforms/linux64GccDPInt32Opt/bin/laplacianFoam"
#15 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#16 ? in "/opt/openfoam7/platforms/linux64GccDPInt32Opt/bin/laplacianFoam"
Exception en point flottant (core dumped)
I know this error can occur when there is a division by 0 or wrong utilisation of mathematical function but i don t which one can be.
In a previous version, the inlet condition was given by an external table using " gradient nonuniform $fluxProfile; " and it worked well. I conclued the error is coming from inlet condition. In addition, if i remplace h by a constant in the variables definition (for exemple ...;h=2000;";), simulation is running and results look fine.
Overall i suppose the error come from how i wrote the gaussian function but i don t understand why.
If anyone have an idea or can help me, I would be very grateful.
Aurélien
|