CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Difference between codes and representations (http://www.cfd-online.com/Forums/openfoam-solving/65984-difference-between-codes-representations.html)

titio July 2, 2009 11:59

Difference between codes and representations
 
Hi Foamers,

I have a small question concerning relaxation. Is there any difference, when writting the code, between the
following forms of relaxation, when solving the Navier stokes equation for laminar flow of newtonian fluids.

Form 1

fvVector UEqn
(
fvm::ddt(U)
+ fvm::div(phi,U)
- fvm::laplacian(nu,U)
);

UEqn.relax();

solve (UEqn == -fvc:: grad(p));

Form 2

fvVector UEqn()
(
fvm::ddt(U)
+ fvm::div(phi,U)
- fvm::laplacian(nu,U)
);

UEqn().relax();

solve (UEqn() == -fvc:: grad(p));

Is there any significant difference between the two formulations.

Thanks,

Titio

gschaider July 2, 2009 14:10

No. The second UEqn is probably a autoPtr of a fvMatrix.

henrik July 3, 2009 03:32

Hi Titio,

Bernhard is absolutely right.

Form 2 (and Form 1) are quoted incorrectly. Form 2 should read:

tmp<fvVectorMatrix> UEqn
(
fvm::ddt(U)
+ fvm::div(phi,U)
- fvm::laplacian(nu,U)
);

(see simpleFoam)

By using tmp (or alternatively autoPtr) one is able throw away the U-Matrix before solving the p-equation. This way, you can save some peak-memory in steady-state solvers.

Regards, Henrik

gschaider July 3, 2009 07:58

Quote:

Originally Posted by henrik (Post 221324)
Bernhard is absolutely right.

... and to short to be understood. I planned to add a second sentence "This is only an 'administrative' construct and doesn't change the physical meaning of the equation" and obviously forgot that.

But Henrik's answer is better anyway


All times are GMT -4. The time now is 04:57.