mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add support for alpha field in temperatureCoupledBase
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
@ -57,7 +57,14 @@ externalWallHeatFluxTemperatureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
temperatureCoupledBase(patch(), "undefined", "undefined", "undefined-K"),
|
||||
temperatureCoupledBase
|
||||
(
|
||||
patch(),
|
||||
"undefined",
|
||||
"undefined",
|
||||
"undefined-K",
|
||||
"undefined-alpha"
|
||||
),
|
||||
mode_(fixedHeatFlux),
|
||||
Q_(0),
|
||||
q_(),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,7 +43,14 @@ fixedIncidentRadiationFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(p, iF),
|
||||
temperatureCoupledBase(patch(), "undefined", "undefined", "undefined-K"),
|
||||
temperatureCoupledBase
|
||||
(
|
||||
patch(),
|
||||
"undefined",
|
||||
"undefined",
|
||||
"undefined-K",
|
||||
"undefined-alpha"
|
||||
),
|
||||
qrIncident_(p.size(), Zero)
|
||||
{}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,7 +39,14 @@ lumpedMassWallTemperatureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
temperatureCoupledBase(patch(), "undefined", "undefined", "undefined-K"),
|
||||
temperatureCoupledBase
|
||||
(
|
||||
patch(),
|
||||
"undefined",
|
||||
"undefined",
|
||||
"undefined-K",
|
||||
"undefined-alpha"
|
||||
),
|
||||
Cp_(0.0),
|
||||
mass_(0.0),
|
||||
curTimeIndex_(-1)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
@ -53,13 +53,15 @@ Foam::temperatureCoupledBase::temperatureCoupledBase
|
||||
const fvPatch& patch,
|
||||
const word& calculationType,
|
||||
const word& kappaName,
|
||||
const word& alphaAniName
|
||||
const word& alphaAniName,
|
||||
const word& alphaName
|
||||
)
|
||||
:
|
||||
patch_(patch),
|
||||
method_(KMethodTypeNames_[calculationType]),
|
||||
kappaName_(kappaName),
|
||||
alphaAniName_(alphaAniName)
|
||||
alphaAniName_(alphaAniName),
|
||||
alphaName_(alphaName)
|
||||
{}
|
||||
|
||||
|
||||
@ -72,7 +74,8 @@ Foam::temperatureCoupledBase::temperatureCoupledBase
|
||||
patch_(patch),
|
||||
method_(KMethodTypeNames_.get("kappaMethod", dict)),
|
||||
kappaName_(dict.lookupOrDefault<word>("kappa", "none")),
|
||||
alphaAniName_(dict.lookupOrDefault<word>("alphaAni","none"))
|
||||
alphaAniName_(dict.lookupOrDefault<word>("alphaAni","none")),
|
||||
alphaName_(dict.lookupOrDefault<word>("alpha","none"))
|
||||
{
|
||||
switch (method_)
|
||||
{
|
||||
@ -123,15 +126,11 @@ Foam::temperatureCoupledBase::temperatureCoupledBase
|
||||
patch_(patch),
|
||||
method_(base.method_),
|
||||
kappaName_(base.kappaName_),
|
||||
alphaAniName_(base.alphaAniName_)
|
||||
alphaAniName_(base.alphaAniName_),
|
||||
alphaName_(base.alphaName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::temperatureCoupledBase::~temperatureCoupledBase()
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
|
||||
@ -148,48 +147,54 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
|
||||
{
|
||||
typedef compressible::turbulenceModel turbulenceModel;
|
||||
|
||||
const word turbName(turbulenceModel::propertiesName);
|
||||
|
||||
if
|
||||
(
|
||||
mesh.foundObject<turbulenceModel>(turbName)
|
||||
)
|
||||
{
|
||||
const turbulenceModel& turbModel =
|
||||
mesh.lookupObject<turbulenceModel>(turbName);
|
||||
const auto* ptr =
|
||||
mesh.cfindObject<turbulenceModel>
|
||||
(
|
||||
turbulenceModel::propertiesName
|
||||
);
|
||||
|
||||
return turbModel.kappaEff(patchi);
|
||||
if (ptr)
|
||||
{
|
||||
return ptr->kappaEff(patchi);
|
||||
}
|
||||
}
|
||||
else if (mesh.foundObject<fluidThermo>(basicThermo::dictName))
|
||||
{
|
||||
const fluidThermo& thermo =
|
||||
mesh.lookupObject<fluidThermo>(basicThermo::dictName);
|
||||
|
||||
return thermo.kappa(patchi);
|
||||
}
|
||||
else if (mesh.foundObject<basicThermo>(basicThermo::dictName))
|
||||
{
|
||||
const basicThermo& thermo =
|
||||
mesh.lookupObject<basicThermo>(basicThermo::dictName);
|
||||
const auto* ptr =
|
||||
mesh.cfindObject<fluidThermo>(basicThermo::dictName);
|
||||
|
||||
return thermo.kappa(patchi);
|
||||
if (ptr)
|
||||
{
|
||||
return ptr->kappa(patchi);
|
||||
}
|
||||
}
|
||||
else if (mesh.foundObject<basicThermo>("phaseProperties"))
|
||||
{
|
||||
const basicThermo& thermo =
|
||||
mesh.lookupObject<basicThermo>("phaseProperties");
|
||||
|
||||
return thermo.kappa(patchi);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "kappaMethod defined to employ "
|
||||
<< KMethodTypeNames_[method_]
|
||||
<< " method, but thermo package not available"
|
||||
<< exit(FatalError);
|
||||
const auto* ptr =
|
||||
mesh.cfindObject<basicThermo>(basicThermo::dictName);
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
return ptr->kappa(patchi);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const auto* ptr =
|
||||
mesh.cfindObject<basicThermo>("phaseProperties");
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
return ptr->kappa(patchi);
|
||||
}
|
||||
}
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "Using kappaMethod " << KMethodTypeNames_[method_]
|
||||
<< ", but thermo package not available\n"
|
||||
<< exit(FatalError);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -253,9 +258,6 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
|
||||
<< " or volSymmTensorField."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -268,10 +270,155 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
|
||||
<< "and 'kappa' to the name of the volScalar"
|
||||
<< " or volSymmTensor field (if kappaMethod=lookup)"
|
||||
<< exit(FatalError);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return scalarField(0);
|
||||
return scalarField();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::alpha
|
||||
(
|
||||
const scalarField& Tp
|
||||
) const
|
||||
{
|
||||
const fvMesh& mesh = patch_.boundaryMesh().mesh();
|
||||
const label patchi = patch_.index();
|
||||
|
||||
switch (method_)
|
||||
{
|
||||
case mtFluidThermo:
|
||||
{
|
||||
typedef compressible::turbulenceModel turbulenceModel;
|
||||
|
||||
{
|
||||
const auto* ptr =
|
||||
mesh.cfindObject<turbulenceModel>
|
||||
(
|
||||
turbulenceModel::propertiesName
|
||||
);
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
return ptr->alphaEff(patchi);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const auto* ptr =
|
||||
mesh.cfindObject<fluidThermo>(basicThermo::dictName);
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
return ptr->alpha(patchi);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const auto* ptr =
|
||||
mesh.cfindObject<basicThermo>(basicThermo::dictName);
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
return ptr->alpha(patchi);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const auto* ptr =
|
||||
mesh.cfindObject<basicThermo>("phaseProperties");
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
return ptr->alpha(patchi);
|
||||
}
|
||||
}
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "Using kappaMethod " << KMethodTypeNames_[method_]
|
||||
<< ", but thermo package not available\n"
|
||||
<< exit(FatalError);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case mtSolidThermo:
|
||||
{
|
||||
const solidThermo& thermo =
|
||||
mesh.lookupObject<solidThermo>(basicThermo::dictName);
|
||||
|
||||
return thermo.alpha(patchi);
|
||||
break;
|
||||
}
|
||||
|
||||
case mtDirectionalSolidThermo:
|
||||
{
|
||||
const symmTensorField& alphaAni =
|
||||
patch_.lookupPatchField<volSymmTensorField, scalar>
|
||||
(
|
||||
alphaAniName_
|
||||
);
|
||||
|
||||
const vectorField n(patch_.nf());
|
||||
|
||||
return n & alphaAni & n;
|
||||
}
|
||||
|
||||
case mtLookup:
|
||||
{
|
||||
if (mesh.foundObject<volScalarField>(alphaName_))
|
||||
{
|
||||
return
|
||||
patch_.lookupPatchField<volScalarField, scalar>
|
||||
(
|
||||
alphaName_
|
||||
);
|
||||
}
|
||||
else if (mesh.foundObject<volSymmTensorField>(alphaName_))
|
||||
{
|
||||
const symmTensorField& alphaWall =
|
||||
patch_.lookupPatchField<volSymmTensorField, scalar>
|
||||
(
|
||||
alphaName_
|
||||
);
|
||||
|
||||
const vectorField n(patch_.nf());
|
||||
|
||||
return n & alphaWall & n;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Did not find field " << alphaName_
|
||||
<< " on mesh " << mesh.name() << " patch " << patch_.name()
|
||||
<< nl
|
||||
<< "Please set 'kappaMethod' to one of "
|
||||
<< flatOutput(KMethodTypeNames_.sortedToc()) << nl
|
||||
<< "and 'alpha' to the name of the volScalar"
|
||||
<< " or volSymmTensor field (if kappaMethod=lookup)"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unimplemented method " << KMethodTypeNames_[method_] << nl
|
||||
<< "Please set 'kappaMethod' to one of "
|
||||
<< flatOutput(KMethodTypeNames_.sortedToc()) << nl
|
||||
<< "and 'alpha' to the name of the volScalar"
|
||||
<< " or volSymmTensor field (if kappaMethod=lookup)"
|
||||
<< exit(FatalError);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return scalarField();
|
||||
}
|
||||
|
||||
|
||||
@ -280,6 +427,7 @@ void Foam::temperatureCoupledBase::write(Ostream& os) const
|
||||
os.writeEntry("kappaMethod", KMethodTypeNames_[method_]);
|
||||
os.writeEntry("kappa", kappaName_);
|
||||
os.writeEntry("alphaAni", alphaAniName_);
|
||||
os.writeEntry("alpha", alphaName_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
@ -42,10 +42,11 @@ Description
|
||||
|
||||
\par Keywords provided by this class:
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
kappaMethod | Thermal conductivity method | yes |
|
||||
kappa | Name of thermal conductivity field | no | none
|
||||
alphaAni | Name of the non-isotropic alpha | no | Anialpha
|
||||
Property | Description | Required | Default
|
||||
kappaMethod | Thermal conductivity method | yes |
|
||||
kappa | Name of thermal conductivity field | no | none
|
||||
alpha | Name of thermal diffusivity field | no | none
|
||||
alphaAni | Name of non-isotropic alpha | no | none
|
||||
\endtable
|
||||
|
||||
Usage
|
||||
@ -85,7 +86,7 @@ class temperatureCoupledBase
|
||||
{
|
||||
public:
|
||||
|
||||
// Public enumerations
|
||||
// Public Enumerations
|
||||
|
||||
//- Type of supplied Kappa
|
||||
enum KMethodType
|
||||
@ -99,7 +100,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
// Protected Data
|
||||
|
||||
static const Enum<KMethodType> KMethodTypeNames_;
|
||||
|
||||
@ -115,6 +116,9 @@ protected:
|
||||
//- Name of the non-Isotropic alpha (default: Anialpha)
|
||||
const word alphaAniName_;
|
||||
|
||||
//- Name of thermal diffusivity
|
||||
const word alphaName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -126,7 +130,8 @@ public:
|
||||
const fvPatch& patch,
|
||||
const word& calculationMethod,
|
||||
const word& kappaName,
|
||||
const word& alphaAniName
|
||||
const word& alphaAniName,
|
||||
const word& alphaName
|
||||
);
|
||||
|
||||
//- Construct from patch and dictionary
|
||||
@ -136,7 +141,7 @@ public:
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Construct from patch and temperatureCoupledBase
|
||||
//- Construct from patch and temperatureCoupledBase
|
||||
temperatureCoupledBase
|
||||
(
|
||||
const fvPatch& patch,
|
||||
@ -145,7 +150,8 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~temperatureCoupledBase();
|
||||
virtual ~temperatureCoupledBase() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
@ -161,11 +167,20 @@ public:
|
||||
return kappaName_;
|
||||
}
|
||||
|
||||
//- Name of thermal diffusivity field
|
||||
const word& alphaName() const
|
||||
{
|
||||
return alphaName_;
|
||||
}
|
||||
|
||||
//- Given patch temperature calculate corresponding K field
|
||||
virtual tmp<scalarField> kappa(const scalarField& Tp) const;
|
||||
|
||||
//- Given patch temperature calculate corresponding alphaEff field
|
||||
virtual tmp<scalarField> alpha(const scalarField& Tp) const;
|
||||
|
||||
//- Write
|
||||
void write(Ostream&) const;
|
||||
void write(Ostream& os) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
@ -48,7 +48,14 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
temperatureCoupledBase(patch(), "undefined", "undefined", "undefined-K"),
|
||||
temperatureCoupledBase
|
||||
(
|
||||
patch(),
|
||||
"undefined",
|
||||
"undefined",
|
||||
"undefined-K",
|
||||
"undefined-alpha"
|
||||
),
|
||||
TnbrName_("undefined-Tnbr"),
|
||||
thicknessLayers_(0),
|
||||
kappaLayers_(0),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd
|
||||
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
@ -49,7 +49,14 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
temperatureCoupledBase(patch(), "undefined", "undefined", "undefined-K"),
|
||||
temperatureCoupledBase
|
||||
(
|
||||
patch(),
|
||||
"undefined",
|
||||
"undefined",
|
||||
"undefined-K",
|
||||
"undefined-alpha"
|
||||
),
|
||||
TnbrName_("undefined-Tnbr"),
|
||||
qrNbrName_("undefined-qrNbr"),
|
||||
qrName_("undefined-qr"),
|
||||
|
||||
@ -88,7 +88,6 @@ pyrModel() const
|
||||
modelNames.append(iter()->regionMesh().name());
|
||||
}
|
||||
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "Unable to locate pyrolysis region " << pyrolysisRegionName_
|
||||
<< ". Available regions include: " << modelNames
|
||||
@ -108,7 +107,14 @@ filmPyrolysisRadiativeCoupledMixedFvPatchScalarField
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
temperatureCoupledBase(patch(), "undefined", "undefined", "undefined-K"),
|
||||
temperatureCoupledBase
|
||||
(
|
||||
patch(),
|
||||
"undefined",
|
||||
"undefined",
|
||||
"undefined-K",
|
||||
"undefined-alpha"
|
||||
),
|
||||
filmRegionName_("surfaceFilmProperties"),
|
||||
pyrolysisRegionName_("pyrolysisProperties"),
|
||||
TnbrName_("undefined-Tnbr"),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -128,7 +128,14 @@ humidityTemperatureCoupledMixedFvPatchScalarField
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
temperatureCoupledBase(patch(), "fluidThermo", "undefined", "undefined-K"),
|
||||
temperatureCoupledBase
|
||||
(
|
||||
patch(),
|
||||
"fluidThermo",
|
||||
"undefined",
|
||||
"undefined-K",
|
||||
"undefined-alpha"
|
||||
),
|
||||
mode_(mtConstantMass),
|
||||
pName_("p"),
|
||||
UName_("U"),
|
||||
|
||||
Reference in New Issue
Block a user