CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   How to change a term of an equation (

dimi July 4, 2007 08:46

Hi I would like to change t

I would like to change the laplacian term in the momentum predictor in sonicFoam.C to get something like :

div( 2*mu (0.5(grad(U)+t.grad(U)) - 1/3*div(U) I) )

Do I have to keep the form of the left-hand side operators : operator(xxx, U) ? like div(phi,U) or can I do something like :

fvc::div(2.0*mu*(symm(fvc::grad(U))-1.0/3.0*fvc::div(U)*I)) ?

When I do that way, I can compile but I can't execute, I obtain this error :

Caught FoamXIOError exception in FoamXCaseServer::main(int argc, char **argv) :
FoamXIOError "Non-optional dictionary entry 'div(2.0*mu*(symm(fvc::grad(U))-1.0/3.0*fvc::div(U)*I))' not found in dictionary\
/home/dbonnet/OpenFOAM/OpenFOAM-1.4/applications/solvers/compressible/nsonicFoam /FoamX/defaults/system/fvSchemes::divSchemes"
File "/home/dbonnet/OpenFOAM/OpenFOAM-1.4/applications/solvers/compressible/nsonicFoa m/FoamX/defaults/system/fvSchemes::divSchemes" starting at line 39 ending at line 44

Thank you


gschaider July 4, 2007 09:08

What you're experiencing is a
What you're experiencing is a FoamX-error (it can't find the correct discretization scheme for your expression).

At first. If your solver differs from the original solver, call it differently (for instance: dimitrisSonicFoam). It saves you a lot of confusion later.
As soon as you have done that it won't work with FoamX anymore. Two solutions:
1. Write cfg-files to support your solver in FoamX
2. Use the solver from the command-line (without FoamX)
Solution 2 is easier (really!). The solver WILL complain about missing entries on fvSchemes of your case, but these can be easily added by hand.


dimi July 4, 2007 09:26

Hi Bernhard and thank you for
Hi Bernhard and thank you for your answer

I had changed the name of the solver "nsonicFoam" instead of "sonicFoam".
I have tried to change the cfg-files, but it doesn't work, I would like to know if it is because of the attributes of the operator which are not the same than operators used for the rest of the programm.
So do you know how to change the the cfg-files to run the case with FoamX ?

Furthermore, when I use the command-line, I get the error :
--> FOAM FATAL IO ERROR : keyword div(2.0*mu*(symm(fvc::grad(U))-1.0/3.0*fvc::div(U)*I)) is undefined in dictionary "/home/dbonnet/OpenFOAM/dbonnet-1.4/run/tutorials/nsonicFoam/testmarche/system/f vSchemes::divSchemes"

Thank you


gschaider July 4, 2007 09:50

Hi Dimitri! No. I once fidd
Hi Dimitri!

No. I once fiddled around with these cfg-files and decided not to do it again if it can be avoided (which doesn't mean that the concept is bad, it's just that I don't use FoamX and it's therefor not worth the effort for me)

Your error: I predicted that in the previous posting. Edit the fvSchemes-file to have an entry in the divSchemes-subdictionary. The format is quite easy to understand (but it is also documented in Chapter 4 of the User Guide)


gschaider July 4, 2007 10:32

<> should be something like li
<> should be something like linear/upwind. <> is just a placeholder (for FoamX I think). There is a whole section in chapter 4 dedicated to the discussion of what is valid for fvSchemes (an absolute must-read if you're working outside of FoamX)

dimi July 4, 2007 10:43

Ok thank you I will work again
Ok thank you I will work again on that.

All times are GMT -4. The time now is 17:37.