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] Fixed value using the gradient expression in Groovy BC (https://www.cfd-online.com/Forums/openfoam-community-contributions/129471-fixed-value-using-gradient-expression-groovy-bc.html)

Thamali February 6, 2014 00:52

Fixed value using the gradient expression in Groovy BC
 
Dear swak4Foamers,
I am using a new thread for this,since I have put a question earlier in a wrong place.:mad:

I am using a Boundary condition to find out "Tempreature" of a patch.The value is a fixed value.
The gradient expression is used for calculation of temperature.
Earlier I had some problems in making expressions,but now they semms to be ok...
My groovyBC expression is as follows
[boundaryField{
interFace
{

type groovyBC;
#include "commonVariables"
gradientExpression "yGRAD" ;

fractionExpression "1";
value uniform 400;

}][/CODE]
commonVariables

[variables "sig=5.67e-8;emiss=0.9;Tenv=773;Yvolat=(YCOs+YCO2s+YH2s+YCH4s +YCxHyOzs);epsilon=0.5+0.5*((0.7207-Yvolat)+(0.1457-Ychar)+(0.0426-Yash));yGRAD=sig*emiss*(pow(Tenv,4)-pow(ts,4))/((1-epsilon)*mag(effectiveThermalConductivityS)*mag(Sf ()));";][/CODE]

Now,my solver is a steady state one and it stops at a certain point in Time=2,when try to calculate the following(according to me);

[volScalarField cp =((D*log(ts/AA)-E)+cpSstd)/2;][/CODE](only place which used "log")


The error is as follows

[Time = 2

#0 Foam::error::printStack(Foam::Ostream&) at ??:?
#1 Foam::sigFpe::sigHandler(int) at ??:?
#2 in "/lib/x86_64-linux-gnu/libc.so.6"
#3 log in "/lib/x86_64-linux-gnu/libm.so.6"
#4 Foam::log(Foam::Field<double>&, Foam::UList<double> const&) at ??:?
#5

at ??:?
#6
at ??:?
#7 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#8
at ??:?
Floating point exception (core dumped)
]

My problem is in "log(ts/AA)" is not (-)ve or zero,so,what my problem can be....???

Please help.
Thanks.
Thamali

gschaider February 6, 2014 05:27

Quote:

Originally Posted by Thamali (Post 473671)
Dear swak4Foamers,
I am using a new thread for this,since I have put a question earlier in a wrong place.:mad:

Very good. Now if you learn the correct use of the CODE-tag the reports would be even better ;)
(Use the "Preview Post"-button if you're unsure)

Quote:

Originally Posted by Thamali (Post 473671)
I am using a Boundary condition to find out "Tempreature" of a patch.The value is a fixed value.
The gradient expression is used for calculation of temperature.
Earlier I had some problems in making expressions,but now they semms to be ok...
My groovyBC expression is as follows
[boundaryField{
interFace
{

type groovyBC;
#include "commonVariables"
gradientExpression "yGRAD" ;

fractionExpression "1";
value uniform 400;

}][/CODE]
commonVariables

[variables "sig=5.67e-8;emiss=0.9;Tenv=773;Yvolat=(YCOs+YCO2s+YH2s+YCH4s +YCxHyOzs);epsilon=0.5+0.5*((0.7207-Yvolat)+(0.1457-Ychar)+(0.0426-Yash));yGRAD=sig*emiss*(pow(Tenv,4)-pow(ts,4))/((1-epsilon)*mag(effectiveThermalConductivityS)*mag(Sf ()));";][/CODE]

Now,my solver is a steady state one and it stops at a certain point in Time=2,when try to calculate the following(according to me);

[volScalarField cp =((D*log(ts/AA)-E)+cpSstd)/2;][/CODE](only place which used "log")


The error is as follows

[Time = 2

#0 Foam::error::printStack(Foam::Ostream&) at ??:?
#1 Foam::sigFpe::sigHandler(int) at ??:?
#2 in "/lib/x86_64-linux-gnu/libc.so.6"
#3 log in "/lib/x86_64-linux-gnu/libm.so.6"
#4 Foam::log(Foam::Field<double>&, Foam::UList<double> const&) at ??:?
#5

at ??:?
#6
at ??:?
#7 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#8
at ??:?
Floating point exception (core dumped)
]

My problem is in "log(ts/AA)" is not (-)ve or zero,so,what my problem can be....???

Please help.
Thanks.
Thamali

As I can see neither the definition of ts nor AA I can't share your optimism. And of course the problem could be that ts/AA is positive but very small. Either try replacing the expression in log with a constant value (just for testing) or try something like "log(max(1e-5,ts/AA))" to be sure that the logarithm doesn't slip below a certain threshold

Thamali February 6, 2014 06:53

1 Attachment(s)
Quote:

Originally Posted by gschaider (Post 473705)
Very good. Now if you learn the correct use of the CODE-tag the reports would be even better ;)
(Use the "Preview Post"-button if you're unsure)

Learning slowly(not that smart).I used preview,but seem did not do much to me.:)

ts -is a "volScalarField ",temperature in Kelvin
AA- dimensionedScalar 1K(Kelvin)


I am attaching how my "ts" field at time=1, for your reference.According to that,line 10138,
" value uniform 0;"

Is this the problem??
Do you have any idea why it became "0" as I have put 400 already.(I changed Tenv =973,earlier it was 773)

[interFace
{

type groovyBC;
#include "commonVariables"
gradientExpression "yGRAD" ;
value uniform 400;
fractionExpression "1";


}][/CODE]

[variables "sig=5.67e-8;emiss=0.9;Tenv=973;Yvolat=(YCOs+YCO2s+YH2s+YCH4s +YCxHyOzs);epsilon=0.5+0.5*((0.7207-Yvolat)+(0.1457-Ychar)+(0.0426-Yash));yGRAD=sig*emiss*(pow(Tenv,4)-pow(ts,4))/((1-epsilon)*mag(effectiveThermalConductivityS)*mag(Sf ()));";][/CODE]

Eager for a reply.
Thanks.
Thamali

gschaider February 13, 2014 18:26

Quote:

Originally Posted by Thamali (Post 473722)
Learning slowly(not that smart).I used preview,but seem did not do much to me.:)

ts -is a "volScalarField ",temperature in Kelvin
AA- dimensionedScalar 1K(Kelvin)


I am attaching how my "ts" field at time=1, for your reference.According to that,line 10138,
" value uniform 0;"

Is this the problem??
Do you have any idea why it became "0" as I have put 400 already.(I changed Tenv =973,earlier it was 773)

[interFace
{

type groovyBC;
#include "commonVariables"
gradientExpression "yGRAD" ;
value uniform 400;
fractionExpression "1";


}][/CODE]

[variables "sig=5.67e-8;emiss=0.9;Tenv=973;Yvolat=(YCOs+YCO2s+YH2s+YCH4s +YCxHyOzs);epsilon=0.5+0.5*((0.7207-Yvolat)+(0.1457-Ychar)+(0.0426-Yash));yGRAD=sig*emiss*(pow(Tenv,4)-pow(ts,4))/((1-epsilon)*mag(effectiveThermalConductivityS)*mag(Sf ()));";][/CODE]

Eager for a reply.
Thanks.
Thamali

Hi Thamali!

I have a real hard time understanding your problem and the formatting doesn't help. If your post looks strange (the way this one does) use the "Edit"-button and try to correct the problem. And reread the post and ask yourself "would someone else understand what my problem is by reading this?"

Concerning your question "uniform 0" is a problem if you calculate the log from it. WHY it became 0: I don't know. .... one moment. The "interface"-section you give IS the ts? Then it is clear. Your fraction is 1. Which means "this is a Dirichlet"-condition. There is no valueExpression. Thus 0 is used as the value.

Thamali February 28, 2014 04:37

Hi,
Thousand apologies for replying this much late.
I was involving in some other works,and although I saw the reply I was thinking of take time and make a clear one this time.

I managed to solve the problem by referring some threads like,
http://www.cfd-online.com/Forums/ope...-gradient.html

I changed my BC as follows,
So,I added
Code:

refValue uniform 400;
And also I changed the fraction expression to "1".(earlier i tried using 0 & 1 both,anything did not work)
Code:

interFace
    {
         
          type            groovyBC;
    #include "commonVariables"   
        gradientExpression    "yGRAD" ;
    value              uniform 400;
    //valueExpression    400;
    refValue uniform 400;       
        fractionExpression    "0";
       
   
    }

Now my results seems ok.
Thank you very much for your concern.

Quote:

I have a real hard time understanding your problem and the formatting doesn't help. If your post looks strange (the way this one does) use the "Edit"-button and try to correct the problem. And reread the post and ask yourself "would someone else understand what my problem is by reading this?"
I think this time it is clear right??:)
Anyway please correct me if I am wrong somewhere.

Appreciate your assistance highly.

Thamali


All times are GMT -4. The time now is 12:58.