Skip to content

Commit

Permalink
coupledMultiphaseTemperatureFvPatchScalarField: New BC for multiphase…
Browse files Browse the repository at this point in the history
… CHT cases

Class
    Foam::coupledMultiphaseTemperatureFvPatchScalarField

Description
    Mixed boundary condition for the phase temperature of a phase in an
    Euler-Euler multiphase simulation, to be used for heat-transfer with another
    region in a CHT case.  Optional thin wall material layer resistances can be
    specified through thicknessLayers and kappaLayers entries.

See also
    Foam::coupledTemperatureFvPatchScalarField

The new tutorial case tutorials/modules/CHT/multiphaseCoolingCylinder2D is a
variant of the coolingCylinder2D case in which a 10% oil droplets in water
mixture flows over and cools a hot cylinder.  The case in run with the
foamMultiRun multi-solver executor.
  • Loading branch information
Henry Weller committed Nov 15, 2022
1 parent 5c0265b commit a7d40a4
Show file tree
Hide file tree
Showing 47 changed files with 2,478 additions and 112 deletions.
Expand Up @@ -26,5 +26,6 @@ derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWal
derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C
derivedFvPatchFields/copiedFixedValue/copiedFixedValueFvPatchScalarField.C
derivedFvPatchFields/fixedMultiphaseHeatFlux/fixedMultiphaseHeatFluxFvPatchScalarField.C
derivedFvPatchFields/coupledMultiphaseTemperature/coupledMultiphaseTemperatureFvPatchScalarField.C

LIB = $(FOAM_LIBBIN)/libmultiphaseThermophysicalTransportModels
Expand Up @@ -9,12 +9,15 @@ EXE_INC = \
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/phaseCompressible/lnInclude \
-I$(LIB_SRC)/ThermophysicalTransportModels/thermophysicalTransportModel/lnInclude \
-I$(LIB_SRC)/ThermophysicalTransportModels/coupledThermophysicalTransportModels/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude
-I$(LIB_SRC)/meshTools/lnInclude

LIB_LIBS = \
-lphaseSystem \
-leulerianInterfacialModels \
-leulerianInterfacialCompositionModels \
-lphaseCompressibleMomentumTransportModels
-lphaseCompressibleMomentumTransportModels \
-lphaseFluidMulticomponentThermophysicalTransportModels \
-lcoupledThermophysicalTransportModels
@@ -0,0 +1,196 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/

#include "coupledMultiphaseTemperatureFvPatchScalarField.H"
#include "fvPatchFieldMapper.H"
#include "phaseSystem.H"
#include "compressibleMomentumTransportModels.H"
#include "phaseCompressibleMomentumTransportModel.H"
#include "addToRunTimeSelectionTable.H"

// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //

void Foam::coupledMultiphaseTemperatureFvPatchScalarField::getThis
(
tmp<scalarField>& kappa,
tmp<scalarField>& sumKappaTByDelta,
tmp<scalarField>& sumKappaByDelta,
scalarField& sumq,
tmp<scalarField>& qByKappa
) const
{
// Lookup the fluid model
const phaseSystem& fluid =
patch().boundaryMesh().mesh()
.lookupObject<phaseSystem>(phaseSystem::propertiesName);

scalarField sumKappa(size(), scalar(0));
scalarField sumKappaT(size(), scalar(0));

forAll(fluid.phases(), phasei)
{
const phaseModel& phase = fluid.phases()[phasei];
const fluidThermo& thermo = phase.thermo();

const fvPatchScalarField& Tw =
thermo.T().boundaryField()[patch().index()];

const fvPatchScalarField& alpha =
phase.boundaryField()[patch().index()];

tmp<scalarField> kappaEff(phase.kappaEff(patch().index()));
tmp<scalarField> alphaKappaEff(alpha*kappaEff());

if (&Tw == this)
{
kappa = alphaKappaEff;
qByKappa = sumq/kappaEff;
sumq -= alpha*sumq;
}
else
{
const scalarField T =
thermo.T().boundaryField()[patch().index()]
.patchInternalField();

sumKappa += alphaKappaEff();
sumKappaT += alphaKappaEff*T;
}
}

sumKappaByDelta = sumKappa*patch().deltaCoeffs();
sumKappaTByDelta = sumKappaT*patch().deltaCoeffs();
}


void Foam::coupledMultiphaseTemperatureFvPatchScalarField::getNbr
(
tmp<scalarField>& sumKappaTByDeltaNbr,
tmp<scalarField>& sumKappaByDeltaNbr,
tmp<scalarField>& qNbr
) const
{
// Lookup the fluid model
const phaseSystem& fluid =
patch().boundaryMesh().mesh()
.lookupObject<phaseSystem>(phaseSystem::propertiesName);

scalarField sumKappa(size(), scalar(0));
scalarField sumKappaT(size(), scalar(0));

forAll(fluid.phases(), phasei)
{
const phaseModel& phase = fluid.phases()[phasei];
const fluidThermo& thermo = phase.thermo();

const fvPatchScalarField& alpha =
phase.boundaryField()[patch().index()];

const scalarField T =
thermo.T().boundaryField()[patch().index()].patchInternalField();

const scalarField alphaKappaEff(alpha*phase.kappaEff(patch().index()));

sumKappa += alphaKappaEff;
sumKappaT += alphaKappaEff*T;
}

sumKappaByDeltaNbr = sumKappa*patch().deltaCoeffs();
sumKappaTByDeltaNbr = sumKappaT*patch().deltaCoeffs();
}


