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/)
-   -   Incompatible dimensionsof pcorr and div(phi) in interFoam (https://www.cfd-online.com/Forums/openfoam-programming-development/233545-incompatible-dimensionsof-pcorr-div-phi-interfoam.html)

Alpha001 February 1, 2021 07:54

Incompatible dimensionsof pcorr and div(phi) in interFoam
 
2 Attachment(s)
Hello,

I use Ubuntu 18.04 LTS.
OpenFOAM v7.

I have added new fields in interFoam in `createFields.H`, and I have renamed the solver as PorousInterFoam.

Code:

Info<< "Reading transportProperties\n" << endl;
immiscibleIncompressibleTwoPhaseMixture mixture(U, phi);

volScalarField& alpha1(mixture.alpha1());
volScalarField& alpha2(mixture.alpha2());

const dimensionedScalar& rho1 = mixture.rho1();
const dimensionedScalar& rho2 = mixture.rho2();


// Need to store rho for ddt(rho, U)
Info<< "Writing field rho \n"
      "\n" << endl;
volScalarField rho
(
    IOobject
    (
        "rho",
        runTime.timeName(),
        mesh,
        IOobject::READ_IF_PRESENT,
        IOobject::AUTO_WRITE
    ),
    alpha1*rho1 + alpha2*rho2
);
rho.oldTime();

Info<< "Writing field mu\n" << endl;
volScalarField mu
(
    IOobject
    (
        "mu",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    mixture.mu()*1.0
);

Info<< "Reading field Volume_Porosity\n" << endl;
volScalarField Volume_Porosity
(
    IOobject
    (
        "Volume_Porosity",
        runTime.timeName(),
        mesh,
        IOobject::MUST_READ,
        IOobject::AUTO_WRITE
    ),
    mesh
);

// GradP is declared after p and p_rgh
Info<< "Reading field GradP\n" << endl;
volVectorField GradP
(
    IOobject
    (
        "GradP",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    fvc::grad(p)
);

I have added the following in PorousInterFoam.C, the solver file.
It is inside pimple loop and after `mixture.correct();`

Code:

mu = mixture.mu();
GradP = fvc::grad(p);

I have a set up a dam break case, with the following changes to `fvSchemes` and
`fvSolutions`.

When I run the case I get the following error due to dimension mismatch:

Code:

--> FOAM FATAL ERROR:

    [pcorr[2 -2 -4 0 0 0 0] ] + [div(phi)[0 0 -1 0 0 0 0] ]

    From function void Foam::checkMethod(const Foam::fvMatrix<Type>&, const Foam::DimensionedField<Type, Foam::volMesh>&, const char*) [with Type = double]
    in file /opt/openfoam7/src/finiteVolume/lnInclude/fvMatrix.C at line 1291.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::error::abort() at ??:?
#2  void Foam::checkMethod<double>(Foam::fvMatrix<double> const&, Foam::DimensionedField<double, Foam::volMesh> const&, char const*) in "/home/prasad/OpenFOAM/prasad-7/platforms/linux64GccDPInt32Opt/bin/PorousInterFoam"
#3  Foam::tmp<Foam::fvMatrix<double> > Foam::operator+<double>(Foam::tmp<Foam::fvMatrix<double> > const&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&) in "/home/prasad/OpenFOAM/prasad-7/platforms/linux64GccDPInt32Opt/bin/PorousInterFoam"
#4  ? in "/home/prasad/OpenFOAM/prasad-7/platforms/linux64GccDPInt32Opt/bin/PorousInterFoam"
#5  ? in "/home/prasad/OpenFOAM/prasad-7/platforms/linux64GccDPInt32Opt/bin/PorousInterFoam"
#6  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#7  ? in "/home/prasad/OpenFOAM/prasad-7/platforms/linux64GccDPInt32Opt/bin/PorousInterFoam"
Aborted (core dumped)

Not really sure where is this dimension mismatch from.
Is it the solver, or the simulation set-up?

Thank you.


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