CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Update on how to implement the temperature equation in interPhaseChangeFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 25, 2022, 09:57
Post Update on how to implement the temperature equation in interPhaseChangeFoam
  #1
New Member
 
Join Date: Jan 2022
Posts: 20
Rep Power: 4
JD_PM is on a distinguished road
Yesterday I posted about the issues I was having while implementing a simple version of the temperature equation in interPhaseChangeFoam (Implementing the temperature equation in interPhaseChangeFoam (OpenFOAM 8 version)) and advanced a bit.

All I did was changing the name of the original solver to interPhaseChangeThermalFoam, change the name of the file phaseChangetwoPhaseMixture to twoPhaseMixtureThermo and modifying the following files

interPhaseChangeThermalFoam.C


Code:
#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "CMULES.H"
#include "subCycle.H"
#include "interfaceProperties.H"
#include "phaseChangeTwoPhaseMixture.H"
#include "kinematicMomentumTransportModel.H"
#include "pimpleControl.H"
#include "fvOptions.H"
#include "CorrectPhi.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
    #include "postProcess.H"

    #include "setRootCaseLists.H"
    #include "createTime.H"
    #include "createDynamicFvMesh.H"
    #include "createDyMControls.H"
    #include "initContinuityErrs.H"
    #include "createFields.H"
    #include "initCorrectPhi.H"
    #include "createUfIfPresent.H"

    turbulence->validate();

    #include "CourantNo.H"
    #include "setInitialDeltaT.H"

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

    Info<< "\nStarting time loop\n" << endl;

    while (pimple.run(runTime))
    {
        #include "readDyMControls.H"

        // Store divU from the previous mesh so that it can be mapped
        // and used in correctPhi to ensure the corrected phi has the
        // same divergence
        volScalarField divU("divU0", fvc::div(fvc::absolute(phi, U)));

        #include "CourantNo.H"
        #include "alphaCourantNo.H"
        #include "setDeltaT.H"

        runTime++;

        Info<< "Time = " << runTime.timeName() << nl << endl;

        // --- Pressure-velocity PIMPLE corrector loop
        while (pimple.loop())
        {
            if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
            {
                mesh.update();

                if (mesh.changing())
                {
                    gh = (g & mesh.C()) - ghRef;
                    ghf = (g & mesh.Cf()) - ghRef;

                    if (correctPhi)
                    {
                        // Calculate absolute flux
                        // from the mapped surface velocity
                        phi = mesh.Sf() & Uf();

                        #include "correctPhi.H"

                        // Make the flux relative to the mesh motion
                        fvc::makeRelative(phi, U);
                    }

                    mixture.correct();

                    if (checkMeshCourantNo)
                    {
                        #include "meshCourantNo.H"
                    }
                }
            }

            divU = fvc::div(fvc::absolute(phi, U));

            surfaceScalarField rhoPhi
            (
                IOobject
                (
                    "rhoPhi",
                    runTime.timeName(),
                    mesh
                ),
                mesh,
                dimensionedScalar(dimMass/dimTime, 0)
            );

            #include "alphaControls.H"
            #include "alphaEqnSubCycle.H"

            mixture.correct();

            #include "UEqn.H"
			#include "TEqn.H"

            // --- Pressure corrector loop
            while (pimple.correct())
            {
                #include "pEqn.H"
            }

            if (pimple.turbCorr())
            {
                turbulence->correct();
            }
        }

        runTime.write();

        Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
            << "  ClockTime = " << runTime.elapsedClockTime() << " s"
            << nl << endl;
    }
    
    Info<< "End\n" << endl;

    return 0;
}

createFields.H


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

Info<< "Reading field U\n" << endl;
volVectorField U
(
    IOobject
    (
        "U",
        runTime.timeName(),
        mesh,
        IOobject::MUST_READ,
        IOobject::AUTO_WRITE
    ),
    mesh
);
//scalar field for the temperature
Info<< "Reading field T\n" << endl;
volVectorField T
(
    IOobject
    (
        "T",
        runTime.timeName(),
        mesh,
        IOobject::MUST_READ, // Must read T from the latest time directory
        IOobject::AUTO_WRITE // Data will be written according to controlDict
    ),
    mesh
);


#include "createPhi.H"


Info<< "Creating phaseChangeTwoPhaseMixture\n" << endl;
autoPtr<phaseChangeTwoPhaseMixture> mixturePtr
(
    phaseChangeTwoPhaseMixture::New(U, phi)
);

