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

From OpenFOAMWiki
 
(11 intermediate revisions by 5 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:4px;">[http://site.neogen.ro/myphentermine/images/img_953462.html online vicodin buy] [http://site.neogen.ro/myphentermine/images/img_953457.html buy online lortab] [http://site.neogen.ro/myphentermine/images/img_953455.html buy valium online] [http://site.neogen.ro/myphentermine/images/img_953451.html online soma buy] [http://site.neogen.ro/myphentermine/images/img_953447.html tramadol online buy] [http://site.neogen.ro/myphentermine/images/img_953443.html buy cialis online] [http://site.neogen.ro/myphentermine/images/img_953439.html buy online viagra] [http://site.neogen.ro/myphentermine/images/img_953435.html levitra buy online] [http://site.neogen.ro/myphentermine/images/img_953431.html onine xanax buy] [http://site.neogen.ro/myphentermine/images/img_953423.html phentermine online buy] [http://site.neogen.ro/myreply/images/img_953765.html replica swiss watch] [http://site.neogen.ro/myreply/images/img_953764.html swiss rolex replica] [http://site.neogen.ro/myreply/images/img_953763.html rolex replica watch swiss] [http://site.neogen.ro/myreply/images/img_953762.html replica watch rolex] [http://site.neogen.ro/myreply/images/img_953758.html band rolex replica watch] [http://site.neogen.ro/myreply/images/img_953756.html replica designer watch] [http://site.neogen.ro/myreply/images/img_953754.html rolex watch replica daytona] [http://site.neogen.ro/myreply/images/img_953753.html rolex the best replica watch] [http://site.neogen.ro/myreply/images/img_953752.html watch fake rolex] [http://site.neogen.ro/myreply/images/img_953751.html rolex replica watch] [http://7331.rapidforum.com ambien online buy] [http://7051.rapidforum.com/ online buy adipex] [http://6905.rapidforum.com/ levitra online buy] [http://77693.rapidforum.com online buy viagra] [http://67794.rapidforum.com/ carisoprodol buy online] [http://37380.rapidforum.com/ buy online phentermine] [http://34959.rapidforum.com/ xanax online 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 online xanax buy] [http://71666.rapidforum.com/ rolex replica daytona watch] [http://1262.rapidforum.com/ designer replica watch] [http://2251.rapidforum.com/ rolex replica swiss] [http://3703.rapidforum.com/ watch swiss replica] [http://16491.rapidforum.com/ rolex watch replica band] [http://16491.rapidforum.com/ replica rolex] [http://77905.rapidforum.com/ replica best the watch rolex] [http://79801.rapidforum.com/ replica rolex watch] [http://66343.rapidforum.com replica rolex] [http://65106.rapidforum.com/ watch rolex replica swiss] [http://www.cgispy.com/boards/board.cgi?user=sry watch daytona replica rolex] [http://www.cgispy.com/boards/board.cgi?user=css replica watch designer] [http://www.cgispy.com/boards/board.cgi?user=mywatchess rolex replica swiss] [http://www.cgispy.com/boards/board.cgi?user=watchess watch swiss replica] [http://www.cgispy.com/boards/board.cgi?user=bladi watch replica rolex band] [http://www.cgispy.com/boards/board.cgi?user=gluki rolex replica] [http://www.cgispy.com/boards/board.cgi?user=mywatct watch best replica the rolex] [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 watch replica rolex swiss] </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.