CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   SpalartAllmaras question (

egp December 1, 2006 05:43

Hi Foamers, I have question
Hi Foamers,

I have question about running rasInterFoam with the SA model. If I set up the files using FoamX or by copying the damBreak tutorial, I get an error stating that the file "nut" is missing from the 0 directory

--> FOAM FATAL IO ERROR : cannot open file

file: /scratch/egp11/SPNACA2/0/nut at line 0.

If I copy 0/nuTilda to 0/nut, rasInterFoam runs, but the eddy viscosity remains zero, e.g.,

BICCG: Solving for nuTilda, Initial residual = 0, Final residual = 0, No Iterations 0
bounding nuTilda, min: 0 max: 0 average: 0

So what am I missing? I've searched the documentation and the discussion site and was unable to find an answer. I'd appreciate any advice,

Eric Paterson

egp December 2, 2006 14:16

No one has run the SA model?
No one has run the SA model? I figured that I was doing something dumb, and that an answer would be easy.

Help me out, I'm still struggling through Barton and Nackman, and Karniadakis and Kirby (books on C++ for scientific and engineering computing) and am not yet able to understand all the details of how OF works, but am trying to learn by doing.


hjasak December 2, 2006 15:44

I don't know if this is an exe
I don't know if this is an exercise in self-flagelation or you're just trying to be talkative, but anyway: Dr. Paterson, what is your initial value of nut, which is the solution variable for the Spalart-Allmaras model? Is it zero? How did you expect the model to produce turbulence from initial zero nut?

See it now?


egp December 2, 2006 19:04

Hrv, No, I'm not self-flage

No, I'm not self-flagellating or being more talkative than normal.

Yes, my initial condition is zero, and I expect the model (as with any RANS turbulence model) to produce turbulence through the production term. For the SA model, the production term is a function of the vorticity magnitude, which will be generated by the no-slip condition, and in turn produce nuTilda and nut.

If OF requires nonzero nuTilda in the free-stream, then this answers my question. For problems that have practically zero free stream turbulence (e.g., modeling a ship in a towing tank), what would be the recommended initial condition?


hjasak December 3, 2006 05:37

Well, have a look at the gener
Well, have a look at the generation term in RANS model by model.

Gibson-Launder RSTM, as the most general form:

volTensorField P = -(R_ & fvc::grad(U_));

Thus, for no Reynolds stress, you get no production.


volScalarField G = nut_*2*magSqr(symm(fvc::grad(U_)));

nut_ = Cmu*sqr(k_)/(epsilon_ + epsilonSmall_);

So, for zero k you get zero nut_ and zero generation.



This is multiplied by nuTilda, right? So for nuTilda = 0 you get no generation.

It is the same for all models.

Can you tell me which term in the Spalart-Allmaras model will produce turbulence if the original state is zero? I think you have already shown that nuTilda = 0 satisfies the transport equation, which rather proves my point.


egp December 3, 2006 07:00

Hrv, Mea culpa, you are rig

Mea culpa, you are right. Complete brain lock on my part. I had forgotten that the production term (of SA and most other RANS models) has nuTilda in it. That's what happens when you get old, when you try to do 10 things at once, and when you spend too much time as a research manager instead of research performer.

By the way, I went back and looked at the last work I had done using the SA model. There I set free-stream nuTilda to 0.5*nu. I've now done the same with OF and all appears well.

Thanks for the gentle reminder, and for the patience.


rolando April 20, 2007 07:16

Hi everybody, since OpenFOAM-
Hi everybody,
since OpenFOAM-1.3 there is a factor fv3 introduced into the SpalartAllmaras model. It is used for scaling Stilda.
I canīt find any literature about it. Can anyone tell me what this factor is about and where something is published about it?


cedric_duprat April 23, 2007 02:49

Hi Rolando, I read something
Hi Rolando,
I read something about SA model and DES(SA + LES):
"Multiscale and Multiresolution Approaches in Turbulence" P. Sagaut, S. Deck, M. Terracol
Imperial College Press.
it is written that with the initial formulation was optimise (by new fv2, and fv3) to avoid a disturb of r (when Stilda become negative)
you can read also a comparaison between the two models in Deck and al. 2002 Aerospace Science and Technology Vol 6, No 3 171-183

rolando April 23, 2007 03:02

Hi Cedric, thank you very muc
Hi Cedric,
thank you very much for that information.


gdbaldw November 28, 2007 02:58

Has anyone ran rhoSimpleFoam w
Has anyone ran rhoSimpleFoam with SA? After checking all my dimensions, I'm still having the following error:

Selecting turbulence model SpalartAllmaras
Starting time loop
Time = 1

--> FOAM FATAL ERROR : incompatible dimensions for operation
[U[0 1 -2 0 0 0 0] ] + [U[1 -2 -2 0 0 0 0] ]

This seems to indicate that a density term is missing.

Dimensions of my Time 0 files:
mut [1 -1 -1 0 0 0 0]
nuTilda [0 2 -1 0 0 0 0]
p [1 -1 -2 0 0 0 0]
T [0 0 0 1 0 0 0]
U [0 1 -1 0 0 0 0]

fvSolution includes:
nNonOrthogonalCorrectors 0;
pMin pMin [1 -1 -2 0 0 0 0] 100;

SA model in turbulenceProperties is copied from incompressible simpleFoam tutorial, adding:

alphah alphah [0 0 0 0 0 0 0] 0.7;

thermoPhysicalProperties includes:
hThermo<puremixture<consttransport<speciethermo<hc onstthermo<perfectgas>>>>>;

mixture air 1 28.9 1007 0 1.84e-05 0.7;

Also tried rhoTurbFoam which generated the following error:

--> FOAM FATAL ERROR : LHS and RHS of + have different dimensions
dimensions : [1 -1 -3 0 0 0 0] + [0 2 -3 0 0 0 0]

This also seems to indicate that a density term is missing.

Thanks in advance,

gdbaldw November 28, 2007 04:13

nuTildaEqn dimensions in the C
nuTildaEqn dimensions in the Compressible SA C-code appear to be inconsistent.

For the Compressible SA...

tmp<fvscalarmatrix> nuTildaEqn
fvm::ddt(rho_, nuTilda_)
+ fvm::div(phi_, nuTilda_)

But for the Incompressible SA...

tmp<fvscalarmatrix> nuTildaEqn
+ fvm::div(phi_, nuTilda_)

I guess this may be causing the dimensions error of my previous post. Several terms in the compressible nuTildaEqn include rho, while others don't. This seems like a bug to me, but I don't know the correct compressible SA equation to fix it.

Can someone with more experience confirm this observation? Offer a fix?


gdbaldw December 1, 2007 13:36

The answer was to delete phi f
The answer was to delete phi from prior incompressible run. Compressible phi includes density, whereas incompressible phi does not.

shaun February 7, 2008 00:26

Doug could you please provide
Doug could you please provide any information on the specific purpose of the pMin variable that is set in the fvSolution file of rhoSimpleFoam?

I am struggling to get a converged solution in rhoSimpleFoam and initially was getting 'bounding p' statements per iteration. I decreased significantly the pMin value and dropped my under relax factor on p to 0.001 as well as trying to run laminar for a 100 iterations. This seemed to remove the 'bounding p' statement after a few iterations. The laminar model aslo blew up after about 104 iterations.

But I am baffled by pMin importance and how to get my solution to converge with some sort of turbulence included as well as decent under-relax factors that will not restrict the changing of the field variables too much.

Any comments on your experience with pMin and rhoSimpleFoam would be great.

I have posted my setup and explained the problem in a recent post to which i have had no reply yet.

See the post "'bounding p' error using rhoSimpleFoam", if you like.

Thanks for your time.

Regards Shaun.D

gdbaldw February 7, 2008 03:54

Shaun, I found rhoSimpleFoa

I found rhoSimpleFoam to be very sensitive to all of the relaxation factors. As I recall, I added rho to the list of relaxation factors, and I initially set p at 0.001 or maybe 0.0001 and the others in the range of 0.01. It took several hours of babysitting the code and gradually incresing the relaxation factors after every 50 to 100 cycles. If any one factor is increased too quickly, the result became unstable and I'd restart at a prior checkpoint. I also used paraFoam to see the results, with the values of p and v being the best indicators of convergence or lack thereof. magU was also useful as an indicator of convergence. My analysis was at about Mach 0.3, and I've read elsewhere in the forum that this solver works best for subsonic flow. Good luck.


shaun February 7, 2008 06:13

G'day Doug, thanks for the rep
G'day Doug, thanks for the reply.

Your comments make sense with what I have experienced thus far. I.e. the solver is very temperamental.

Have you continued using rhoSimpleFoam since for any other cases perhaps?

With pMin, do understand its function at all?

Cheers and thanks for the quick response.


gdbaldw February 7, 2008 09:41

Shaun, I needed rhoSimpleFo

I needed rhoSimpleFoam for one particular task, completed the work, and have moved on. In the future I would use rhoSimpleFoam again should I need to perform a similar analysis. I never researched the definition or utility of, nor did I adjust pMin. I simply copied pMin from one of the tutorials.


gschaider February 7, 2008 13:24

Hi Shaun&Doug! During the f
Hi Shaun&Doug!

During the first iterations of the solution process it might happen that the pressure drops below reasonable values (sometimes even belw 0!). In older versions of rhoSimpleFoam the solver aborted if the pressure fell between 0 and the user had to specify a lower under-relaxation for p. In newer versions of rhoSimpleFoam, if the pressure falls below pMin it is set to pMin and the solver resumes.


shaun February 7, 2008 17:11

Thank you Bernhard for your co
Thank you Bernhard for your comments and the swiftness of your response.



dabon May 9, 2008 19:21

Hello everyone, I`m trying to
Hello everyone,
I`m trying to use rhoSimpleFoam to solve the flow around a RAE2922 airfoil but, with any tyurbulence model or even if the turbulence model is switch off, I obtain a dimension error between LHS and RHS. I read the previous posts but I`m not able to fix my mistake. Could anyone give me a hint to proceed? Thanks a lot


Exec : rhoSimpleFoam . rae2822a
Date : May 09 2008
Time : 18:14:17
Host :
PID : 25970
Root : /home/dabon/OpenFOAM/dabon-1.4/run/tutorials/rhoSimpleFoam
Case : rae2822a
Nprocs : 1
Create time

Create mesh for time = 0

Reading thermophysical properties

Selecting thermodynamics package hThermo<puremixture<sutherlandtransport<speciether mo<hconstthermo<perfectgas>>>> >
Reading field U

Reading/calculating face flux field phi

Creating turbulence model

Selecting turbulence model LaunderGibsonRSTM

Starting time loop

Time = 1

--> FOAM FATAL ERROR : LHS and RHS of + have different dimensions
dimensions : [0 2 -1 0 0 0 0] + [1 -1 -1 0 0 0 0]
#0 Foam::error::printStack(Foam:
#1 Foam::error::abort()
#2 Foam::operator+(Foam::dimensionSet const&, Foam::dimensionSet const&)
#3 Foam::tmp<foam::geometricfield<foam::typeofsum<dou ble,>::type, Foam::fvPatchField, Foam::volMesh> > Foam::operator+<double,>(Foam::tmp<foam::geometric field<double,> > const&, Foam::GeometricField<double,> const&)
#4 Foam::compressible::turbulenceModel::muEff() const
#5 Foam::compressible::turbulenceModels::LaunderGibso nRSTM::divRhoR(Foam::Geometric Field<foam::vector<double>, Foam::fvPatchField, Foam::volMesh>&) const
#6 main
#7 __libc_start_main
#8 __gxx_personality_v0

From function operator+(const dimensionSet& ds1, const dimensionSet& ds2)
in file dimensionSet/dimensionSet.C at line 379.

ngj May 10, 2008 03:19

Hi Daniele Have you modifie
Hi Daniele

Have you modified your solver? Because the error strongly suggests that you are missing rho in the nominator on the LHS or rho in the denominator on the RHS.

Best regards,


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