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

Extending OpenFOAM ::: error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 2, 2010, 08:18
Default Extending OpenFOAM ::: error
  #1
Senior Member
 
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17
balkrishna is on a distinguished road
I am writing a solver for simulating mixing of 3 liquids of mass fractions alpha0 , alpha1 and alpha2 .... I have extended the twoLiquidMixing Foam solver to include 3 components mentioned above . The source is compiled ok but on running for a test case .... i get the following error .
Please can anyone suggest how to overcome this :

Reading field alpha0 word::stripInvalid() called for word alpha0 For debug level (= 2) > 1 this is considered fatal
balkrishna is offline   Reply With Quote

Old   August 3, 2010, 05:19
Default
  #2
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
If you post the part of the code where you construct the alpha objects, and the alpha0 file and location, you may get some more help.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   August 3, 2010, 05:25
Default
  #3
Senior Member
 
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17
balkrishna is on a distinguished road
Thanks for the reply .... I corrected my error .... The problem was with a space between alpha and 0 characters ....
balkrishna is offline   Reply With Quote

Old   August 3, 2010, 05:27
Default
  #4
Senior Member
 
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17
balkrishna is on a distinguished road
however I am facing another problem now .... :
I have tried to extend openfoam's two liquid mixing solver to n liquids where n is a number from the user .... However after a few iterations < 10 I get the following warning
-> FOAM Warning :
From function Time:perator++()
in file db/Time/Time.C at line 681
Increased the timePrecision from 7 to 8 to distinguish between timeNames at time 0.000250075
Time = 0.00025007459

and then the courant number suddenly shoots up to >10^8 ... how should I correct it ....
balkrishna is offline   Reply With Quote

Old   August 3, 2010, 05:32
Default
  #5
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
First things to check:

1) Does this case you're running for 'n' components work with 2 components (i.e. have you compared your new code with the old code when n=2)?

2) Have you tried lowering the time step.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   August 3, 2010, 05:36
Default
  #6
Senior Member
 
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17
balkrishna is on a distinguished road
Thanks for the reply .... I have tried lowering the time step ... but all this does is prolongs the blow up of the solution .

I am running this code for n=2 to confirm with the twoLiquidMixingFoam Solver ... although the code compiles without errors I get the above error ...
balkrishna is offline   Reply With Quote

Old   August 3, 2010, 05:48
Default
  #7
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
Code compiling doesn't mean it will run correctly! To be honest it could be anything. Just glancing at the solver it strikes me that you may have to come up with a sensible way of solving for turbulence when n>2 (maybe you don't). But the physics is another matter...

It looks like the changes you would have had to make are:

1) PtrList of alphas.
2) Creation of an nPhaseMixture Class or equivalent.
3) Change the calculation of rho/rhoPhi in a few places.
4) Solve n-1 alphaEqns.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   August 3, 2010, 05:56
Default
  #8
Senior Member
 
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17
balkrishna is on a distinguished road
I will review the physics for nComponents .
Regarding :
1) PtrList of alphas. => I have created suitable pointers in createFields.H

2)Creation of an nPhaseMixture Class or equivalent. => I have added this too .

3)Solve n-1 alpha Eqns => Is it ok to solve n alpha Eqns as long as they have been used carefully. Because for n components the nth is to be calculated by 1-sum(all other comp) .I dont have issues about speed as of now ....

4) Change the calculation of rho/rhoPhi in a few places. => Please can you elaborate on this . rhoPhi is calculated in alphaEqn and used in UEqn . The way the (twoLiquidMixing) solver calculates rhoPhi is

rhoPhi = alpha1Eqn.flux()*(rho1-rho2) + phi*rho2

The way I have done it is :
rhoPhi = rho1*alpha1Eqn.flux() + rho2*alpha2Eqn.flux()

Thanks again for ur help ....
balkrishna is offline   Reply With Quote

Old   August 3, 2010, 06:43
Default
  #9
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
It's difficult to say what could be going wrong. You may have boundedness issues with rhoPhi.

You've made quite a few changes at the same time. When I'm writing new stuff I try to do it incrementally and test it after every change. I usually start with the infrastructure, so in your case sorting out the storage of alphas and the capability to solve more alpha equations. Then I would try changing the calculations of rhoPhi line by line -> often there are subtle numerical reasons for the way they are formulated.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   August 3, 2010, 06:54
Default
  #10
Senior Member
 
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17
balkrishna is on a distinguished road
Thanks for the advice n help ....
balkrishna is offline   Reply With Quote

Old   August 3, 2010, 08:21
Default
  #11
Senior Member
 
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17
balkrishna is on a distinguished road
The precise error i get is :
Courant Number mean: 2.69878e+06 max: 6.18058e+08
#0 Foam::error:rintStack(Foam::Ostream&) in "/home/ifmg/OpenFOAM/OpenFOAM-1.7.0/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::sigFpe::sigFpeHandler(int) in "/home/ifmg/OpenFOAM/OpenFOAM-1.7.0/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 Uninterpreted:
#3 Foam::Time::adjustDeltaT() in "/home/ifmg/OpenFOAM/OpenFOAM-1.7.0/lib/linuxGccDPOpt/libOpenFOAM.so"
#4 Foam::Time::setDeltaT(double) in "/home/ifmg/OpenFOAM/OpenFOAM-1.7.0/lib/linuxGccDPOpt/libOpenFOAM.so"
#5