phaseChangeTwoPhaseMixture& mixture = mixturePtr();

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)
volScalarField rho
(
    IOobject
    (
        "rho",
        runTime.timeName(),
        mesh,
        IOobject::READ_IF_PRESENT
    ),
    alpha1*rho1 + alpha2*rho2
);
rho.oldTime();


// Construct incompressible turbulence model
autoPtr<incompressible::momentumTransportModel> turbulence
(
    incompressible::momentumTransportModel::New(U, phi, mixture)
);

dimensionedScalar DT
(
	"DT",
	mixture.lookup("DT")
);


#include "readGravitationalAcceleration.H"
#include "readhRef.H"
#include "gh.H"


volScalarField p
(
    IOobject
    (
        "p",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    p_rgh + rho*gh
);

label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell
(
    p,
    p_rgh,
    pimple.dict(),
    pRefCell,
    pRefValue
);

if (p_rgh.needReference())
{
    p += dimensionedScalar
    (
        "p",
        p.dimensions(),
        pRefValue - getRefCellValue(p, pRefCell)
    );
    p_rgh = p - rho*gh;
}

mesh.setFluxRequired(p_rgh.name());
mesh.setFluxRequired(alpha1.name());

#include "createFvOptions.H"

TEqn.H


Code:
fvScalarMatrix TEqn
    (
        fvm::ddt(T) + fvm::div(phi,T) == fvm::laplacian(DT, T)
    );

    TEqn.relax();

    TEqn.solve();

interPhaseChangeThermalFoam/Make/files


Code:
interPhaseChangeThermalFoam.C

EXE = $(FOAM_USER_APPBIN)/interPhaseChangeThermalFoam

interPhaseChangeThermalFoam/Make/options


Code:
EXE_INC = \
    -I. \
    -I$(LIB_SRC)/transportModels/lnInclude \
    -I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \
    -I$(LIB_SRC)/twoPhaseModels/interfaceProperties/lnInclude \
    -I$(LIB_SRC)/twoPhaseModels/incompressibleTwoPhaseMixture/lnInclude \
    -I$(LIB_SRC)/twoPhaseModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude \
    -IphaseChangeTwoPhaseMixtures/lnInclude \
    -ItwoPhaseMixtureThermo/lnInclude \
    -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
    -I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/dynamicFvMesh/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude

EXE_LIBS = \
    -L$(FOAM_USER_LIBBIN) \
    -lphaseChangeTwoPhaseMixtures \
    -ltwoPhaseMixture \
    -lmyTwoPhaseMixtureThermo \
    -linterfaceProperties \
    -ltwoPhaseProperties \
    -lincompressibleTransportModels \
    -lmomentumTransportModels \
    -lincompressibleMomentumTransportModels \
    -lfiniteVolume \
    -ldynamicFvMesh \
    -ltopoChangerFvMesh \
    -lfvOptions \
    -lmeshTools

interPhaseChangeThermalFoam/twoPhaseMixtureThermo/Make/files


Code:
twoPhaseMixtureThermo/phaseChangeTwoPhaseMixture.C
twoPhaseMixtureThermo/phaseChangeTwoPhaseMixtureNew.C
Kunz/Kunz.C
Merkle/Merkle.C
SchnerrSauer/SchnerrSauer.C
ZGB/ZGB.C

LIB = $(FOAM_USER_LIBBIN)/libmyTwoPhaseMixtureThermo

interPhaseChangeThermalFoam/twoPhaseMixtureThermo/Make/options


Code:
EXE_INC = \
    -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
    -I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \
    -I$(LIB_SRC)/twoPhaseModels/interfaceProperties/lnInclude \
	-I$(LIB_SRC)/transportModels/lnInclude \
    -I$(LIB_SRC)/twoPhaseModels/incompressibleTwoPhaseMixture/lnInclude \
    -I$(LIB_SRC)/twoPhaseModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude \
	-I$(LIB_SRC)/finiteVolume/lnInclude

LIB_LIBS = \
    -lfluidThermophysicalModels \
    -limmiscibleIncompressibleTwoPhaseMixture \
    -lspecie \
    -ltwoPhaseMixture \
    -linterfaceProperties \
    -lfiniteVolume
The rest of files stay essentially the same than the interPhaseChangeFoam's solver.

I get the following error when I compile the solver

Code:
TEqn.H: In function ‘int main(int, char**)’:
TEqn.H:7:5: error: no matching function for call to ‘Foam::fvMatrix<double>::fvMatrix(Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > >)’
    7 |     );
      |     ^
