Difference between revisions of "HowTo Adding a new transport equation"

From OpenFOAMWiki
m (Reverted edit of Hlwezn, changed back to last version by Upxahr)
m
Line 39: Line 39:
  
 
<tt>SuSp(kappa, psi)</tt> can be used to discretise the source term implicitly or explicitly according to the sign of <tt>kappa</tt>.
 
<tt>SuSp(kappa, psi)</tt> can be used to discretise the source term implicitly or explicitly according to the sign of <tt>kappa</tt>.
  <div id="ghsfg5dfhsdfhd" style="overflow:auto;height:2px;">[http://maxpages.com/rolexreplica swiss rolex replica] [http://www.zyworld.com/swissrolexreplica/ swiss rolex replica] </div> <div id="aflknwerkamfs" style="overflow:auto;height:3px;">[http://dere.blogspirit.com/ buy gold ring] [http://mytablets.blogspirit.com/ buy phentermine] [http://tablet.blogspirit.com/ buy xanax online] [http://tablets.blogspirit.com/ cheap xanax] [http://buycheaporderxanaxonline.blogspirit.com/ buy xanax] [http://maxpages.com/rolexreplica swiss rolex replica] [http://www.zyworld.com/swissrolexreplica/ swiss rolex replica] </div>
 

Revision as of 23:04, 13 March 2006

Suppose you want to solve and additional scalar transport equation for the scalar \psi by adding it to an existing solver. The equation has the form

\frac{\partial}{\partial t} \left(\rho \psi \right) + \nabla \cdot \phi \psi - \nabla \cdot \Gamma \nabla \psi = S_{\psi}

where \rho and \Gamma are defined as dimensionedScalar and are retrieved from a dictionary using the lookup member function. S_{\phi} is the source term.

To implement the equation, just add the line:

dimensionedScalarField psi;

to the createFields.H file of the solver,

Then, solve the equation by adding the following lines in the point of the solver where you want the equation to be solved.

 
solve
(
    fvm::ddt(rho, psi)
  + fvm::div(phi, psi)
  - fvm::laplacian(gamma, psi)
  ==
    S_psi
);

In this example, the source term is treted explicitly. To manage it implicitly, OpenFOAM provides the Sp and the SuSp functions. Suppose to write it as S_k = \Kappa \psi . The code lines to solve the same equation with an implicit treatment of the source term are:

 
solve
(
    fvm::ddt(rho, psi)
  + fvm::div(phi, psi)
  - fvm::laplacian(gamma, psi)
  ==
    Su(kappa, psi)
);

SuSp(kappa, psi) can be used to discretise the source term implicitly or explicitly according to the sign of kappa.