CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   explain implications of this comment (https://www.cfd-online.com/Forums/openfoam-programming-development/214540-explain-implications-comment.html)

fedvasu February 4, 2019 23:27

explain implications of this comment
 
Hi Forum,

I am porting my code from OF-6 to OF-dev (latest)

what are the implications of of this commits

https://github.com/OpenFOAM/OpenFOAM...c39005b2091117

https://github.com/OpenFOAM/OpenFOAM...c39005b2091117

mesh.solver is no longer present, then how can i specify that for this equation this particular solver settings, I have two separate pressure equations and I have two different settings in fvSolution but for second equation is constructed using a copy of the original pressure how can I tell OF to use the settings for the other equation?

massive_turbulence February 5, 2019 12:58

Quote:

Originally Posted by fedvasu (Post 723791)
Hi Forum,

I am porting my code from OF-6 to OF-dev (latest)

what are the implications of of this commits

https://github.com/OpenFOAM/OpenFOAM...c39005b2091117

https://github.com/OpenFOAM/OpenFOAM...c39005b2091117

mesh.solver is no longer present, then how can i specify that for this equation this particular solver settings, I have two separate pressure equations and I have two different settings in fvSolution but for second equation is constructed using a copy of the original pressure how can I tell OF to use the settings for the other equation?

It would help if you posted the pressure equations, the fvSolutions and whatever is necessary to see the problem.

fedvasu February 6, 2019 18:19

Quote:

Originally Posted by massive_turbulence (Post 723885)
It would help if you posted the pressure equations, the fvSolutions and whatever is necessary to see the problem.


Quote:

Main pressure equation
Code:

// Pressure corrector
    fvScalarMatrix pEqn
    (
        fvm::ddt(psi, p)
        + fvc::div(phiHbyA)
        - fvm::laplacian(rhorAUf, p)
        ==

        fvOptions(psi, p, rho.name())
    );

    fvOptions.constrain(pEqn);

    pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));

    if (pimple.finalNonOrthogonalIter())
    {
        phi = phiHbyA + pEqn.flux();
    }

Quote:

other pressure equation, variable named pressure
Code:

fvScalarMatrix pressureEqn
            (
                    fvm::laplacian(rhorAUf, pressure)
                    - fvm::ddt(psi, pressure)
                    ==
                Rm_
                //Rm_TA
            );

            pressureEqn.setReference(pressureRefCell, pressureRefValue);
            pressureEqn.solve(mesh_.solver("pressure")); //how would I give this info?

            if (nonOrth == nNonOrthCorr)
            {
                        phiFVstage3 =  -pressureEqn.flux();
            }


massive_turbulence February 6, 2019 19:09

Quote:

Originally Posted by fedvasu (Post 724010)
Code:

// Pressure corrector
    fvScalarMatrix pEqn
    (
        fvm::ddt(psi, p)
        + fvc::div(phiHbyA)
        - fvm::laplacian(rhorAUf, p)
        ==

        fvOptions(psi, p, rho.name())
    );

    fvOptions.constrain(pEqn);

    pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));

    if (pimple.finalNonOrthogonalIter())
    {
        phi = phiHbyA + pEqn.flux();
    }



Code:

fvScalarMatrix pressureEqn
            (
                    fvm::laplacian(rhorAUf, pressure)
                    - fvm::ddt(psi, pressure)
                    ==
                Rm_
                //Rm_TA
            );

            pressureEqn.setReference(pressureRefCell, pressureRefValue);
            pressureEqn.solve(mesh_.solver("pressure")); //how would I give this info?

            if (nonOrth == nNonOrthCorr)
            {
                        phiFVstage3 =  -pressureEqn.flux();
            }


What would be wrong with doing this in the second one

Code:


fvScalarMatrix pressureEqn
            (
                    fvm::laplacian(rhorAUf, pressure)
                    - fvm::ddt(psi, pressure)
                    ==
                fvOptions(???)
            );

fvOptions.constrain(pressureEqn);

Is it because that would only check the same object file as before in the 1st or because you would overwrite variables needed from the 1st call?

fedvasu March 21, 2019 23:44

Quote:

Originally Posted by massive_turbulence (Post 724014)
What would be wrong with doing this in the second one

Code:


fvScalarMatrix pressureEqn
            (
                    fvm::laplacian(rhorAUf, pressure)
                    - fvm::ddt(psi, pressure)
                    ==
                fvOptions(???)
            );

fvOptions.constrain(pressureEqn);

Is it because that would only check the same object file as before in the 1st or because you would overwrite variables needed from the 1st call?

My RHS is not 0 or given through fvOptions.

Anyway it seems, this is a API simplification it seems,
pEqn.solve() will find apply the fvSolution settings for the appropriate variable automatically.

This hasn't affected me at all. (adversley or otherwise).

I would mark this thread solved, if anyone with intimate knowledge of the API can definitively answer this.


All times are GMT -4. The time now is 12:27.