
[Sponsors] 
January 7, 2009, 04:22 
Hi guys,
I am newbie to Ope

#1 
Senior Member
Sandy Lee
Join Date: Mar 2009
Posts: 213
Rep Power: 10 
Hi guys,
I am newbie to OpenFOAM. Could somebody explain the code about gammaEqn in interFoam? surfaceScalarField phic = mag(phi/mesh.magSf());  phi=uf·Sf phic=uf·Sf/Sf=uf ???  phic = min(interface.cGamma()*phic, max(phic));  What is "cGamma"? Where can I find its definition?  surfaceScalarField phir = phic*interface.nHatf();  nHat=grad(Gamma)/mag(grad(Gamma)) nHatf=fvc::interface(nHat) ????  for (int gCorr=0; gCorr<nGammaCorr; gCorr++) { surfaceScalarField phiGamma = fvc::flux ( phi, gamma, gammaScheme ) + fvc::flux ( fvc::flux(phir, scalar(1)  gamma, gammarScheme), gamma, gammarScheme );  What are "fvc::flux" and "gammarScheme"? What is the definition of "phiGamma"?  MULES::explicitSolve(gamma, phi, phiGamma, 1, 0); rhoPhi = phiGamma*(rho1  rho2) + phi*rho2; }  rhoPhi is mass flux (rho·uf·Sf), right? In Rusche's thesis, the indicator equation is solved by Eq.(3.58)or (3.59). Why I can not find this equation in gammaEqn.h ?? Please give me some hint. Thank you in advance. Sandy 

January 7, 2009, 05:54 
Hi guys,
I am newbie to O

#2  
Senior Member
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 12 
Quote:
Let me try to help you. All other readers are welcome to correct me and help both of us. Quote:
phi=uf & Sf (It's the dot product of the velocity at the face and the face vector, I will use & as the dot product) So phic = phi/Sf Quote:
You will find it in fvSolution in the PISO subdictionary. This artificial compression velocity is Ur in (3.58) in Rusche's thesis. So to calculate phir is to calculate phir = Ur & Sf! This is exactly what is done in the following steps! With cGamma=0 you will simply skip the additional compression, with cGamma=1 the gammafield will be solved like (3.58) in Rusche! Quote:
You will find the definitions for nHat and nHatf in the interfaceProperties.C and .H files. nHatf = nHat & Sf ! nHat = grad(gamma)/(grad(gamma) + deltaN) deltaN is a very small stabilization factor in case grad(gamma) will become 0 (the denumerator would be zero without deltaN, which will lead to termination of the program). This is the case outside the transition region of gamma! Quote:
I understand it like this. phiGamma = gamma * (uf & Sf) is the transformed (Gauss theorem) div(u*gamma) in (3.58). When calling it with fvc::flux(phi,gamma,gammaScheme) it will be discreizised using the gammaScheme, which is the scheme used for div(phi,gamma) in the fvSchemes dictionary. Have a look at the very first line in gammaEqn.H. The entry for div(phi,gamma) is assigned to the variable gammaScheme. The same holds for calling fvc::flux(phir,scalar(1)gamma,gammarScheme) which will lead to a discretization of (1gamma)*(Ur & Sf) in (3.58) with the fvScheme for div(phirb,gamma). Calling THIS expression like fvc::flux(THIS,gamma,gammarScheme) leads to a discretization of gamma*(ur & Sf)*(1gamma) Quote:
So after calculating the fluxes MULES will solve them explicitly in time. Quote:
Quote:
Dear Sandy. I hope I could help you and would appreciate and further help from the message board, as this is very interesting for me too. Greetings. Sebastian. Bu
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!" 

June 9, 2009, 14:43 
Thanks Sebastin!

#3 
New Member
Suraj Deshpande
Join Date: Mar 2009
Location: Madison, WI, USA
Posts: 17
Rep Power: 9 
Hello Sebastian,
Thanks for such an elaborate explanation. I was looking exactly for this! Regards, Suraj 

June 30, 2009, 05:22 

#4 
Senior Member
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 9 
MULES::explicitSolve(gamma, phi, phiGamma, 1, 0);
This line means this: gamma: is the actual value to be solved phi: is the normal convective flux phiGamma: U*gamma + gamma*(1gamma)*U 1, 0 : max and min gamma values Please correct me if I am wrong. My doubt is: How can I add a source to this equation? I want to solve this: d(gamma)/dt + div(phigamma) = Source How can I add the source term? Last edited by isabel; June 30, 2009 at 06:49. 

July 29, 2009, 07:48 

#5 
Member
Andreas Dietz
Join Date: Mar 2009
Location: Munich
Posts: 79
Rep Power: 9 
Hi Isabel,
did you succeed in implementing a source term into the gamma equation? And would you share you're knowledge? Best, Andreas 

July 31, 2009, 04:01 

#6 
Senior Member
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 9 
Hi kossity,
There is a tutorial in Internet called "Solve Cavitating flow around a 2D hydrofoil using a user modified version of interPhaseChangeFoam" I have followed that tutorial and tried this: volScalarField Su = source; volScalarField Sp = 0; MULES::implicitSolve(oneField(), gamma, phi, phiGamma, Sp, Su, 1, 0); The problem runs Ok but I don't have good convergence. I don't know if it is because I have set Sp to zero. 

July 31, 2009, 08:01 

#7 
Senior Member
Sandy Lee
Join Date: Mar 2009
Posts: 213
Rep Power: 10 
Hi kossity, try to read gammaEqn.H and pdEqn.H of the interPhaseChangeFoam solver, maybe you will find how to add source term to gamma equation.
Hi isable, why you set Sp = 0? Usually it is not useful because it will lead to be disconvergent. People always try to find a way to discrete the source term linearizing (namely Sp*psi + Su) in order to get the "diagonal predominance" of the matrix. In fact, I also never try to derive this rule , however, it was wrote by every CFD book. 

August 3, 2009, 02:55 

#8 
Senior Member
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 9 
Hi sandy,
My source is cte*(grad(T) & grad(phi)), so I set: volVectorField gradT = fvc::grad(T); volVectorField gradpsi = fvc::grad(psi); Sp = 0; Su = cte*(gradT & gradpsi); I don't know how to discretize Sp in order to became different from zero. 

August 3, 2009, 06:57 

#9  
Member
Andreas Dietz
Join Date: Mar 2009
Location: Munich
Posts: 79
Rep Power: 9 
Quote:
I suppose Isabel is right. Source got to be added in the MULES routine. Finally added some (senseless) source  works. Now it's time to deal with the real source. Last edited by lord_kossity; August 3, 2009 at 11:06. 

August 3, 2009, 15:40 

#10 
Senior Member
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 9 
Hi Kossity,
If you want more information about the gammaEqn, you must real carefully the file MULESTemplates.C 

August 3, 2009, 20:52 

#11  
Senior Member
Sandy Lee
Join Date: Mar 2009
Posts: 213
Rep Power: 10 
Quote:
a: if source term = constant, you need to do nothing; b: if there is a relationship between source term with the variable psi, you can do two ways: 1) if you use the value psi of the last interative step instead of the current varialbe, the source term is still equal to a constant; however, it will lead to a very very slowly iteration, so this method is not available; 2) you can linearize the source term into (Sp*psi + Su). You need to keep Sp <or= 0 in order to get the diagonal predominance. Do you understand clearly? I seldom meet Sp = 0 because source terms are always a fuction relationship with the variable psi. PS: I mean psi = the solved variable in a equation. 