#6 __libc_start_main in "/lib/tls/i686/cmov/libc.so.6"
#7

Floating point exception
balkrishna is offline   Reply With Quote

Old   August 9, 2010, 03:06
Default
  #12
Senior Member
 
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17
balkrishna is on a distinguished road
i modified twoLiquidMixingFoam source for n Components as a start I am testing it for 2 components . I get a very weird floating point exception error at the start of the iterations . On tracing the error with Info statements I found out that the program gives a fpe while calculating the kinematic viscosity in the calcNu function . specifically at the following point :
Code:
void nComponentMixture::calcNu()                                                                                                              
{                                                                                                                                             
    nuModel1_->correct();                                                                                                                     
    nuModel2_->correct();                                                                                                                     
                                                                                                                                              
    volScalarField limitedAlpha1                                                                                                              
    (                                                                                                                                         
        "limitedAlpha1",                                                                                                                      
        min(max(alpha1_, scalar(0)), scalar(1))                                                                                               
    );                                                                                                                                        
                                                                                                                                              
    volScalarField limitedAlpha2                                                                                                              
    (                                                                                                                                         
        "limitedAlpha2",                                                                                                                      
        min(max(alpha2_, scalar(0)), scalar(1))                                                                                               
    );                                                                                                                                        
    Info<<alpha1_<<endl<<alpha2_<<endl<<rho1_<<endl<<rho2_<<endl;                                                                             
// Average kinematic viscosity calculated from dynamic viscosity                                                                              
    nu_ = mu()/(limitedAlpha1*rho1_ +limitedAlpha2*rho2_ );                                                                                           
}
Where could the possible error be ?
balkrishna is offline   Reply With Quote

Old   August 9, 2010, 03:07
Default
  #13
Senior Member
 
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17
balkrishna is on a distinguished road
If i however comment the nu_ calculation statement the program runs till convergence ....
balkrishna is offline   Reply With Quote

Old   August 9, 2010, 04:27
Default
  #14
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
Sounds like both your alphas are becoming zero at the same time? Have you checked their values?
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   August 9, 2010, 04:36
Default
  #15
Senior Member
 
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17
balkrishna is on a distinguished road
Yes . This is infact before any iteration is performed . I have checked values of the alpha's , rho's and mu() to be very sure and none of them are zero ...
balkrishna is offline   Reply With Quote

Old   August 9, 2010, 04:51
Default
  #16
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
That's the only reason I can think of. Can you post your output up here?
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   August 9, 2010, 04:52
Default
  #17
Senior Member
 
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17
balkrishna is on a distinguished road
Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  1.7.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 1.7.0-21131bcbd876
Exec   : ../balFoam
Date   : Aug 09 2010
Time   : 13:52:07
Host   : ifmg-desktop
PID    : 7157
Case   : /home/ifmg/mySol/balFoam/twoLiquid
nProcs : 1
SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading field p

Reading field U

Reading field massFrac1
Reading field massFrac2
Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting incompressible transport model Newtonian
#0  Foam::error::printStack(Foam::Ostream&) in "/home/ifmg/OpenFOAM/OpenFOAM-1.7.0/lib/linuxGccDPOpt/libOpenFOAM.so"
#1  Foam::sigFpe::sigFpeHandler(int) in "/home/ifmg/OpenFOAM/OpenFOAM-1.7.0/lib/linuxGccDPOpt/libOpenFOAM.so"
#2  Uninterpreted: 
#3  Foam::divide(Foam::Field<double>&, double const&, Foam::UList<double> const&) in "/home/ifmg/OpenFOAM/OpenFOAM-1.7.0/lib/linuxGccDPOpt/libOpenFOAM.so"
#4  Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::operator/<Foam::fvPatchField, Foam::volMesh>(Foam::dimensioned<double> const&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&)
#5  

#6  

#7  

#8  __libc_start_main in "/lib/tls/i686/cmov/libc.so.6"
#9  

Floating point exception
balkrishna is offline   Reply With Quote

Old   August 9, 2010, 05:17
Default
  #18
Senior Member
 
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17
balkrishna is on a distinguished road
@l_r_mcglashan Sir , Would you mind if i did send you my solver entirely as a tar.gz file ?
balkrishna is offline   Reply With Quote

Old   August 9, 2010, 06:19
Default
  #19
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
If you wish, I can take a quick look.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   January 20, 2014, 04:14
Default
  #20
Senior Member
 
Albrecht vBoetticher
Join Date: Aug 2010
Location: Zürich, Swizerland
Posts: 237
Rep Power: 16
vonboett is on a distinguished road
...although it is probably an old issue now, I want to add something in case somebody faces the same problem and reads through this thread: A typical error is that the phases add up to a higher value than 1 in a cell. Something you don't see because the single phase shares can be between 0 and 1, but the sum can exceed 1 and that is for incompressible flow fatal. Check that the initial field and the boundary values do not lead to alpha1+alpha2+alpha3 >1
vonboett 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
nonNewtonian viscosity model mhassani OpenFOAM Programming & Development 5 January 7, 2013 09:27
[swak4Foam] groovyBC: problems compiling: "flex: not found" and "undefined reference to ..." sega OpenFOAM Community Contributions 12 February 17, 2010 09:30
POSDAT problem piotka STAR-CD 4 June 12, 2009 08:43
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 20:50
user defined function cfduser CFX 0 April 29, 2006 10:58


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