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

fvm::laplacian - fvc::div

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By Tobi
  • 1 Post By mAlletto

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 28, 2019, 08:56
Default fvm::laplacian - fvc::div
  #1
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi all,

yesterday a question arises about the divDevRhoREff() calculation (Calculating divDevReff)

Here, we have the following constellation

Code:
 tmp<fvVectorMatrix> laminar::divDevReff(volVectorField& U) const
{
    return
    (
      - fvm::laplacian(nuEff(), U)
      - fvc::div(nuEff()*dev(T(fvc::grad(U))))
    );
}
The question is as follows
  • The divDevReff() function returns a fvVectorMatrix
  • the fvm::laplacian() function returns a fvMatrix<Type> (so it is a fvVectorMatrix as U is a vector)

What I don´t get right now is the following:
  • As the fvMatrix class do not contain an operator- that handles GeometricFields<Type>, the fvc::div() function should return a fvMatrix<Type> in order to substract it from the fvm::laplacian() term
  • However, the fvc::grad(U) returns a tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > (I cannot define what GeometricField it is related to; it should be a tensor as the dev function only handles tensors (matrix) fields)
  • The dev() function removes the trace as it is known. Thus the result is a tensor (matrix) too.
  • The fvc::div() function should return somehow a tmp< GeometricField< typename innerProduct< vector, Type >::type, fvPatchField, volMesh >> field (this I cannot evaluate right now) but basically it should be a tensor in order to be able to substract it from the fvm::laplacian term

So the question would be as follow: Can anyone give more insight into the fields that are returned by the fvc::grad(U), dev() and fvc::div() functions.


Thanks in advance.
Tobi
raumpolizei likes this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   October 29, 2019, 12:23
Default
  #2
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16
mAlletto will become famous soon enough
Hello Tobias,


to answer your questions:


fvc:grad(U) returns the velocity gradient tensor, see https://caefn.com/openfoam/tensor-operations


fvc:div returns the divergence of the tensor and dev is the deviation part of the tensor. how they are calculated is explained in the OpenFOAM programmer guide.



by the way the operator - which takes a fvMatrix and a geometricField as input is defined (see https://www.openfoam.com/documentati...8C_source.html)


what it does, it adds the Geometric field to the source of the matrix and returns this new matrix.


Hope it helps



Michael
Tobi likes this.
mAlletto is offline   Reply With Quote

Old   October 29, 2019, 13:30
Default
  #3
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi Michael,


thanks for your answer. Most of the things were clear. The only interesting point was that I could not find the implementation of the operator- for a fvMatrix which takes the GeometricField<Type> as giben here: https://cpp.openfoam.org/v7/classFoam_1_1fvMatrix.html


However, if we jump into the source code of the fvMatrix.C file, it is there. I expected the operator- should be visible in the doxygen class too.


Code:
 template<class Type>

 Foam::tmp<Foam::fvMatrix<Type>> Foam::operator-

 (

     const fvMatrix<Type>& A,

     const tmp<GeometricField<Type, fvPatchField, volMesh>>& tsu

 )

 {

     checkMethod(A, tsu(), "-");

     tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A));

     tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();

     tsu.clear();

     return tC;

 }



Thank you for your hint.
__________________
Keep foaming,
Tobias Holzmann
Tobi 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
fvc::div for surfaceVectorField ARTem OpenFOAM Programming & Development 4 November 2, 2018 13:41
anisotropic diffusion fvm::laplacian MichiB OpenFOAM 1 January 10, 2013 05:47
fvc::div() strange behaviour ivan_cozza OpenFOAM Running, Solving & CFD 2 February 6, 2010 07:09
fvm::laplacian appropriate for d/dx(d/dy) sven OpenFOAM 1 December 10, 2009 13:24
What type return fvcdiv su_junwei OpenFOAM Running, Solving & CFD 6 October 13, 2008 08:09


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