
[Sponsors] 
June 8, 2011, 11:47 
div(phi,U) in an incompressible solver

#1 
Member
fisch
Join Date: Feb 2010
Posts: 97
Rep Power: 9 
Hi Foamers,
does anybody know if div(phi,U) in an incompressible solver (like simpleFoam) is calculating the "full" divergence term of phi*U or is it directely introducing the incompressibility conditions that the calculation would be reduced to the half. For a better understanding what i mean i will write it analytical for 2D motion (i will leave out the density): Option a) div(U,U) = u*( du/dx+dv/dy) + u*du/dx + v*du/dy Option b) div(U,U) = u*du/dx + v*du/dy (because the term in the brackets satisfies div(U)=0) Which option is openFoam using? Thanks a lot, rupert 

June 8, 2011, 13:44 

#2 
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 438
Rep Power: 17 
Rupert, FOAM solves the "weak" form if this term. When you use FVM, integrals are volumetric at the beginning but using the Gauss Theorem you don't have to use any derivatives but only values at faces, because you have a surface integral:
int_{Omega} div(U*U) dOmega=int_{Gamma} U*U&d_Gamma=sum_f U_f*U_f&S_f=sum_f U_f*phi_f where & is the dot product, Omega is the control volume and Gamma is its border and f indicates quantities at faces. phi is the flux U_f&S_f. Regards.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D. Research Scientist Research Center for Computational Methods (CIMEC)  CONICET/UNL Tel: 543424511594 Int. 7032 Colectora Ruta Nac. 168 / Paraje El Pozo (3000) Santa Fe  Argentina. http://www.cimec.org.ar 

June 9, 2011, 07:21 

#3 
Senior Member
Paulo Vatavuk
Join Date: Mar 2009
Location: Campinas, Brasil
Posts: 162
Rep Power: 10 
Hi Rupert,
Just complementing Santiago's answer, this means that, for the x momentum equation, you have alternative a) integrated over the cell volume. Paulo 

June 9, 2011, 07:46 

#4 
Member
fisch
Join Date: Feb 2010
Posts: 97
Rep Power: 9 
Hi Paulo and Santiago,
thanks for the reply. Both answers are helping me. So if i want to add to an equation one more term i have to integrate it over the cell volume or just multiply the cell center value with the Volume of the cell, right? For example if i want to add a value S (like a source term) i have to integrate this value over the cell volume, too, right? Thanks rupert 

June 9, 2011, 07:51 

#5 
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 438
Rep Power: 17 
Rupert, the integration is part of the method and is implied using FOAM. Adding S to the equation starts a chain of events that finally integrate the source over each cell. The other option is to use the fvm::Sp().
Regards.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D. Research Scientist Research Center for Computational Methods (CIMEC)  CONICET/UNL Tel: 543424511594 Int. 7032 Colectora Ruta Nac. 168 / Paraje El Pozo (3000) Santa Fe  Argentina. http://www.cimec.org.ar 

June 9, 2011, 09:34 

#6 
Member
fisch
Join Date: Feb 2010
Posts: 97
Rep Power: 9 
Hello Santiago,
does that mean that the integration is implied in the discretization schemes (like in e.g. div(phi,U)) or is it automatically implied while solving an equation??? The difference would be that i don't have to integrate my source term my own if it is done by the solve() procedure... Can you understand what i mean?? As far as i get it out of the source code the Sp() function is anyhow multiplying with the cell Volumes; but i had no success to use it right :/ ... Further: what is wrong if i type: volScalarField meshVols = U.mesh().V(); There is a compiler error: error: conversion from ‘const Foam:imensionedField<double, Foam::volMesh>’ to nonscalar type ‘Foam::volScalarField’ requested Maybe you have some answers. thanks a lot, rupert 

June 10, 2011, 11:32 