In file included from /software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/finiteVolume/lnInclude/fvMatrix.H:1058,
                 from /software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/finiteVolume/lnInclude/ddtScheme.C:29,
                 from /software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/finiteVolume/lnInclude/ddtScheme.H:357,
                 from /software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/finiteVolume/lnInclude/fvcDdt.C:28,
                 from /software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/finiteVolume/lnInclude/fvcDdt.H:250,
                 from /software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/finiteVolume/lnInclude/fvc.H:44,
                 from /software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/finiteVolume/lnInclude/fvCFD.H:8,
                 from interPhaseChangeThermalFoam.C:44:
/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/finiteVolume/lnInclude/fvMatrix.C:405:1: note: candidate: ‘Foam::fvMatrix<Type>::fvMatrix(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, Foam::Istream&) [with Type = double]’
  405 | Foam::fvMatrix<Type>::fvMatrix
      | ^~~~
/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/finiteVolume/lnInclude/fvMatrix.C:405:1: note:   candidate expects 2 arguments, 1 provided
/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/finiteVolume/lnInclude/fvMatrix.C:351:1: note: candidate: ‘Foam::fvMatrix<Type>::fvMatrix(const Foam::tmp<Foam::fvMatrix<Type> >&) [with Type = double]’
  351 | Foam::fvMatrix<Type>::fvMatrix(const tmp<fvMatrix<Type>>& tfvm)
      | ^~~~
/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/finiteVolume/lnInclude/fvMatrix.C:351:59: note:   no known conversion for argument 1 from ‘Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > >’ to ‘const Foam::tmp<Foam::fvMatrix<double> >&’
  351 | Foam::fvMatrix<Type>::fvMatrix(const tmp<fvMatrix<Type>>& tfvm)
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/finiteVolume/lnInclude/fvMatrix.C:322:1: note: candidate: ‘Foam::fvMatrix<Type>::fvMatrix(const Foam::fvMatrix<Type>&) [with Type = double]’
  322 | Foam::fvMatrix<Type>::fvMatrix(const fvMatrix<Type>& fvm)
      | ^~~~
/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/finiteVolume/lnInclude/fvMatrix.C:322:54: note:   no known conversion for argument 1 from ‘Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > >’ to ‘const Foam::fvMatrix<double>&’
  322 | Foam::fvMatrix<Type>::fvMatrix(const fvMatrix<Type>& fvm)
      |                                ~~~~~~~~~~~~~~~~~~~~~~^~~
/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/finiteVolume/lnInclude/fvMatrix.C:267:1: note: candidate: ‘Foam::fvMatrix<Type>::fvMatrix(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::dimensionSet&) [with Type = double]’
  267 | Foam::fvMatrix<Type>::fvMatrix
      | ^~~~
/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/finiteVolume/lnInclude/fvMatrix.C:267:1: note:   candidate expects 2 arguments, 1 provided
make: *** [/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/wmake/rules/General/transform:26: Make/linux64GccDPInt64Opt/interPhaseChangeThermalFoam.o] Error 1
So it seems that the problem is with the temperature equation file.

Any feedback is appreciated.
JD_PM is offline   Reply With Quote

Old   June 25, 2022, 11:37
Post
  #2
New Member
 
Join Date: Jan 2022
Posts: 20
Rep Power: 4
JD_PM is on a distinguished road
I changed the TEqn.H file as follows

Code:
solve
(
	fvm::ddt(T) + fvm::div(phi,T) == fvm::laplacian(DT, T)
);
I compiled the solver and it yielded a new error:

Code:
wmakeLnIncludeAll: running wmakeLnInclude on dependent libraries:
    wmakeLnInclude error: base directory phaseChangeTwoPhaseMixtures/ does not exist
