CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Implicit term in the continuity equation (https://www.cfd-online.com/Forums/openfoam-solving/216103-implicit-term-continuity-equation.html)

pod March 28, 2019 05:33

Implicit term in the continuity equation
 
Hello everyone,
I'm trying to use a continuity equation in chtMultiRegionFoam that looks like it (similarly to the one used in cavitatingFoam):


Code:

fvScalarMatrix rhoEqn
    (
        fvm::ddt(rho)
      + fvm::div(phi2, rho)
      ==
        fvOptions(rho)
    );


which basically has the second term implicit instead of explicit like in normal heat transfer solvers.
I get this known problem:


Code:

valueInternalCoeffs cannot be called for a calculatedFvPatchField
    on patch ...
    You are probably trying to solve for a field with a default boundary condition


I know this comes out if you set "calculated" b.c. type but I think mine should be fine:
in the 0 folder:
Code:

dimensions      [1 -3 0 0 0 0 0];

internalField  uniform 147;

boundaryField
{
    ".*"
    {
        type            zeroGradient;
    }
}


In the fluid part changeDictionary:

Code:

    rho
    {
    internalField  uniform 147;

    boundaryField
    {
        ".*"
        {
        type            zeroGradient;
                value          uniform 147;
        }
    }
    }


does anyone have any idea?
thanks a lot

Tobi March 28, 2019 06:37

Hi,

the density field should be set automatically to calculated as the boundary values are "calculated" from other values. It is not a field like a passive scalar and I donīt think that your density field has zeroGradient patch types - even though you defined it. To check it, just plot rho before your continuity equation.

Furthermore, your equation is a transport equation and not a continuity equation:

\frac{\partial \rho}{\partial t} + \nabla \bullet (\underbrace{\rho \textbf{U}}_{phi2} \rho) = S_{\rho}

This equation looks more like an incompressible transport equation for the density.

pod March 28, 2019 07:56

Hello Tobi,
thanks a lot for your reply.
In reality phi2 is not equal to the definition of phi in heat transfer solvers (rho*U), but it is defined like:
Code:

surfaceScalarField phi2 = (fvc::interpolate(HbyA) & mesh.Sf())
        + rhorAUf*fvc::ddtCorr(U, linearInterpolate(U) & mesh.Sf()) - rhorAUf*mesh.magSf()*fvc::snGrad(p_rgh)/rhof;

in order to resemble the phi of cavitatingFoam, which is actually more similar to phiHbyA of chtMultiFoam. I forgot to mention that, sorry. So it is a continuity equation, right?


Also, the initialization of rho in cavitatingFoam's tutorials is similar to mine:
Code:

dimensions      [1 -3 0 0 0];

internalField  uniform 845;

boundaryField
{
    inlet
    {
        type            fixedValue;
        value          uniform 845;
    }

    outlet
    {
        type            fixedValue;
        value          uniform 835;
    }

    walls
    {
        type            zeroGradient;
    }

    frontBack
    {
        type            zeroGradient;
    }
}

that's why I don't understand what's wrong.
thanks

mAlletto March 29, 2019 13:07

Quote:

Originally Posted by pod (Post 729128)
Hello everyone,
I'm trying to use a continuity equation in chtMultiRegionFoam that looks like it (similarly to the one used in cavitatingFoam):


Code:

fvScalarMatrix rhoEqn
    (
        fvm::ddt(rho)
      + fvm::div(phi2, rho)
      ==
        fvOptions(rho)
    );


which basically has the second term implicit instead of explicit like in normal heat transfer solvers.
I get this known problem:


Code:

valueInternalCoeffs cannot be called for a calculatedFvPatchField
    on patch ...
    You are probably trying to solve for a field with a default boundary condition


I know this comes out if you set "calculated" b.c. type but I think mine should be fine:
in the 0 folder:
Code:

dimensions      [1 -3 0 0 0 0 0];

internalField  uniform 147;

boundaryField
{
    ".*"
    {
        type            zeroGradient;
    }
}


In the fluid part changeDictionary:

Code:

    rho
    {
    internalField  uniform 147;

    boundaryField
    {
        ".*"
        {
        type            zeroGradient;
                value          uniform 147;
        }
    }
    }


does anyone have any idea?
thanks a lot

The error you posted usually appears if the boundary condition is unknown. Did you try to remove the value under zeroGradient?


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