|
[Sponsors] |
do_while loop for coupling two equations (convergence criteria?) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 26, 2011, 12:32 |
do_while loop for coupling two equations (convergence criteria?)
|
#1 |
New Member
Muhammad reza hassani
Join Date: Apr 2010
Posts: 29
Rep Power: 16 |
hi
I have a question regarding coupling two scalar transport equations. the equations are coupled through their source term. from the programmer's guide, source term can explicitly be added to the equation: solve(fvm::laplacian(phi) == f), f being a vol<type>Field. I want to solve them sequentially and constructing a loop to reach to converge iteratively. in order to see the convergence, I have one problem, how I can save the previous iteration result and subtract them to see if it meets the convergence tolerance. do{ solve(equation of C1, with a source term of C2) solve (equation of C2, with a source term of C1) error1=C1(n-1)-C1; //n-1 represent previous iteration results error2=C2(n-1)-C2;//n-1 represent previous iteration results }while(error1<0.001 && error2<0.001) //0.001 is the convergence tolerance if you can help me, it means a lot. thanks in forward. p.s. I have declare the errors as volScalarField and I don't know is it ok, and I have faced errors using declaration of this errors and using relational operators (>=). any suggestion? |
|
February 28, 2011, 08:56 |
|
#2 |
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24 |
Muhammad, error1 and error2 will be fields and comparing them with scalar is inappropriate, I think. May be you can take the average of error1 and errors absolute values in order to have only on scalar, then compare it with your error criterion.
volScalarField C1nminus1=C1; solve(equation of C1, with a source term of C2) error1=Foam::average(Foam::mag(C1nminus1-C1)); //n-1 represent previous iteration results Or something like this. Regards
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D. Research Scientist Research Center for Computational Methods (CIMEC) - CONICET/UNL Tel: 54-342-4511594 Int. 7032 Colectora Ruta Nac. 168 / Paraje El Pozo (3000) Santa Fe - Argentina. http://www.cimec.org.ar |
|
February 28, 2011, 12:13 |
|
#3 |
Senior Member
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30 |
Why not use the residual as done in simpleFoam? Something like:
Code:
eqnResidual = solve ( CEqn() ).initialResidual(); maxResidual = max(eqnResidual, maxResidual); Last edited by akidess; February 28, 2011 at 12:17. Reason: Probably won't work after all, sorry |
|
February 28, 2011, 12:35 |
|
#4 |
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24 |
Yes, I thought in the same thing, but it supposes you're judging convergence based on residuals. Which I can understand at all is the purpose of this loop, Is this a sort of outer loop in order to better couple the solution in each time-step?
Regards.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D. Research Scientist Research Center for Computational Methods (CIMEC) - CONICET/UNL Tel: 54-342-4511594 Int. 7032 Colectora Ruta Nac. 168 / Paraje El Pozo (3000) Santa Fe - Argentina. http://www.cimec.org.ar |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Gmsh] Problem with Gmsh | nishant_hull | OpenFOAM Meshing & Mesh Conversion | 23 | August 5, 2015 03:09 |
What value shall I set for the Convergence criteria? | steventay | CFX | 7 | May 14, 2010 13:44 |
Convergence Criteria | edwin | FLUENT | 1 | February 14, 2008 20:24 |
NACA0012 geometry/design software needed | Franny | Main CFD Forum | 13 | July 7, 2007 16:57 |
convergence of Euler Equations with WENO | Shyam | Main CFD Forum | 0 | June 1, 2007 01:47 |