
[Sponsors] 
May 3, 2011, 04:01 
Meaning of fvm and fvc

#1 
New Member
Nishit Joseph
Join Date: Nov 2010
Posts: 29
Rep Power: 7 
Hi
I am a UG student working on a solver for high Ma numbers using OpenFOAM for my final year project. I am relatively new to OpenFOAM. While looking at the code of rhoCentralFoam i came across this line(s) which I am not able to figure out the menaing Code:
if (!inviscid) { volScalarField k("k", thermo.Cp()*mu/Pr); solve ( fvm::ddt(rho, e)  fvc::ddt(rho, e)  fvm::laplacian(thermo.alpha(), e) + fvc::laplacian(thermo.alpha(), e)  fvc::laplacian(k, T) ); thermo.correct(); rhoE = rho*(e + 0.5*magSqr(U)); } Code:
fvm::ddt(rho, e)  fvc::ddt(rho, e) I am trying to rewrite sonicFoam energy equation using total energy and since this solver uses total energy (for inviscid  not shown above) i thought I could copy it but was not sure what is happening in the above shown code to include viscous effect. Any help or advise will be highly appreciated! Cheers! 

May 3, 2011, 04:13 

#2 
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 13 
You can consult the User Guide or Programmer Guide in the /doc directory of your install. You will definitely find the answer to this question, and very likely of some future questions as well.


May 3, 2011, 12:09 

#3 
Senior Member
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 433
Rep Power: 14 
It would be nice to see a translation guide between all the fvm / fvc functions and their equivalent vectorform calculus in the wiki somewhere. Perhaps a subpage under: http://openfoamwiki.net/index.php/Ca...OpenFOAM_guide
Most of them are straightforward, but some are not. 

May 4, 2011, 00:27 

#4 
Member
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 8 
Using "fvc::" will calculate the derivative using the current values. While "fvm::" will discretize the term into the matrix equation. So "fvc::" will generate a field, while "fvm::" will return matrix coefficients. Soo, if you're solving [M] [Q] = [B]
fvm:: generates coefficients for [M] fvc:: goes in [B] Its more or less a distinction between explicit and implicit terms. Hope this helps. gl, Tony 

May 4, 2011, 02:35 

#5  
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 13 
Quote:


October 12, 2011, 17:36 

#6 
Senior Member
Vesselin Krastev
Join Date: Jan 2010
Location: University of Tor Vergata, Rome
Posts: 364
Rep Power: 11 
Well, in the user and programmers guides actually there is no clear explanation of what fvc::ddt means, so I think that the question posed at the beginning of the tread should be considered more seriously than "go and see it in the user/programmers" guide. Thou the meaning of other fvc terms is quite easily deducible (i. e. simply source terms calculated with available values), to me (sorry for my ignorance) it is not the same with fvc::ddt. Which are, for instance, the "available values" in this case? In addition, it is also interesting to go deeper into the rhoCentralFoam solution algorithm, which in general is not so straightforward as many others into the OF solver family.
I hope that someone else could join the discussion to share his knowledge/opinion about it. Regards V. 

October 12, 2011, 23:53 

#7  
New Member
Nishit Joseph
Join Date: Nov 2010
Posts: 29
Rep Power: 7 
Quote:
With regards to the methods used in rhoCentralFoam, thought I wont admit I fully understand all of it, the solver from Praveen (link below) based on rhoCentralFoam did give me an insight of the intent since they were algorithms I am more used to. http://sourceforge.net/projects/gfoam/ Regards Nishit 

October 13, 2011, 11:35 

#8 
Senior Member
Vesselin Krastev
Join Date: Jan 2010
Location: University of Tor Vergata, Rome
Posts: 364
Rep Power: 11 
Well, this is what I have understood so far about the rhoCentralFoam solver.
1) In the first part of the solver, there is an explicit spatial reconstruction of some "intermediate" fields over the cell faces, using the Kurganov or Tadmor interpolation schemes; 2) after that, these "intermediate fields" are used to calculate explicit source terms for the density equation and the inviscid momentum and energy equations, which are "forwarded" in time and then solved as diagonal systems of equations; 3) if the viscosity of the fluid has been set to zero, the algorithm stops here; otherwise, the viscous (and eventually turbulent) momentum and energy equations are solved, treating the already calculated inviscid part of the equations as explicit source terms. 4) before (eventually) solving the turbulent quantities transport equations, the pressure field is updated via the equation of state of the fluid. Some comments: I think that fvc::ddt actually represents the source term coming from the inviscid part of the solution. Let's take, for instance, the momentum equation: //  Solve density solve(fvm::ddt(rho) + fvc::div(phi)); //  Solve momentum solve(fvm::ddt(rhoU) + fvc::div(phiUp)); U.dimensionedInternalField() = rhoU.dimensionedInternalField() /rho.dimensionedInternalField(); U.correctBoundaryConditions(); rhoU.boundaryField() = rho.boundaryField()*U.boundaryField(); this part of the code solves for rho and U, assuming that in the momentum equation only pressure and convection effects occur (inviscid solution). After that the viscous momentum equation is defined and solved as follows: if (!inviscid) { solve ( fvm::ddt(rho, U)  fvc::ddt(rho, U)  fvm::laplacian(muEff, U)  fvc::div(tauMC) ); rhoU = rho*U; } well, if one calculates ddt(rho,U) explicitly, using the initial rho and U values and the freshly calculated rho and U actual inviscid values, one should reobtain the second term of the inviscid momentum equation, i. e. the contribution of convection and pressure gradients. Doubts and questions: 1) if I am right about my interpretation of fvc:ddt(<something>), does it mean that the effects of convection+pressure can be splitted from those of viscous diffusion? This is a little confusing to me, as the U values used in fvc:rho,U) should be approximate values if viewed as part of a viscous flow solution... 2) to me the initial "reconstruction" procedure is quite a mystery, especially for what concerns the pressure field and its introduction into the "mixed" pressureconvection term represented by fvc::div(phiUp)... Any comments, suggestions and (of course) corrections to my statements would be really appreciated Regards V. 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
fvm vs. fvc  Pascal_doran  OpenFOAM Programming & Development  1  July 8, 2010 15:35 