November 7, 2011, 10:34 

#12  
Member
bojiezhang
Join Date: Jan 2010
Posts: 64
Rep Power: 8 
Quote:
I have a problem. I want to add a source like source*psi, and the source is the funcion of runtime. When I use the form like "MULES::explicitSolve(geometricOneField(), alpha1, phi, phiAlpha, source , geometricZeroField() , 1, 0);" the result comes not true, the source fraction become complex at the souce place and the surface become inconsistent. I do not know what is wrong? can you give me some advice! Thank you! bojiezhang 

February 24, 2012, 03:14 
different between mDotp() and mDotAlphal()??

#13 
Member
vahid
Join Date: Feb 2012
Location: MashhadIran
Posts: 80
Rep Power: 5 
Hello OpenFoam users ,
I'm studying on the Kunz model.we know in this model we have two term for mass dest and prod.(m+ and m) What mean mDotAlphal() and mDotP() In interphasechangeFoam? What is the difference between these two? 

February 21, 2014, 05:31 

#14  
New Member
Join Date: Nov 2010
Posts: 10
Rep Power: 8 
Hello FOAMers,
this discussion is old but i hope that someone is still interested... I have a question about the deltaN. Sega said: Quote:
in interfaceProperties.C deltaN is defined as: 1e8/pow(average(alpha1.mesh().V()), 1.0/3.0) so it depends on the Volume. With decresing Volume i.e. with a mesh refinement deltaN gets bigger!? Does that make sense? To me it looks like it could become a not so small constant that could influence the simulation? Has anyone more details about the backround of that formula for deltaN and its influence? Best regards Friederike 

March 19, 2014, 10:30 

#15  
Member
Join Date: Aug 2011
Posts: 83
Rep Power: 7 
Hello,
Quote:
Could anybody comment on this please? It would be very helpful. Anyway: I did two calculations 1 ) rough grid: the average cell volume is 10 m³ > deltaN = 4.6e9 2 ) fine grid: the average cell volume is 0.0001 m³ > deltaN = 2.2e7 So maybe the factor is still small enough not to influence the calculation  but I am not sure about it, because the gradients of alpha are also smaller in finer grid... Thanks a lot for your help 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Transient interFoam with MRF  jaswi  OpenFOAM Running, Solving & CFD  18  October 20, 2011 23:29 
Nonconservative gammaEqn  elisabet  OpenFOAM Running, Solving & CFD  20  April 22, 2009 11:50 
InterFoam  floooo  OpenFOAM Running, Solving & CFD  0  November 3, 2008 12:00 
About interfoam solver  qiu  OpenFOAM Running, Solving & CFD  0  May 6, 2007 22:48 
GammaEqn and UEqn in interFoam  adekian  OpenFOAM Running, Solving & CFD  1  April 11, 2007 02:03 