#7  
Member
Sabin Ceuca
Join Date: Mar 2010
Location: Munich
Posts: 42
Rep Power: 9 
Quote:
I can help you on this one : tmp<volScalarField> cellVolume ( new volScalarField); cellVolume().internalField() = mesh.V(); This part should store the volumes of your cells. I don't really understand why you call your volume like U.mesh().V ? Regards, sabin 

June 14, 2011, 01:42 

#8  
Member
fisch
Join Date: Feb 2010
Posts: 97
Rep Power: 9 
Quote:
do i have to use some integration over the cell volume inside an equation for the additional source term S or is it done automatically so that i have to add only the term with " + S" or do i need something else?? Thanks for your help. rupert 

June 25, 2013, 12:16 

#9 
Senior Member
Anne Gerdes
Join Date: Aug 2010
Location: Hamburg
Posts: 168
Rep Power: 9 
Good evening,
I have the same question. I have added an explicit source term rhs in the momentum equation HTML Code:
tmp<fvVectorMatrix> UEqn
(
fvm::div(phi, U)
+ turbulence>divDevReff(U)
+rhs
)
In my case I would like to add a facebased source term which includes the face magnitudes. Therefore I suppose that I need to divide my source term by the control volume, as I do not want it to be multiplied as the multiplication with the face magnitude symbols an integration over the face already. Can someone please verify that the source term is automatically integrated if I insert it in the UEqn like stated above? I am looking forward to your answers. Kind Regards Anne 

June 26, 2013, 02:56 

#11 
Senior Member
Anne Gerdes
Join Date: Aug 2010
Location: Hamburg
Posts: 168
Rep Power: 9 
Dear Fumiya,
thank you very much for your answer. How can I switch between cellcentered and cellintegrated value? Thank you, Anne Lincke 

June 27, 2013, 14:06 

#12 
Senior Member
Anne Gerdes
Join Date: Aug 2010
Location: Hamburg
Posts: 168
Rep Power: 9 
Dear foamers,
I have written a facebased source which I would like to include in the UEqn. I assume that this term will automatically multiplied with the cellvolume as it is explicit? As the term corresponds to the integration over the faces it is already scaled with the facemagnitude and does not need to be scaled by the cell volume any more. Therefore I divided the term by the cell volume, but the code does not converge In the following a sketch of the code. HTML Code:
for( label faceI=0; faceI < mesh.nInternalFaces(); faceI++) { label P = owner[faceI]; label N = neighbour[faceI]; rhs[P] = rhs[P] + mesh.Sf()[faceI]*Uf[faceI]*1/mesh.V()[P]; } Thank you very much for an answer. Anne 

June 28, 2013, 08:40 

#13  
Member
Eysteinn Helgason
Join Date: Sep 2009
Location: Gothenburg, Sweden
Posts: 53
Rep Power: 10 
Quote:
Yes it is automatically multiplied with the cell volume. I think you might be looking for the reconstruct operator to get the value in the cell center: Code:
surfaceScalarField phi = fvc::interpolate(U) & mesh.Sf(); volVectorField UfromPhi("UfromPhi",fvc::reconstruct(phi) ); 

July 1, 2013, 10:40 

#14 
Senior Member
Anne Gerdes
Join Date: Aug 2010
Location: Hamburg
Posts: 168
Rep Power: 9 
Thank you, I think I found another reason for the nonconvergence of my code.
Nevertheless this implementation helped me a lot to understand how OpenFOAM treats the source terms. Kind Regards Anne 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
LES solver with variable density for incompressible liquids  matthias  OpenFOAM Running, Solving & CFD  1  April 26, 2010 05:46 
Creating New Solver: For particleladen compressible jets  sankarv  OpenFOAM  0  April 4, 2010 18:06 
An FASMultigrid solver for steady incompressible viscous flow  luca_g  OpenFOAM Running, Solving & CFD  3  September 21, 2009 02:30 
compressible two phase flow in CFX4.4  youngan  CFX  0  July 1, 2003 23:32 
Incompressible flow solver (staggered grid)  J. Ehrhard  Main CFD Forum  1  October 8, 1998 19:47 