Making dependency list for source file interPhaseChangeThermalFoam.C
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=64 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3  -DNoRepository -ftemplate-depth-100 -I. -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/transportModels/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/twoPhaseModels/twoPhaseMixture/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/twoPhaseModels/interfaceProperties/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/twoPhaseModels/incompressibleTwoPhaseMixture/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/twoPhaseModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude -IphaseChangeTwoPhaseMixtures/lnInclude -ItwoPhaseMixtureThermo/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/MomentumTransportModels/momentumTransportModels/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/MomentumTransportModels/incompressible/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/finiteVolume/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/dynamicFvMesh/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/meshTools/lnInclude -IlnInclude -I. -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/OpenFOAM/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/OSspecific/POSIX/lnInclude   -fPIC -c interPhaseChangeThermalFoam.C -o Make/linux64GccDPInt64Opt/interPhaseChangeThermalFoam.o
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=64 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3  -DNoRepository -ftemplate-depth-100 -I. -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/transportModels/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/twoPhaseModels/twoPhaseMixture/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/twoPhaseModels/interfaceProperties/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/twoPhaseModels/incompressibleTwoPhaseMixture/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/twoPhaseModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude -IphaseChangeTwoPhaseMixtures/lnInclude -ItwoPhaseMixtureThermo/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/MomentumTransportModels/momentumTransportModels/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/MomentumTransportModels/incompressible/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/finiteVolume/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/dynamicFvMesh/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/meshTools/lnInclude -IlnInclude -I. -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/OpenFOAM/lnInclude -I/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/src/OSspecific/POSIX/lnInclude   -fPIC -fuse-ld=bfd -Xlinker --add-needed -Xlinker --no-as-needed Make/linux64GccDPInt64Opt/interPhaseChangeThermalFoam.o -L/software/alternate/opensource/openfoam.user/fc30/8/OpenFOAM-8/platforms/linux64GccDPInt64Opt/lib \
    -L/students/2021/jrodriguez/OpenFOAM/jrodriguez-8/platforms/linux64GccDPInt64Opt/lib -lphaseChangeTwoPhaseMixtures -ltwoPhaseMixture -lmyTwoPhaseMixtureThermo -linterfaceProperties -ltwoPhaseProperties -lincompressibleTransportModels -lmomentumTransportModels -lincompressibleMomentumTransportModels -lfiniteVolume -ldynamicFvMesh -ltopoChangerFvMesh -lfvOptions -lmeshTools -lOpenFOAM -ldl  \
     -lm -o /students/2021/jrodriguez/OpenFOAM/jrodriguez-8/platforms/linux64GccDPInt64Opt/bin/interPhaseChangeThermalFoam
I decided to run it anyway and see if it worked.

I used a tutorial case (cavitatingBullet) and included T boundary condition

T

Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    location    "0";
    object      T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 0 0 1 0 0 0];

internalField   uniform 300;

boundaryField
{
    inlet
    {
        type            zeroGradient;
    }

    outlet
    {
        type            fixedValue;
        value           $internalField;
    }

    walls
    {
        type            symmetry;
    }

    bullet
    {
        type            zeroGradient;
    }
}

fvSchemes


Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

ddtSchemes
{
    default             Euler;
}

interpolationSchemes
{
    default             linear;
}

divSchemes
{
    default             none;
    div(rhoPhi,U)       Gauss linearUpwind grad(U);
    div(phi,T)          Gauss linearUpwind grad(T);
    div(phi,omega)      Gauss linearUpwind grad(omega);
    div(phi,k)          Gauss linearUpwind grad(k);
    div(phi,alpha)  Gauss interfaceCompression vanLeer 1;
    div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}

gradSchemes
{
    default             Gauss linear;
}

laplacianSchemes
{
    default             Gauss linear limited corrected 0.5;
}

snGradSchemes
{
    default             limited corrected 0.5;
}

fvSolution


Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

solvers
{
    "alpha.N2.*"
    {
        nAlphaCorr      2;
        nAlphaSubCycles 1;

        MULESCorr       yes;
        nLimiterIter    5;

        solver          smoothSolver;
        smoother        symGaussSeidel;
        tolerance       1e-8;
        relTol          0;
        maxIter         10;
    };

    "U.*"
    {
        solver          smoothSolver;
        smoother        symGaussSeidel;
        tolerance       1e-6;
        relTol          0;
    };

    T
    {
        solver          smoothSolver;
        smoother        symGaussSeidel;
        tolerance       1e-6;
        relTol          0;
    }

    p_rgh
    {
        solver          GAMG;
        tolerance       1e-8;
        relTol          0.1;

        smoother        DICGaussSeidel;



        maxIter         50;
    };

    p_rghFinal
    {
        solver          PCG;
        preconditioner
        {
            preconditioner  GAMG;

            tolerance       1e-6;
            relTol          0;

            nVcycles        2;

            smoother        DICGaussSeidel;

        };
        tolerance       1e-7;
        relTol          0;
        maxIter         50;
    };

    "pcorr.*"
    {
        $p_rgh;
        relTol          0;
    };

    Phi
    {
        $p_rgh;
        relTol          0;
    };
}

