# continuity equation rhoEqn.H

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

 November 6, 2017, 07:54 continuity equation rhoEqn.H #1 Member   Fridrik Magnusson Join Date: Aug 2017 Location: Denmark Posts: 34 Rep Power: 8 Hallo everyone im trying to learn about OpenFoam, and by that i would like to explore the continuity equation. But my source-code-reading-skills is not the best. This post is made to disect the continuity equation from an absolut beginners point of view. Where the continuity equation is: I have posted the rhoEqn.H below, which might be the most generally implementation of the continuity equation. Where it is unknown what the line 7, 9, 10 and 11 does. Code: 1{ 2 fvScalarMatrix rhoEqn //Class called rhoEqn 3 ( 4 fvm::ddt(rho) //generates the implicit (fvm) first order time derivative (ddt) 5 + fvc::div(phi) // adds the explicit (fvc) divergence of phi, where phi = rho*u 6 == 7 fvOptions(rho) // compares to the acceptable error in fvSolution ? 8 ); 9 fvOptions.constrain(rhoEqn); // Give solution criteria ? 10 rhoEqn.solve(); // Acturally solves the equation ? 11 fvOptions.correct(rho); // rewrite the code ? 12 } Hopefully this can later be condensed into an introduction for other new users. line 4-8 is somewhat defined in the ProgrammersGuide http://foam.sourceforge.net/docs/Gui...mmersGuide.pdf

 November 10, 2017, 09:18 #2 New Member   Dave Join Date: Dec 2014 Posts: 2 Rep Power: 0 fvOptions allows one to manipulate certain fields outside of the solver. Line 7 is a direct source/sink term, lines 9 and 11 impose a constraint on the equation (before solution) or a correction on the field (after solution). These lines won't do anything unless the user has written some fvOptions code and placed it in constant/. mikulo likes this.

 November 14, 2017, 04:24 #3 Member   Fridrik Magnusson Join Date: Aug 2017 Location: Denmark Posts: 34 Rep Power: 8 dhumbird, thanks for getting me one step closer to the answer your answer leads to further questions ? line 7: fvOptions(rho) - pulls infomation from fvSolution and fvSchemes through the function fvOptions ? line 9: What kind of constraint? line 11: What kind of correction ?

 November 14, 2017, 23:16 #4 New Member   Dave Join Date: Dec 2014 Posts: 2 Rep Power: 0 Fridrik, At each of the fvOptions lines, the user can insert code without re-writing the solver. The code goes in a new file called constant/fvOptions. This is *advanced* OpenFOAM, so from an "absolute beginner's" perspective, these lines can be ignored. (Line 7 will return a 0, Lines 9 and 11 do nothing.) If/when you need this functionality, there are lots of hints here in the forum. mikulo likes this.

 Tags beginner, continuity equation, rhoeqn.h