CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   what is the role of solve(UEqn == -fvc::grad(p));" in icoFoam pisoFoam and ... (https://www.cfd-online.com/Forums/openfoam/95968-what-role-solve-ueqn-fvc-grad-p-icofoam-pisofoam.html)

mechy January 9, 2012 06:31

what is the role of solve(UEqn == -fvc::grad(p));" in icoFoam pisoFoam and ...
 
Hello All
I could not found the role of term "solve(UEqn == -fvc::grad(p));"
in icoFoam pisoFoam and ...
when I have deactivated this term (insert // befor it) the answer did not changed.
it is worthwhile to notice that if this term calculate algebraic equation for U and find the new U but this new U is not used in the following of the program and term
U = rAU*UEqn.H();
replaced the new value in variable U

Best Regards
Yasser

ata January 10, 2012 05:58

Hi
Are you sure you complied the solver after the commenting, correctly, and did not use converged data as initial data?

mechy January 10, 2012 15:02

Quote:

Originally Posted by ata (Post 338603)
Hi
Are you sure you complied the solver after the commenting, correctly, and did not use converged data as initial data?



Hi ata
yes, I placed a copy of icoFoam to my FOAM_USER_APPBIN and replaced icoFoam to icoFoamMod in directory name, .C file and in Make/files
then run the wclean
then I comment the // solve(UEqn == -fvc::grad(p));
at the end I run wmake and successfully compile icoFoamMod
then Run cavity tutorial using icoFoamMod But the solution is the same for icoFoam

mechy January 10, 2012 15:10

Quote:

Originally Posted by ata (Post 338603)
Hi
Are you sure you complied the solver after the commenting, correctly, and did not use converged data as initial data?



Hi ata
yes, I placed a copy of icoFoam to my FOAM_USER_APPBIN and replaced icoFoam to icoFoamMod in directory name, .C file and in Make/files
then run the wclean
then I comment the // solve(UEqn == -fvc::grad(p));
at the end I run wmake and successfully compile icoFoamMod
then Run cavity tutorial using icoFoamMod But the solution is the same for icoFoam

Bernhard January 10, 2012 16:09

Quote:

Originally Posted by mechy (Post 338443)
Hello All
I could not found the role of term "solve(UEqn == -fvc::grad(p));"
in icoFoam pisoFoam and ...
when I have deactivated this term (insert // befor it) the answer did not changed.
it is worthwhile to notice that if this term calculate algebraic equation for U and find the new U but this new U is not used in the following of the program and term
U = rAU*UEqn.H();
replaced the new value in variable U

Best Regards
Yasser

If you look closely to the pisoFoam solver, you will see that this term is only executed when the momentumPredictor flag is set to true. Please have a look at Hrvoje Jasaks thesis in paragraph 3.8 where most of this is explained. Does ignoring this line have an effect on the convergence rate (check your log files)

ata January 11, 2012 07:15

Hi
Bernhard is right.

mechy January 13, 2012 16:28

Quote:

Originally Posted by Bernhard (Post 338712)
If you look closely to the pisoFoam solver, you will see that this term is only executed when the momentumPredictor flag is set to true. Please have a look at Hrvoje Jasaks thesis in paragraph 3.8 where most of this is explained. Does ignoring this line have an effect on the convergence rate (check your log files)


Hi Dear Bernhard
I check the UEqn.H() and UEqn.A() before and after the solve(UEqn == -fvc::grad(p));
the H is changed but A is not changed. if A and H are functions of U why A is not changed ?
also can you tell me what functions , terms and matrices are create during bellow terms ?
fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(nu, U)


best regards

ata January 14, 2012 01:41

Hi
As you know U.A() is the matrix of coefficient and it changes if phi or nu changes or you use a different scheme for temporal discretization.
Good luck

nandiganavishal January 15, 2012 17:58

Algorithm
 
Dear Foamers,

I would like to know which algorithm the following code represents. Is it PISO or SIMPLE algorithm. Kindly let me know and also the reason for the same.

for (int corr = 0; corr < nCorr; corr++)
{
tmp<fvVectorMatrix> UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(nu, U)

);

UEqn().relax();

eqnResidualU = solve
(
UEqn() == -fvc::grad(p)
).initialResidual();

maxResidual_U = max(eqnResidualU, maxResidual_U);

p.boundaryField().updateCoeffs();
volScalarField rUA = 1.0/UEqn().A();
U = rUA*UEqn().H();
UEqn.clear();
phi = fvc::interpolate(U) & mesh.Sf();
adjustPhi(phi, U, p);

p.storePrevIter();

// Non-orthogonal pressure corrector loop
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::laplacian(rUA, p) == fvc::div(phi)
);

pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();

if (nonOrth == nNonOrthCorr)
{
phi -= pEqn.flux();
}
}

p.relax();

U -= rUA*fvc::grad(p);
U.correctBoundaryConditions();
Info << eqnResidualU << endl;
}

Thanks

Regards

Vishal

mechy January 17, 2012 01:15

Quote:

Originally Posted by nandiganavishal (Post 339452)
Dear Foamers,

I would like to know which algorithm the following code represents. Is it PISO or SIMPLE algorithm. Kindly let me know and also the reason for the same.

for (int corr = 0; corr < nCorr; corr++)
{
tmp<fvVectorMatrix> UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(nu, U)

);

UEqn().relax();

eqnResidualU = solve
(
UEqn() == -fvc::grad(p)
).initialResidual();

maxResidual_U = max(eqnResidualU, maxResidual_U);

p.boundaryField().updateCoeffs();
volScalarField rUA = 1.0/UEqn().A();
U = rUA*UEqn().H();
UEqn.clear();
phi = fvc::interpolate(U) & mesh.Sf();
adjustPhi(phi, U, p);

p.storePrevIter();

// Non-orthogonal pressure corrector loop
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::laplacian(rUA, p) == fvc::div(phi)
);

pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();

if (nonOrth == nNonOrthCorr)
{
phi -= pEqn.flux();
}
}

p.relax();

U -= rUA*fvc::grad(p);
U.correctBoundaryConditions();
Info << eqnResidualU << endl;
}

Thanks

Regards

Vishal


this is the SIMPLE algorithm because it has only one pressure correction during each time step

nandiganavishal January 17, 2012 12:05

Thanks for the reply. In that case I have two queries.

1. SIMPLE algorithm can be used to solve unsteady problems right !!

2. I couldn't understand regarding one pressure correction during each time step you had mentioned. As I saw the PISO algorithm in icoFoam and found almost the same code, except the momentum equation is solved before the " for (int corr=0; corr<nCorr; corr++) loop" Could you clarify what exactly is happening in these algorithms as I couldnt follow from the wikilinks provided to explain these algoritms.

Thanks

Regards

Vishal Nandigana


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