CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

value of alpha1[celli] is not correct

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 27, 2014, 13:32
Default value of alpha1[celli] is not correct
  #1
New Member
 
jaming
Join Date: Dec 2010
Location: Berlin
Posts: 9
Rep Power: 15
jaming is on a distinguished road
Hi Foamers,
I have a problem setting in the forAll() loop the right condition:
##########################
forAll(alpha1,celli)
{
if (alpha1[celli] > 1 )
{

Pout<<"alpha1= "<<alpha1[celli]<<endl;
}
}

##########################

I also get

alpha1= 1

in the results what I think is not logic.

So if someone has any idea I will be thankful
Yamine
jaming is offline   Reply With Quote

Old   May 27, 2014, 15:34
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,902
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hallo,

It is probably related to your write precision in your controlDict, e.g. if the write precision is 6, then 1.000000007 is written as 1.

You could test this by using the following code:

Code:
Pout << alpha1[celli] << tab << 1 - alpha1[celli] << endl;
Kind regards,

Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   May 27, 2014, 17:01
Default
  #3
New Member
 
jaming
Join Date: Dec 2010
Location: Berlin
Posts: 9
Rep Power: 15
jaming is on a distinguished road
Many thanks for you quick replay,
but look for example hier:

Code:
forAll(alpha1, celli)
    {
     if ( alpha1[celli] < scalar(1.))
       {
    
         Pout<< "Alpha1=  "<<alpha1[celli]<< endl;
       }
I get the flow:
PHP Code:
...........   ..................
Alpha1=  0.0144193383
Alpha1
=  0.9575155878
Alpha1
=  1
Alpha1
=  0.1574193345
Alpha1
=  5.502415325e-11
Alpha1
=  5.162033835e-11
Alpha1
=  8.173407791e-13
...........    ....................... 
The idea is to set some conditions with alpha1 but I found that alpha1[celli] didn't pass the wished value at all.
And like you can see unfortunately 1 is not filtered here

With kind regards,
Yamine
jaming is offline   Reply With Quote

Old   May 27, 2014, 17:13
Default
  #4
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,902
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
With your recent code, you turned around the inequality, and the value being 1, can actually be 0.9999999999, i.e. to me the code still does the rigth thing.

Kind regards,

Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   May 27, 2014, 17:36
Default
  #5
New Member
 
jaming
Join Date: Dec 2010
Location: Berlin
Posts: 9
Rep Power: 15
jaming is on a distinguished road
Hi ngj

Many Thanks for your unpayable help.

Regards
Yamine
jaming 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
Is my Dynamic mesh setup correct? cfd seeker FLUENT 16 October 30, 2020 07:16
Evaporation due to Heat Transport using InterFoam (Correct Implementation?) ovie OpenFOAM 14 August 3, 2019 08:00
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
Is there a way to find a correct "spacing"? Jordi P. Main CFD Forum 2 August 15, 2013 11:05
LES correct function luiz eduardo OpenFOAM Running, Solving & CFD 6 September 14, 2007 05:10


All times are GMT -4. The time now is 07:02.