CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swak4Foam] groovyBC elevated inlet. pos() issue (https://www.cfd-online.com/Forums/openfoam-community-contributions/89779-groovybc-elevated-inlet-pos-issue.html)

grjmell June 22, 2011 06:37

groovyBC elevated inlet. pos() issue
 
1 Attachment(s)
I've got an issue with groovyBC. It makes my run crash instantly. I'm using twoPhaseEulerFoam and I have an elevated inlet (see pic), the inlet is above a wall. I want to put a logarithmic velocity profile onto that inlet. I've implemented it in groovy heres the code.

Code:

    myinlet
    {
        type            groovyBC;
        variables      "u_f=0.0239;z0=0.0000333;K=0.41;vel=(u_f/K)*log((pos().z)/z0)*normal();";
        valueExpression "-vel";
    }


This works, if the inlet goes from the bottom to the top, however it seems that when it is elevated then there is an issue with pos().z, it makes my run crash instantly with this error. When i take pos().z out, it works again, so it is not a problem with groovyBC as such. I know i need to account for pos().z not starting at zero for my profile but it should nevertheless work?


Code:

Starting time loop

Courant Number mean: 0 max: 0
Max Ur Courant Number = 0
deltaT = 0.000598802
Reading/calculating field UaMean

Reading/calculating field UbMean

Reading/calculating field alphaMean

Reading/calculating field pMean

fieldAverage: starting averaging at time 0

Time = 0.000598802

DILUPBiCG:  Solving for alpha, Initial residual = 1.48592e-17, Final residual = 1.48592e-17, No Iterations 0
Dispersed phase volume fraction = 0.135285  Min(alpha) = 0  Max(alpha) = 0.6
DILUPBiCG:  Solving for alpha, Initial residual = 1.48592e-17, Final residual = 1.48592e-17, No Iterations 0
Dispersed phase volume fraction = 0.135285  Min(alpha) = 0  Max(alpha) = 0.6
#0  Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam171/lib/linux64GccDPOpt/libOpenFOAM.so"
#1  Foam::sigFpe::sigFpeHandler(int) in "/opt/openfoam171/lib/linux64GccDPOpt/libOpenFOAM.so"
#2  in "/lib/libc.so.6"
#3  in "/lib/libm.so.6"
#4  log in "/lib/libm.so.6"
#5  Foam::log(Foam::Field<double>&, Foam::UList<double> const&) in "/opt/openfoam171/lib/linux64GccDPOpt/libOpenFOAM.so"
#6  Foam::log(Foam::UList<double> const&) in "/opt/openfoam171/lib/linux64GccDPOpt/libOpenFOAM.so"
#7  parserPatch::PatchValueExpressionParser::parse() in "/home/gjm1v07/OpenFOAM/gjm1v07-1.7.1/lib/linux64GccDPOpt/libswak4FoamParsers.so"
#8  Foam::PatchValueExpressionDriver::parse(std::string const&) in "/home/gjm1v07/OpenFOAM/gjm1v07-1.7.1/lib/linux64GccDPOpt/libswak4FoamParsers.so"
#9  Foam::CommonValueExpressionDriver::evaluateVariable(Foam::word const&, Foam::string const&) in "/home/gjm1v07/OpenFOAM/gjm1v07-1.7.1/lib/linux64GccDPOpt/libswak4FoamParsers.so"
#10  Foam::CommonValueExpressionDriver::addVariables(Foam::string const&, bool) in "/home/gjm1v07/OpenFOAM/gjm1v07-1.7.1/lib/linux64GccDPOpt/libswak4FoamParsers.so"
#11  Foam::CommonValueExpressionDriver::addVariables(Foam::List<Foam::string> const&, bool) in "/home/gjm1v07/OpenFOAM/gjm1v07-1.7.1/lib/linux64GccDPOpt/libswak4FoamParsers.so"
#12  Foam::groovyBCFvPatchField<Foam::Vector<double> >::updateCoeffs() in "/home/gjm1v07/OpenFOAM/gjm1v07-1.7.1/lib/linux64GccDPOpt/libgroovyBC.so"
#13  Foam::fvMatrix<Foam::Vector<double> >::fvMatrix(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&, Foam::dimensionSet const&) in "/opt/openfoam171/applications/bin/linux64GccDPOpt/twoPhaseEulerFoam"
#14 
 in "/opt/openfoam171/applications/bin/linux64GccDPOpt/twoPhaseEulerFoam"
#15  __libc_start_main in "/lib/libc.so.6"
#16 
 in "/opt/openfoam171/applications/bin/linux64GccDPOpt/twoPhaseEulerFoam"
Floating point exception


gschaider June 22, 2011 23:11

Quote:

Originally Posted by grjmell (Post 313050)
I've got an issue with groovyBC. It makes my run crash instantly. I'm using twoPhaseEulerFoam and I have an elevated inlet (see pic), the inlet is above a wall. I want to put a logarithmic velocity profile onto that inlet. I've implemented it in groovy heres the code.

Code:

    myinlet
    {
        type            groovyBC;
        variables      "u_f=0.0239;z0=0.0000333;K=0.41;vel=(u_f/K)*log((pos().z)/z0)*normal();";
        valueExpression "-vel";
    }


This works, if the inlet goes from the bottom to the top, however it seems that when it is elevated then there is an issue with pos().z, it makes my run crash instantly with this error. When i take pos().z out, it works again, so it is not a problem with groovyBC as such. I know i need to account for pos().z not starting at zero for my profile but it should nevertheless work?

If pos().z<=0 anywhere, then it will fail (unless you unset FOAM_SIGFPE - then you will get NaN in these places - also not a good solution)

grjmell June 23, 2011 03:53

Thanks Bernhard. I get it.

immortality January 23, 2013 06:56

dear bernhard
How can i unset FOAM_SIGFPE to find where NANs are occuring?
Thanks.

immortality January 23, 2013 07:02

another question occured! At my case that is similar to what Greg said i have set pos().y=0 at starting.i don't figure out it.does it have any problem?why?

gschaider January 23, 2013 08:11

Quote:

Originally Posted by immortality (Post 403530)
dear bernhard
How can i unset FOAM_SIGFPE to find where NANs are occuring?
Thanks.

The answer is in your question:

unset FOAM_SIGFPE

But that only makes the solver run and calculate garbage. Doubt that this will help you much

gschaider January 23, 2013 08:14

Quote:

Originally Posted by immortality (Post 403533)
another question occured! At my case that is similar to what Greg said i have set pos().y=0 at starting.i don't figure out it.does it have any problem?why?

PLEASE be more specific. One can only GUESS what you mean. Of course pos().y==0 can be a problem. For instance if you calculate the logarithm of it


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