
[Sponsors] 
May 6, 2005, 19:48 
I want to solve a equation in

#1 
Member
Luckyluke
Join Date: Mar 2009
Posts: 51
Rep Power: 8 
I want to solve a equation in the original solver 'interFoam' as following:
fvScalarMatrix gammaEqn2 ( fvm::laplacian(gamma) == fvc::div(grdGam) ); gammaEqn2.solve(); Here, gamma is defined in file 'createFields.H': volScalarField gamma ( IOobject ( "gamma", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); While grdGam is my own variable, which is not one of the fluid property variables (U,Pd,Gamma) and can be computed directly from the geometry of fluid interface . Then how should I define grdGam in my code? I am not familiar with the construction of volScalarField object and the IOobject paprameters, e.g. MUST_READ,AUTO_WRITE. I am urgely waiting for your help. 

May 7, 2005, 09:39 
Please give me some advice.
S

#2 
Member
Luckyluke
Join Date: Mar 2009
Posts: 51
Rep Power: 8 
Please give me some advice.
Should I define grdGam like gamma as a flow variable? Then I will create a file named 'grdGam' under \interFoam\damBreak\0\? And modify 'fvScheme'? Thanks. 

May 8, 2005, 08:10 
All correct.
 add your grd

#3 
Super Moderator
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 16 
All correct.
 add your grdGam to createFields.H. Use the same constructor as e.g. gamma or p (if it is a scalar) or e.g. U(if vector).  create a file for it with correct boundary conditions.  edit fvSchemes to define discretisation schemes for your variable. Look at the error messages if you get stuck. 

May 8, 2005, 09:43 
Thanks.
If I don't want to cr

#4 
Member
Luckyluke
Join Date: Mar 2009
Posts: 51
Rep Power: 8 
Thanks.
If I don't want to create additional file for the new grdGam, I define it as a copy of U: volVectorField grdGam("grdGam",U); Then [i] Can the divergence of grdGam be obtained by this code "fvc::div(grdGam)"?? Because I don't edit fvSchemes to define discretisation schemes for grdGam, is there a default scheme for fvc::div? How to modify the discretisation scheme of grdGam under my situation. <ii> I write: fvScalarMatrix Im ( fvm::laplacian(Im)==fvc::div(grdGam) ); Can the code given above be used to get the solution of Im? Many thanks. 

May 8, 2005, 10:41 
Why not try it and see, you wi

#5 
Senior Member
Join Date: Mar 2009
Posts: 854
Rep Power: 13 
Why not try it and see, you will learn much more that way.
There are a large number of example codes supplied with OpenFOAM which will help you understand what is possible, there is also the Doxygen documentation, but the most important thing is that you try things out for yourself, that's by far the best way of learning anything. 

November 11, 2005, 12:55 
Hi,
I resolve the momentum eq

#6 
Member
olivier Petit
Join Date: Mar 2009
Location: Göteborg, Sweden
Posts: 67
Rep Power: 8 
Hi,
I resolve the momentum equation with energy equation. the regime is laminar and steady state. when I couple those equations I have the bad results. the implementation is like that: /************************************************** *************/ tmp<fvvectormatrix> UEqn ( fvm::div(phi, U)  fvm::laplacian(nu,U) ); UEqn().relax(); solve(UEqn() == fvc::grad(p)+F); volScalarField AU = UEqn().A(); U = UEqn().H()/AU; UEqn.clear(); phi = fvc::interpolate(U) & mesh.Sf(); adjustPhi(phi, U, p); ... fvm::laplacian(1/AU, p) == fvc::div(phi) ... if (nonOrth == nNonOrthCorr) { phi = pEqn.flux(); } } p.relax(); U = fvc::grad(p)/AU; U.correctBoundaryConditions(); for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { fvScalarMatrix TEqn ( fvm::div(phi,T) == fvm::laplacian(DT,T) + S ); TEqn.solve(); } /************************************************** **********************/ what's the wrong in this implementation? thank you for your help 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Another way to solve Stokes  lam  OpenFOAM Running, Solving & CFD  2  June 26, 2007 05:54 
To solve my own equation  lam  OpenFOAM Running, Solving & CFD  7  March 30, 2007 03:37 
Help:Two errors in the CFXSOLVE  James  CFX  5  September 28, 2006 16:54 
HOW TO Solve  rambabu.s  Main CFD Forum  4  April 20, 2002 21:30 
Can i solve?  Janice  CFX  2  May 29, 2001 12:40 