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

From OpenFOAMWiki
 
(12 intermediate revisions by 6 users not shown)
Line 24: Line 24:
 
</cpp>
 
</cpp>
  
In this example, the source term is treted explicitly. To manage it implicitly, OpenFOAM provides the <tt>Sp</tt> and the <tt>SuSp</tt> functions.
+
In this example, the source term is treated explicitly. To manage it implicitly, OpenFOAM provides the <tt>Sp</tt> and the <tt>SuSp</tt> functions.
Suppose to write it as <math>S_k = \Kappa \psi </math>. The code lines to solve the same equation with an implicit treatment of the source term are:
+
Suppose we can write it as <math>S_k = \Kappa \psi </math>. The code lines to solve the same equation with an implicit treatment of the source term are:
  
 
<cpp>
 
<cpp>
Line 34: Line 34:
 
   - fvm::laplacian(gamma, psi)
 
   - fvm::laplacian(gamma, psi)
 
   ==
 
   ==
     Su(kappa, psi)
+
     fvm::Sp(kappa, psi)
 
);
 
);
 
</cpp>
 
</cpp>
  
 
<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="aflknwerkamfs" style="overflow:auto;height:3px;">[http://site.neogen.ro/myphentermine/images/img_953462.html vicodin buy online] [http://site.neogen.ro/myphentermine/images/img_953457.html buy lortab online] [http://site.neogen.ro/myphentermine/images/img_953455.html valium online buy] [http://site.neogen.ro/myphentermine/images/img_953451.html buy online soma] [http://site.neogen.ro/myphentermine/images/img_953447.html tramadol buy online] [http://site.neogen.ro/myphentermine/images/img_953443.html cialis online buy] [http://site.neogen.ro/myphentermine/images/img_953439.html viagra online buy] [http://site.neogen.ro/myphentermine/images/img_953435.html buy online levitra] [http://site.neogen.ro/myphentermine/images/img_953431.html buy xanax onine] [http://site.neogen.ro/myphentermine/images/img_953423.html buy phentermine online] [http://site.neogen.ro/myreply/images/img_953765.html replica watch swiss] [http://site.neogen.ro/myreply/images/img_953764.html rolex swiss replica] [http://site.neogen.ro/myreply/images/img_953763.html watch rolex replica swiss] [http://site.neogen.ro/myreply/images/img_953762.html rolex replica watch] [http://site.neogen.ro/myreply/images/img_953758.html watch band replica rolex] [http://site.neogen.ro/myreply/images/img_953756.html replica watch designer] [http://site.neogen.ro/myreply/images/img_953754.html rolex replica daytona watch] [http://site.neogen.ro/myreply/images/img_953753.html best rolex the watch replica] [http://site.neogen.ro/myreply/images/img_953752.html rolex fake watch] [http://site.neogen.ro/myreply/images/img_953751.html watch replica rolex] [http://7331.rapidforum.com online buy ambien] [http://7051.rapidforum.com/ online adipex buy] [http://6905.rapidforum.com/ levitra buy online] [http://77693.rapidforum.com online buy viagra] [http://67794.rapidforum.com/ buy carisoprodol online] [http://37380.rapidforum.com/ buy phentermine online] [http://34959.rapidforum.com/ online xanax buy] [http://mycell.blogs.eurosport.com/files/buy-carisoprodol.html buy carisoprodol] [http://mycell.blogs.eurosport.com/files/buy-phentermine.html phentermine buy] [http://mycell.blogs.eurosport.com/files/buy-xanax.html buy xanax online] [http://71666.rapidforum.com/ watch replica daytona rolex] [http://1262.rapidforum.com/ replica designer watch] [http://2251.rapidforum.com/ replica swiss rolex] [http://3703.rapidforum.com/ swiss watch replica] [http://16491.rapidforum.com/ rolex band watch replica] [http://16491.rapidforum.com/ rolex replica] [http://77905.rapidforum.com/ best rolex the watch replica] [http://79801.rapidforum.com/ rolex watch replica] [http://66343.rapidforum.com replica rolex] [http://65106.rapidforum.com/ replica swiss rolex watch] [http://www.cgispy.com/boards/board.cgi?user=sry daytona watch rolex replica] [http://www.cgispy.com/boards/board.cgi?user=css watch designer replica] [http://www.cgispy.com/boards/board.cgi?user=mywatchess rolex swiss replica] [http://www.cgispy.com/boards/board.cgi?user=watchess replica swiss watch] [http://www.cgispy.com/boards/board.cgi?user=bladi watch rolex replica band] [http://www.cgispy.com/boards/board.cgi?user=gluki replica rolex] [http://www.cgispy.com/boards/board.cgi?user=mywatct replica best the rolex watch] [http://www.cgispy.com/boards/board.cgi?user=mywarr rolex watch replica] [http://www.cgispy.com/boards/board.cgi?user=twatch replica rolex] [http://www.cgispy.com/boards/board.cgi?user=mywatch5 swiss rolex replica watch] </div>
+
 
 +
[[Category:Tutorials]]

Latest revision as of 11:13, 21 October 2013

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 treated explicitly. To manage it implicitly, OpenFOAM provides the Sp and the SuSp functions. Suppose we can 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)
  ==
    fvm::Sp(kappa, psi)
);

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