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

[swak4Foam] Fixed value using the gradient expression in Groovy BC

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Thamali

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 6, 2014, 00:52
Default Fixed value using the gradient expression in Groovy BC
  #1
Member
 
Thamali
Join Date: Jul 2013
Posts: 67
Rep Power: 12
Thamali is on a distinguished road
Dear swak4Foamers,
I am using a new thread for this,since I have put a question earlier in a wrong place.

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:rintStack(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

Last edited by Thamali; February 6, 2014 at 00:58. Reason: highlight error
Thamali is offline   Reply With Quote

Old   February 6, 2014, 05:27
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Thamali View Post
Dear swak4Foamers,
I am using a new thread for this,since I have put a question earlier in a wrong place.
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 View Post
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:rintStack(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
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   February 6, 2014, 06:53
Default
  #3
Member
 
Thamali
Join Date: Jul 2013
Posts: 67
Rep Power: 12
Thamali is on a distinguished road
Quote:
Originally Posted by gschaider View Post
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
Attached Files
File Type: txt ts.txt (71.0 KB, 15 views)
Thamali is offline   Reply With Quote

Old   February 13, 2014, 18:26
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Thamali View Post
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.
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   February 28, 2014, 04:37
Default
  #5
Member
 
Thamali
Join Date: Jul 2013
Posts: 67
Rep Power: 12
Thamali is on a distinguished road
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
gschaider likes this.
Thamali is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convergence problem with tetrahedral grids Tarak OpenFOAM Running, Solving & CFD 22 June 25, 2018 19:09
How to manage the pressure term in fixed mass flow rate based channel flow simulation sjwon1991 Main CFD Forum 5 July 10, 2017 07:21
CEL expression in CFX pre Jane92 Main CFD Forum 1 June 3, 2016 02:48
How to get Pressure Gradient and Density Gradient as Output Variables? badboyz31 CFX 2 June 26, 2015 03:09
Temperature gradient for the internal Field. Philipp Dietrich OpenFOAM Programming & Development 0 July 2, 2014 03:15


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