void Foam::coupledMultiphaseTemperatureFvPatchScalarField::getNbr
(
tmp<scalarField>& TrefNbr,
tmp<scalarField>& qNbr
) const
{
NotImplemented;
}


// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

Foam::coupledMultiphaseTemperatureFvPatchScalarField::
coupledMultiphaseTemperatureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
coupledTemperatureFvPatchScalarField(p, iF)
{}


Foam::coupledMultiphaseTemperatureFvPatchScalarField::
coupledMultiphaseTemperatureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
coupledTemperatureFvPatchScalarField(p, iF, dict)
{}


Foam::coupledMultiphaseTemperatureFvPatchScalarField::
coupledMultiphaseTemperatureFvPatchScalarField
(
const coupledMultiphaseTemperatureFvPatchScalarField& psf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
coupledTemperatureFvPatchScalarField(psf, p, iF, mapper)
{}


Foam::coupledMultiphaseTemperatureFvPatchScalarField::
coupledMultiphaseTemperatureFvPatchScalarField
(
const coupledMultiphaseTemperatureFvPatchScalarField& psf,
const DimensionedField<scalar, volMesh>& iF
)
:
coupledTemperatureFvPatchScalarField(psf, iF)
{}


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

namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
coupledMultiphaseTemperatureFvPatchScalarField
);
}


// ************************************************************************* //
@@ -0,0 +1,161 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::coupledMultiphaseTemperatureFvPatchScalarField
Description
Mixed boundary condition for the phase temperature of a phase in an
Euler-Euler multiphase simulation, to be used for heat-transfer with another
region in a CHT case. Optional thin wall material layer resistances can be
specified through thicknessLayers and kappaLayers entries.
See also
Foam::coupledTemperatureFvPatchScalarField
SourceFiles
coupledMultiphaseTemperatureFvPatchScalarField.C
\*---------------------------------------------------------------------------*/

#ifndef coupledMultiphaseTemperatureFvPatchScalarField_H
#define coupledMultiphaseTemperatureFvPatchScalarField_H

#include "coupledTemperatureFvPatchScalarField.H"

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

namespace Foam
{

/*---------------------------------------------------------------------------*\
Class coupledMultiphaseTemperatureFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/

class coupledMultiphaseTemperatureFvPatchScalarField
:
public coupledTemperatureFvPatchScalarField
{

protected:

//- Get the patch kappa, sum kappa*Tc/delta and kappa/delta for all phases
// except the phase being solved and also the phase heat-flux obtained by
// partitioning the sum heat-flux provided
virtual void getThis
(
tmp<scalarField>& kappa,
tmp<scalarField>& sumKappaTByDelta,
tmp<scalarField>& sumKappaByDelta,
scalarField& sumq,
tmp<scalarField>& qByKappa
) const;

//- Get the neighbour patch sum kappa*Tc/delta and kappa/delta
// for all phases and the heat-flux correction
virtual void getNbr
(
tmp<scalarField>& sumKappaTByDeltaNbr,
tmp<scalarField>& sumKappaByDeltaNbr,
tmp<scalarField>& qNbr
) const;

//- Get the neighbour patch wall temperature and heat-flux
// when wall thermal resistance is specified
virtual void getNbr
(
tmp<scalarField>& TwNbr,
tmp<scalarField>& qNbr
) const;


public:

//- Runtime type information
TypeName("coupledMultiphaseTemperature");


// Constructors

//- Construct from patch and internal field
coupledMultiphaseTemperatureFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);

//- Construct from patch, internal field and dictionary
coupledMultiphaseTemperatureFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);

//- Construct by mapping given
// coupledMultiphaseTemperatureFvPatchScalarField
// onto a new patch
coupledMultiphaseTemperatureFvPatchScalarField
(
const coupledMultiphaseTemperatureFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);

//- Disallow copy without setting internal field reference
coupledMultiphaseTemperatureFvPatchScalarField
(
const coupledMultiphaseTemperatureFvPatchScalarField&
) = delete;

//- Copy constructor setting internal field reference
coupledMultiphaseTemperatureFvPatchScalarField
(
const coupledMultiphaseTemperatureFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);

//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new coupledMultiphaseTemperatureFvPatchScalarField(*this, iF)
);
}
};


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

} // End namespace Foam

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

#endif

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

0 comments on commit a7d40a4

Please sign in to comment.