- **OpenFOAM Running, Solving & CFD**
(*http://www.cfd-online.com/Forums/openfoam-solving/*)

- - **About the gammaEqn in interFoam**
(*http://www.cfd-online.com/Forums/openfoam-solving/58149-about-gammaeqn-interfoam.html*)

Hi guys,
I am newbie to OpeHi 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 |

Hi guys,
I am newbie to OQuote:
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 sub-dictionary. 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 gamma-field 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:
explicit values of the phi and phir values defined above. 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 (1-gamma)*(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)*(1-gamma) Quote:
So after calculating the fluxes MULES will solve them explicitly in time. Quote:
direct representation of (3.58) can be found in MULES. 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 |

Thanks Sebastin!Hello Sebastian,
Thanks for such an elaborate explanation. I was looking exactly for this! Regards, Suraj |

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*(1-gamma)*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? http://www.cfd-online.com/Forums/ima...ser_online.gif http://www.cfd-online.com/Forums/ima...reputation.gif http://www.cfd-online.com/Forums/ima...ons/report.gif http://www.cfd-online.com/Forums/ima...c/progress.gif http://www.cfd-online.com/Forums/ima...ttons/edit.gif |

Hi Isabel,
did you succeed in implementing a source term into the gamma equation? And would you share you're knowledge? Best, Andreas |

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. |

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 :o, however, it was wrote by every CFD book. |

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. |

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. |

Hi Kossity,
If you want more information about the gammaEqn, you must real carefully the file MULESTemplates.C |

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. |

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 |

different between mDotp() and mDotAlphal()??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? |

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: 1e-8/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 |

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.6e-9 2 ) fine grid: the average cell volume is 0.0001 m³ -> deltaN = 2.2e-7 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 |

All times are GMT -4. The time now is 20:15. |