potentialFlow
{
    nNonOrthogonalCorrectors   3;
}

PIMPLE
{
    momentumPredictor           no;
    nOuterCorrectors            1;
    nCorrectors                 3;
    nNonOrthogonalCorrectors    0;
}

relaxationFactors
{
    equations
    {
        ".*"                    1;
    }
}

When I run it I get the following error

Code:
[1] --> FOAM FATAL IO ERROR: 
[1] unexpected class name volScalarField expected volVectorField
    while reading object T
[1] 
[1] file: /nobackup/st/jrodriguez/cavitatingBulletThermoTEST/processor1/0/T at line 15.
[1] 
[1]     From function Foam::Istream& Foam::regIOobject::readStream(const Foam::word&, bool)
[1]     in file db/regIOobject/regIOobjectRead.C at line 172.
[1] 
FOAM parallel run exiting

Any feedback is appreciated.
JD_PM is offline   Reply With Quote

Old   June 28, 2022, 10:45
Default
  #3
New Member
 
Join Date: Jan 2022
Posts: 20
Rep Power: 4
JD_PM is on a distinguished road
The mistake was in the createFields file. Temperature is of course a scalar field.

Code:
//scalar field for the temperature
Info<< "Reading field T\n" << endl;
volScalarField T
(
    IOobject
    (
        "T",
        runTime.timeName(),
        mesh,
        IOobject::MUST_READ, // Must read T from the latest time directory
        IOobject::AUTO_WRITE // Data will be written according to controlDict
    ),
    mesh
);
Now it compiles OK.
JD_PM is offline   Reply With Quote

Old   July 8, 2022, 01:45
Default Temperature for phases
  #4
New Member
 
Prithvi
Join Date: Mar 2022
Location: Darmstadt
Posts: 6
Rep Power: 4
prinux is on a distinguished road
Hi JD_PM,

Thanks for these useful information. I just wanted to know: Are you able to define temperatures for the different phases with this implementation? For example, say your phases are air and water. Are you able to define T.air and T.water initial conditions in the 0 folder of your case files?

Thanks,
Prithvi
prinux is offline   Reply With Quote

Old   July 8, 2022, 02:26
Default
  #5
Member
 
Join Date: Jan 2022
Location: Germany
Posts: 72
Rep Power: 4
überschwupper is on a distinguished road
Quote:
Originally Posted by prinux View Post
Hi JD_PM,

Thanks for these useful information. I just wanted to know: Are you able to define temperatures for the different phases with this implementation? For example, say your phases are air and water. Are you able to define T.air and T.water initial conditions in the 0 folder of your case files?

Thanks,
Prithvi

You can do it by using the thermo libraries for example. But then you have to rewrite your twoPhaseMixture file otherwise you will have redundancies.
überschwupper is offline   Reply With Quote

Old   July 8, 2022, 02:39
Default
  #6
New Member
 
Prithvi
Join Date: Mar 2022
Location: Darmstadt
Posts: 6
Rep Power: 4
prinux is on a distinguished road
Hi überschwupper,

I have copied a library named "twoPhaseMixtureThermo" from compressibleInterFoam to my custom interPhaseChangeFoam directory. Is this what you are talking about? I'm using this because I had observed in the compressibleInterFoam tutorial cases that each phase has it's own T.phase file.

Right now, I have copied this library and I am removing the thermodynamic properties from the libraries that I do not need. Am I going in the right direction?
prinux is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
whats the cause of error? immortality OpenFOAM Running, Solving & CFD 13 March 24, 2021 07:15
Temperature Equation in interFoam claudiocor OpenFOAM Running, Solving & CFD 2 April 30, 2018 09:48
Problem with Velocity Poisson Equation and Vector Potential Poisson Equation mykkujinu2201 Main CFD Forum 1 August 12, 2017 13:15
how to implement this kind of equation keishawillstone OpenFOAM Running, Solving & CFD 2 August 11, 2009 06:01
Transport Equation for temperature variance ameya OpenFOAM Running, Solving & CFD 0 December 5, 2008 01:16


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