CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

mvConvection->fvmDiv vs fvm::div

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 23, 2016, 12:20
Default mvConvection->fvmDiv vs fvm::div
  #1
Member
 
Join Date: Aug 2015
Posts: 37
Rep Power: 11
knuckles is on a distinguished road
Looking at the source code for reactingFoam, YEqn.H defines the variable mvConvection as

Code:
tmp<fv::convectionScheme<scalar>> mvConvection
(
    fv::convectionScheme<scalar>::New
    (
        mesh,
        fields,
        phi,
        mesh.divScheme("div(phi,Yi_h)")
    )
);
and this object is used to evaluate the divergence term in YEqn.H and EEqn.H:
Code:
// YEqn.H

    + mvConvection->fvmDiv(phi, Yi)

// EEqn.H

    + mvConvection->fvmDiv(phi, he)
By contrast, the other transport equations use
Code:
    + fvm::div(phi, field) // "field" is the volScalarField being solved for
I have a guess for why this is, but I'd appreciate some confirmation. My guess is that:
  • fvm::div looks up the convection scheme in fvSchemes by searching for the tag "div(phi, [name of field])"
  • as coded, mvConvection looks up the convection scheme by searching for the tag "div(phi, Yi_h)"
...and thus that mvConvection:
  • saves the user from having to insert a "div(phi, [species name])" for each individual species in the simulation
  • ensures that the divergence schemes for the species and for h are the same
Is this interpretation correct? Is there a theoretical reason why it's important that mass and energy/enthalpy use the same divergence scheme?
knuckles is offline   Reply With Quote

Old   September 23, 2016, 13:15
Default
  #2
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 22
Zeppo will become famous soon enough
Quote:
Originally Posted by knuckles View Post
Code:
    + fvm::div(phi, field) // "field" is the volScalarField being solved for
Let me cite the source code:
Code:
//- src/finiteVolume/finiteVolume/fvm/fvmDiv.C
   ...
   43 template<class Type>
   44 tmp<fvMatrix<Type>>
   45 div
   46 (
   47     const surfaceScalarField& flux,
   48     const GeometricField<Type, fvPatchField, volMesh>& vf,
   49     const word& name
   50 )
   51 {
   52     return fv::convectionScheme<Type>::New
   53     (
   54         vf.mesh(),
   55         flux,
   56         vf.mesh().divScheme(name)
   57     )().fvmDiv(flux, vf);
   58 }
   ...
   75 template<class Type>
   76 tmp<fvMatrix<Type>>
   77 div
   78 (
   79     const surfaceScalarField& flux,
   80     const GeometricField<Type, fvPatchField, volMesh>& vf
   81 )
   82 {
   83     return fvm::div(flux, vf, "div("+flux.name()+','+vf.name()+')');
   84 }
Zeppo is offline   Reply With Quote

Old   April 16, 2019, 11:26
Default
  #3
Senior Member
 
zhangyan's Avatar
 
Yan Zhang
Join Date: May 2014
Posts: 120
Rep Power: 12
zhangyan is on a distinguished road
Hi everyone!
From above discussion, the conclusion of this thread is that mvConvection is used only for the simplification for the case of multi variables with same scheme.
However:
In my solver, two additional variable is transported.
When I use separate but same scheme for these two variable ( fvm::div(phi, field) ), I found that the results is different with mvConvection ( mvConvection->fvmDiv(phi, field) ).
So, is there any other difference between mvConvection->fvmDiv and fvm::div?
__________________
https://openfoam.top
zhangyan is offline   Reply With Quote

Old   October 8, 2023, 08:10
Default
  #4
New Member
 
Qian Meng
Join Date: Nov 2022
Posts: 4
Rep Power: 4
Rachel0096 is on a distinguished road
Quote:
Originally Posted by zhangyan View Post
Hi everyone!
From above discussion, the conclusion of this thread is that mvConvection is used only for the simplification for the case of multi variables with same scheme.
However:
In my solver, two additional variable is transported.
When I use separate but same scheme for these two variable ( fvm::div(phi, field) ), I found that the results is different with mvConvection ( mvConvection->fvmDiv(phi, field) ).
So, is there any other difference between mvConvection->fvmDiv and fvm::div?
Hello,zhangyan!
The convection term of the code I refer to is written like this:
Code:
// convection
+ ( UseMvConvection ? mvConvection->fvmDiv(phi + phiVc, Yi) : fvm::div(phi + phiVc, Yi, "div(phi,Yi_h)") )
Have you figured out the difference between mvConvection->fvmDiv and fvm::div?
Rachel0096 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
mvConvection in reactingFoam smehdi609 OpenFOAM Running, Solving & CFD 7 April 16, 2019 11:22
Understanding an equation: what is "fvmDiv" and "fvOptions(rho,he)"? shovan OpenFOAM Programming & Development 0 August 21, 2015 08:09
Wrong fvm::div assembling santiagomarquezd OpenFOAM Bugs 90 December 27, 2010 13:54


All times are GMT -4. The time now is 03:14.