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

Where do we read relaxationFactors in fvSolution in the codes?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   May 24, 2011, 05:34
Default Where do we read relaxationFactors in fvSolution in the codes?
  #1
Member
 
Kai
Join Date: May 2010
Location: Stockholm
Posts: 40
Rep Power: 7
kaifu is on a distinguished road
Hi Foamers,

I am curious about where do we read relaxationFactors in system/fvSolution in the solvers? For example, in simpleFoam, I can not see any dictionary is defined to look up those numbers. I guess it may read those numbers when we are trying to solve eqns. For example, in "UEqn.H", does the line
Code:
UEqn.relax();
read the relaxation factor for U?

Thx

// Kai
kaifu is offline   Reply With Quote

Old   May 24, 2011, 11:13
Default
  #2
Member
 
Kai
Join Date: May 2010
Location: Stockholm
Posts: 40
Rep Power: 7
kaifu is on a distinguished road
It is said "The user can specify the relaxation factor for a particular field by specifying first the word associated with the field, then the factor. The user can view the relaxation factors used in a tutorial example of simpleFoam for incompressible, laminar, steady-state flows."

It is not clear how to update the field during calculation although it seems that the relaxation factor is connected with the particular field automatically.

For example, if I create a field Gamma, and it will be updated every interation, say,
Code:
Gamma=a value
Then how does the solver deal with the updated Gamma and its relaxation factor?

Even for the alpha, U, p, k, epsilon, after solving the PDEs,
Code:
alphaEqn.solve();
will they be relaxed with the factor implicitly and automatically?

// Kai
kaifu is offline   Reply With Quote

Old   May 24, 2011, 13:41
Default
  #3
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 397
Rep Power: 12
marupio is on a distinguished road
I was just reading up on that myself.

Relaxation factors are specified in the controlDict file, under a subdictionary called 'relaxationFactors'. It contains a list of field names, with the associated relaxation factors.

eg. (and I'm guessing a little here):

Code:
relaxationFactors
{
    U    0.7;
    T    0.5;
}
If the field name is not found, no relaxation is applied.
marupio is offline   Reply With Quote

Old   May 24, 2011, 15:45
Default
  #4
Member
 
Kai
Join Date: May 2010
Location: Stockholm
Posts: 40
Rep Power: 7
kaifu is on a distinguished road
Quote:
Originally Posted by marupio View Post
I was just reading up on that myself.
But when do you use those numbers? For example to solve UEqn, you will use
Code:
UEqn.relax();UEqn.solve();
I dont see any relax factor is used.

// Kai
kaifu is offline   Reply With Quote

Old   May 24, 2011, 15:54
Default
  #5
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 397
Rep Power: 12
marupio is on a distinguished road
fvMatrix::relax is overridden. If you provide it with a scalar - relax(factor) - it will relax the matrix with the given factor. If you don't, here's what it does:

From fvMatrix.C:

Code:
template<class Type>
void Foam::fvMatrix<Type>::relax()
{
    if (psi_.mesh().relax(psi_.name()))
    {
        relax(psi_.mesh().relaxationFactor(psi_.name()));
    }
}
It calls the overridden relax(factor) function, feeding it a scalar that was looked up in the controlDict. psi_.mesh().relaxationFactor(word) is a function in the solution class, which is part of the mesh. solution holds all the relaxation factors, which it reads from controlDict in the format I specified above.

You could figure this out from reading the source code, which is a little tricky until you get used to it. From a practical perspective, you can use relax by either putting:

Code:
PEqn.relax()  // Look up factor from controlDict
PEqn.relax(factor)  // Use the factor provided
If using the first one, the user has to have a relaxationFactors subdictionary in the controlDict to get it to work.

Am I answering the question?
marupio is offline   Reply With Quote

Old   May 24, 2011, 16:07
Default
  #6
Member
 
Kai
Join Date: May 2010
Location: Stockholm
Posts: 40
Rep Power: 7
kaifu is on a distinguished road
That's great! Thanks
kaifu is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it worth it? Jason Bardis Main CFD Forum 47 July 27, 2011 04:52
Phase locked average in run time panara OpenFOAM 2 February 20, 2008 15:37
Comparison of CFD Codes Kerem Main CFD Forum 9 May 9, 2003 04:29
New List of Free CFD Codes Bert Laney Main CFD Forum 5 September 15, 1999 15:24
Anyone used Ansys/Flotran - cf. with other codes? S. Langsford Main CFD Forum 3 October 19, 1998 20:51


All times are GMT -4. The time now is 20:47.