solidDisplacementFoam: Updated thermophysical property handling to use solidDisplacementThermo

derived from solidThermo.  This allows the standard heat transfer boundary
conditions, for example externalWallHeatFluxTemperature, to be used with
solidDisplacementFoam and also significantly simplifies the code.

Additionally solidDisplacementFoam and solidEquilibriumDisplacementFoam have
been updated to handle spatially varying physical properties in a conservative
manner both for the stress and heat transfer.  This means that the stress field
sigma is now dynamic rather than kinematic as it was previously.  For uniform
property fields the behaviour of the solvers is the same as it was before this
update.
This commit is contained in:
Henry Weller
2019-10-30 15:17:34 +00:00
parent ba6b55e388
commit 640027e73a
35 changed files with 1149 additions and 638 deletions

View File

@ -0,0 +1,12 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
wmake $targetType solidDisplacementThermo
wmake $targetType
wmake $targetType solidEquilibriumDisplacementFoam
#------------------------------------------------------------------------------

View File

@ -1,11 +1,16 @@
EXE_INC = \
-I. \
-IsolidDisplacementThermo \
-IderivedFvPatchFields/tractionDisplacement \
-IderivedFvPatchFields/hydrostaticDisplacement \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lsolidThermo \
-lsolidDisplacementThermo \
-lfvOptions \
-lmeshTools

View File

@ -1,39 +1,39 @@
if (runTime.writeTime())
if (runTime.writeTime())
{
volSymmTensorField sigma
(
IOobject
(
"sigma",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
rho*sigmaD
);
if (thermo.thermalStress())
{
volSymmTensorField sigma
(
IOobject
(
"sigma",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
rho*sigmaD
);
if (thermalStress)
{
const volScalarField& T = Tptr();
sigma = sigma - I*(rho*threeKalpha*T);
}
volScalarField sigmaEq
(
IOobject
(
"sigmaEq",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
sqrt((3.0/2.0)*magSqr(dev(sigma)))
);
Info<< "Max sigmaEq = " << max(sigmaEq).value()
<< endl;
runTime.write();
const volScalarField& T = Tptr();
sigma = sigma - I*(rho*threeKalpha*T);
}
volScalarField sigmaEq
(
IOobject
(
"sigmaEq",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
sqrt((3.0/2.0)*magSqr(dev(sigma)))
);
Info<< "Max sigmaEq = " << max(sigmaEq).value()
<< endl;
runTime.write();
}

View File

@ -0,0 +1 @@
const volScalarField& rho(thermo.rho());

View File

@ -1,6 +1,5 @@
#include "readMechanicalProperties.H"
#include "readThermalProperties.H"
mesh.Sf();
#include "readThermophysicalProperties.H"
Info<< "Reading field D\n" << endl;
volVectorField D
(
@ -18,7 +17,7 @@ volVectorField D
autoPtr<volScalarField> Tptr(nullptr);
if (thermalStress)
if (thermo.thermalStress())
{
Info<< "Reading field T\n" << endl;
Tptr.reset

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "tractionDisplacementFvPatchVectorField.H"
#include "volFields.H"
#include "solidDisplacementThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -138,59 +138,50 @@ void Foam::tractionDisplacementFvPatchVectorField::updateCoeffs()
return;
}
const dictionary& mechanicalProperties =
db().lookupObject<IOdictionary>("mechanicalProperties");
const label patchi = patch().index();
const dictionary& thermalProperties =
db().lookupObject<IOdictionary>("thermalProperties");
const solidDisplacementThermo& thermo =
db().lookupObject<solidDisplacementThermo>
(
solidDisplacementThermo::dictName
);
const scalarField& E = thermo.E(patchi);
const scalarField& nu = thermo.nu(patchi);
const fvPatchField<scalar>& rho =
patch().lookupPatchField<volScalarField, scalar>("rho");
const scalarField mu(E/(2.0*(1.0 + nu)));
const scalarField lambda
(
thermo.planeStress()
? nu*E/((1 + nu)*(1 - nu))
: nu*E/((1 + nu)*(1 - 2*nu))
);
const scalarField threeK
(
thermo.planeStress()
? E/(1 - nu)
: E/(1 - 2*nu)
);
const fvPatchField<scalar>& rhoE =
patch().lookupPatchField<volScalarField, scalar>("E");
const scalarField twoMuLambda(2*mu + lambda);
const fvPatchField<scalar>& nu =
patch().lookupPatchField<volScalarField, scalar>("nu");
scalarField E(rhoE/rho);
scalarField mu(E/(2.0*(1.0 + nu)));
scalarField lambda(nu*E/((1.0 + nu)*(1.0 - 2.0*nu)));
scalarField threeK(E/(1.0 - 2.0*nu));
Switch planeStress(mechanicalProperties.lookup("planeStress"));
if (planeStress)
{
lambda = nu*E/((1.0 + nu)*(1.0 - nu));
threeK = E/(1.0 - nu);
}
scalarField twoMuLambda(2*mu + lambda);
vectorField n(patch().nf());
const vectorField n(patch().nf());
const fvPatchField<symmTensor>& sigmaD =
patch().lookupPatchField<volSymmTensorField, symmTensor>("sigmaD");
gradient() =
(
(traction_ - pressure_*n)/rho
(traction_ - pressure_*n)
+ twoMuLambda*fvPatchField<vector>::snGrad() - (n & sigmaD)
)/twoMuLambda;
Switch thermalStress(thermalProperties.lookup("thermalStress"));
if (thermalStress)
if (thermo.thermalStress())
{
const fvPatchField<scalar>& threeKalpha=
patch().lookupPatchField<volScalarField, scalar>("threeKalpha");
const scalarField& alphav = thermo.alphav(patchi);
const fvPatchField<scalar>& T =
patch().lookupPatchField<volScalarField, scalar>("T");
gradient() += n*threeKalpha*T/twoMuLambda;
gradient() +=
n*threeK*alphav*thermo.T().boundaryField()[patchi]/twoMuLambda;
}
fixedGradientFvPatchVectorField::updateCoeffs();

View File

@ -1,196 +0,0 @@
Info<< "Reading mechanical properties\n" << endl;
IOdictionary mechanicalProperties
(
IOobject
(
"mechanicalProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
const dictionary& rhoDict(mechanicalProperties.subDict("rho"));
word rhoType(rhoDict.lookup("type"));
autoPtr<volScalarField> rhoPtr;
IOobject rhoIO
(
"rho",
runTime.timeName(0),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
);
if (rhoType == "uniform")
{
scalar rhoValue(readScalar(rhoDict.lookup("value")));
rhoPtr.reset
(
new volScalarField
(
rhoIO,
mesh,
dimensionedScalar
(
dimMass/dimVolume,
rhoValue
)
)
);
}
else if (rhoType == "field")
{
rhoIO.readOpt() = IOobject::MUST_READ;
rhoPtr.reset
(
new volScalarField
(
rhoIO,
mesh
)
);
}
else
{
FatalErrorInFunction
<< "Valid type entries are uniform or field for rho"
<< abort(FatalError);
}
volScalarField& rho = rhoPtr();
const dictionary& EDict(mechanicalProperties.subDict("E"));
word EType(EDict.lookup("type"));
autoPtr<volScalarField> EPtr;
IOobject EHeader
(
"E",
runTime.timeName(0),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
);
if (EType == "uniform")
{
scalar rhoEValue(readScalar(EDict.lookup("value")));
EPtr.reset
(
new volScalarField
(
EHeader,
mesh,
dimensionedScalar
(
dimMass/dimLength/sqr(dimTime),
rhoEValue
)
)
);
}
else if (EType == "field")
{
EHeader.readOpt() = IOobject::MUST_READ;
EPtr.reset
(
new volScalarField
(
EHeader,
mesh
)
);
}
else
{
FatalErrorInFunction
<< "Valid type entries are uniform or field for E"
<< abort(FatalError);
}
volScalarField& rhoE = EPtr();
autoPtr<volScalarField> nuPtr;
IOobject nuIO
(
"nu",
runTime.timeName(0),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
);
const dictionary& nuDict(mechanicalProperties.subDict("nu"));
word nuType(nuDict.lookup("type"));
if (nuType == "uniform")
{
scalar nuValue(readScalar(nuDict.lookup("value")));
nuPtr.reset
(
new volScalarField
(
nuIO,
mesh,
dimensionedScalar
(
dimless,
nuValue
)
)
);
}
else if (nuType == "field")
{
nuIO.readOpt() = IOobject::MUST_READ;
nuPtr.reset
(
new volScalarField
(
nuIO,
mesh
)
);
}
else
{
FatalErrorInFunction
<< "Valid type entries are uniform or field for nu"
<< abort(FatalError);
}
volScalarField& nu = nuPtr();
Info<< "Normalising E : E/rho\n" << endl;
volScalarField E(rhoE/rho);
Info<< "Calculating Lame's coefficients\n" << endl;
volScalarField mu(E/(2.0*(1.0 + nu)));
volScalarField lambda(nu*E/((1.0 + nu)*(1.0 - 2.0*nu)));
volScalarField threeK(E/(1.0 - 2.0*nu));
Switch planeStress(mechanicalProperties.lookup("planeStress"));
if (planeStress)
{
Info<< "Plane Stress\n" << endl;
lambda = nu*E/((1.0 + nu)*(1.0 - nu));
threeK = E/(1.0 - nu);
}
else
{
Info<< "Plane Strain\n" << endl;
}

View File

@ -1,219 +0,0 @@
Info<< "Reading thermal properties\n" << endl;
IOdictionary thermalProperties
(
IOobject
(
"thermalProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
Switch thermalStress(thermalProperties.lookup("thermalStress"));
volScalarField threeKalpha
(
IOobject
(
"threeKalpha",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar(dimensionSet(0, 2, -2 , -1, 0), 0)
);
volScalarField DT
(
IOobject
(
"DT",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar(dimensionSet(0, 2, -1 , 0, 0), 0)
);
// Cache "k" for use in thermal BCs
autoPtr<volScalarField> rhoKPtr;
if (thermalStress)
{
IOobject CIO
(
"C",
runTime.timeName(0),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
);
autoPtr<volScalarField> CPtr;
const dictionary& CDict(thermalProperties.subDict("C"));
word CType(CDict.lookup("type"));
if (CType == "uniform")
{
scalar CValue(readScalar(CDict.lookup("value")));
CPtr.reset
(
new volScalarField
(
CIO,
mesh,
dimensionedScalar
(
dimensionSet(0, 2, -2 , -1, 0),
CValue
)
)
);
}
else if (CType == "field")
{
CIO.readOpt() = IOobject::MUST_READ;
CPtr.reset
(
new volScalarField
(
CIO,
mesh
)
);
}
else
{
FatalErrorInFunction
<< "Valid type entries are uniform or field for C"
<< abort(FatalError);
}
volScalarField& C = CPtr();
IOobject rhoKIO
(
"k",
runTime.timeName(0),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
);
const dictionary& kDict(thermalProperties.subDict("k"));
word kType(kDict.lookup("type"));
if (kType == "uniform")
{
scalar rhoKValue(readScalar(kDict.lookup("value")));
rhoKPtr.reset
(
new volScalarField
(
rhoKIO,
mesh,
dimensionedScalar
(
dimensionSet(1, 1, -3 , -1, 0),
rhoKValue
)
)
);
}
else if (kType == "field")
{
rhoKIO.readOpt() = IOobject::MUST_READ;
rhoKPtr.reset
(
new volScalarField
(
rhoKIO,
mesh
)
);
}
else
{
FatalErrorInFunction
<< "Valid type entries are uniform or field for K"
<< abort(FatalError);
}
volScalarField& rhoK = rhoKPtr();
autoPtr<volScalarField> alphaPtr;
IOobject alphaIO
(
"alpha",
runTime.timeName(0),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
);
const dictionary& alphaDict(thermalProperties.subDict("alpha"));
word alphaType(alphaDict.lookup("type"));
if (alphaType == "uniform")
{
scalar alphaValue(readScalar(alphaDict.lookup("value")));
alphaPtr.reset
(
new volScalarField
(
alphaIO,
mesh,
dimensionedScalar
(
inv(dimTemperature),
alphaValue
)
)
);
}
else if (alphaType == "field")
{
alphaIO.readOpt() = IOobject::MUST_READ;
alphaPtr.reset
(
new volScalarField
(
alphaIO,
mesh
)
);
}
else
{
FatalErrorInFunction
<< "Valid type entries are uniform or field for alpha"
<< abort(FatalError);
}
volScalarField& alpha = alphaPtr();
Info<< "Normalising k : k/rho\n" << endl;
volScalarField k(rhoK/rho);
Info<< "Calculating thermal coefficients\n" << endl;
threeKalpha = threeK*alpha;
DT = k/C;
}

View File

@ -0,0 +1,29 @@
Info<< "Reading thermophysical properties\n" << endl;
solidDisplacementThermo thermo(mesh);
const volScalarField& E(thermo.E());
const volScalarField& nu(thermo.nu());
const volScalarField Cp(thermo.Cp());
const volScalarField kappa(thermo.kappa());
Info<< "Calculating Lame's coefficients\n" << endl;
const volScalarField mu(E/(2*(1 + nu)));
const volScalarField lambda
(
thermo.planeStress()
? nu*E/((1 + nu)*(1 - nu))
: nu*E/((1 + nu)*(1 - 2*nu))
);
const volScalarField threeK
(
thermo.planeStress()
? E/(1 - nu)
: E/(1 - 2*nu)
);
const volScalarField threeKalpha("threeKalpha", threeK*thermo.alphav());

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,8 +36,8 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "solidDisplacementThermo.H"
#include "fvOptions.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -50,6 +50,7 @@ int main(int argc, char *argv[])
#include "createMesh.H"
#include "createControls.H"
#include "createFields.H"
#include "createFieldRefs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -66,12 +67,14 @@ int main(int argc, char *argv[])
do
{
if (thermalStress)
if (thermo.thermalStress())
{
volScalarField& T = Tptr();
fvScalarMatrix TEqn
(
fvm::ddt(T) == fvm::laplacian(DT, T) + fvOptions(T)
fvm::ddt(rho, Cp, T)
== fvm::laplacian(kappa, T)
+ fvOptions(rho*Cp, T)
);
fvOptions.constrain(TEqn);
@ -84,14 +87,14 @@ int main(int argc, char *argv[])
{
fvVectorMatrix DEqn
(
fvm::d2dt2(D)
fvm::d2dt2(rho, D)
==
fvm::laplacian(2*mu + lambda, D, "laplacian(DD,D)")
+ divSigmaExp
+ fvOptions.d2dt2(D)
+ rho*fvOptions.d2dt2(D)
);
if (thermalStress)
if (thermo.thermalStress())
{
const volScalarField& T = Tptr();
DEqn += fvc::grad(threeKalpha*T);

View File

@ -0,0 +1,3 @@
solidDisplacementThermo.C
LIB = $(FOAM_LIBBIN)/libsolidDisplacementThermo

View File

@ -0,0 +1,8 @@
EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lsolidThermo

View File

@ -0,0 +1,515 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019 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 "solidDisplacementThermo.H"
#include "fvMesh.H"
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
namespace Foam
{
defineTypeNameAndDebug(solidDisplacementThermo, 0);
}
void Foam::solidDisplacementThermo::readProperty(volScalarField& prop) const
{
const dictionary& propDict(subDict(prop.name()));
const word propType(propDict.lookup("type"));
if (propType == "uniform")
{
prop == dimensionedScalar
(
prop.name(),
prop.dimensions(),
readScalar(propDict.lookup("value"))
);
}
else if (propType == "field")
{
const volScalarField propField
(
IOobject
(
prop.name(),
prop.mesh().time().timeName(0),
prop.mesh(),
IOobject::MUST_READ,
IOobject::NO_WRITE
),
prop.mesh()
);
prop == propField;
}
else
{
FatalErrorInFunction
<< "Valid type entries are uniform or field for " << prop.name()
<< abort(FatalError);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solidDisplacementThermo::solidDisplacementThermo
(
const fvMesh& mesh,
const word& phaseName
)
:
solidThermo(mesh, phaseName),
planeStress_(lookup("planeStress")),
thermalStress_(lookup("thermalStress")),
Cp_
(
IOobject
(
phasePropertyName("Cp"),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass/dimTemperature
),
kappa_
(
IOobject
(
phasePropertyName("kappa"),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
Cp_.dimensions()*dimensionSet(1, -1, -1, 0, 0)
),
E_
(
IOobject
(
phasePropertyName("E"),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimPressure
),
nu_
(
IOobject
(
phasePropertyName("nu"),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimless
),
alphav_
(
IOobject
(
phasePropertyName("alphav"),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimless/dimTemperature
)
{
readProperty(rho_);
readProperty(Cp_);
readProperty(kappa_);
readProperty(E_);
readProperty(nu_);
readProperty(alphav_);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::solidDisplacementThermo::~solidDisplacementThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField> Foam::solidDisplacementThermo::rho() const
{
return rho_;
}
Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::rho
(
const label patchi
) const
{
return rho_.boundaryField()[patchi];
}
const Foam::volScalarField& Foam::solidDisplacementThermo::E() const
{
return E_;
}
const Foam::scalarField& Foam::solidDisplacementThermo::E
(
const label patchi
) const
{
return E_.boundaryField()[patchi];
}
const Foam::volScalarField& Foam::solidDisplacementThermo::nu() const
{
return nu_;
}
const Foam::scalarField& Foam::solidDisplacementThermo::nu
(
const label patchi
) const
{
return nu_.boundaryField()[patchi];
}
const Foam::volScalarField& Foam::solidDisplacementThermo::alphav() const
{
return alphav_;
}
const Foam::scalarField& Foam::solidDisplacementThermo::alphav
(
const label patchi
) const
{
return alphav_.boundaryField()[patchi];
}
Foam::volScalarField& Foam::solidDisplacementThermo::he()
{
NotImplemented;
return rho_;
}
const Foam::volScalarField& Foam::solidDisplacementThermo::he() const
{
NotImplemented;
return rho_;
}
Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::he
(
const scalarField& T,
const labelList& cells
) const
{
NotImplemented;
return tmp<scalarField>(nullptr);
}
Foam::tmp<Foam::volScalarField> Foam::solidDisplacementThermo::he
(
const volScalarField& p,
const volScalarField& T
) const
{
NotImplemented;
return tmp<volScalarField>(nullptr);
}
Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::he
(
const scalarField& T,
const label patchi
) const
{
NotImplemented;
return tmp<scalarField>(nullptr);
}
Foam::tmp<Foam::volScalarField> Foam::solidDisplacementThermo::ha() const
{
NotImplemented;
return tmp<volScalarField>(nullptr);
}
Foam::tmp<Foam::volScalarField> Foam::solidDisplacementThermo::ha
(
const volScalarField& p,
const volScalarField& T
) const
{
NotImplemented;
return tmp<volScalarField>(nullptr);
}
Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::ha
(
const scalarField& T,
const label patchi
) const
{
NotImplemented;
return tmp<scalarField>(nullptr);
}
Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::ha
(
const scalarField& T,
const labelList& cells
) const
{
NotImplemented;
return tmp<scalarField>(nullptr);
}
Foam::tmp<Foam::volScalarField> Foam::solidDisplacementThermo::hc() const
{
NotImplemented;
return tmp<volScalarField>(nullptr);
}
Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::THE
(
const scalarField& he,
const scalarField& T0,
const labelList& cells
) const
{
NotImplemented;
return tmp<scalarField>(nullptr);
}
Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::THE
(
const scalarField& he,
const scalarField& T0,
const label patchi
) const
{
NotImplemented;
return tmp<scalarField>(nullptr);
}
Foam::tmp<Foam::volScalarField> Foam::solidDisplacementThermo::Cp() const
{
return Cp_;
}
Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::Cp
(
const scalarField& T,
const label patchi
) const
{
return Cp_.boundaryField()[patchi];
}
Foam::tmp<Foam::volScalarField> Foam::solidDisplacementThermo::Cv() const
{
return Cp_;
}
Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::Cv
(
const scalarField& T,
const label patchi
) const
{
return Cp_.boundaryField()[patchi];
}
Foam::tmp<Foam::volScalarField> Foam::solidDisplacementThermo::Cpv() const
{
return Cp_;
}
Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::Cpv
(
const scalarField& T,
const label patchi
) const
{
return Cp_.boundaryField()[patchi];
}
Foam::tmp<Foam::volScalarField> Foam::solidDisplacementThermo::CpByCpv() const
{
NotImplemented;
return tmp<volScalarField>(nullptr);
}
Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::CpByCpv
(
const scalarField& T,
const label patchi
) const
{
NotImplemented;
return tmp<scalarField>(nullptr);
}
Foam::tmp<Foam::volScalarField> Foam::solidDisplacementThermo::kappa() const
{
return kappa_;
}
Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::kappa
(
const label patchi
) const
{
return kappa_.boundaryField()[patchi];
}
Foam::tmp<Foam::volScalarField> Foam::solidDisplacementThermo::alphahe() const
{
NotImplemented;
return tmp<volScalarField>(nullptr);
}
Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::alphahe
(
const label patchi
) const
{
NotImplemented;
return tmp<scalarField>(nullptr);
}
Foam::tmp<Foam::volScalarField> Foam::solidDisplacementThermo::kappaEff
(
const volScalarField& alphat
) const
{
NotImplemented;
return tmp<volScalarField>(nullptr);
}
Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::kappaEff
(
const scalarField& alphat,
const label patchi
) const
{
NotImplemented;
return tmp<scalarField>(nullptr);
}
Foam::tmp<Foam::volScalarField> Foam::solidDisplacementThermo::alphaEff
(
const volScalarField& alphat
) const
{
NotImplemented;
return tmp<volScalarField>(nullptr);
}
Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::alphaEff
(
const scalarField& alphat,
const label patchi
) const
{
NotImplemented;
return tmp<scalarField>(nullptr);
}
Foam::tmp<Foam::volVectorField> Foam::solidDisplacementThermo::Kappa() const
{
NotImplemented;
return tmp<volVectorField>(nullptr);
}
Foam::tmp<Foam::vectorField> Foam::solidDisplacementThermo::Kappa
(
const label patchi
) const
{
NotImplemented;
return tmp<vectorField>(nullptr);
}
void Foam::solidDisplacementThermo::correct()
{}
bool Foam::solidDisplacementThermo::read()
{
return regIOobject::read();
}
// ************************************************************************* //

View File

@ -0,0 +1,358 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019 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::solidDisplacementThermo
Description
Fundamental solid thermodynamic properties
SourceFiles
solidDisplacementThermo.C
\*---------------------------------------------------------------------------*/
#ifndef solidDisplacementThermo_H
#define solidDisplacementThermo_H
#include "solidThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class solidDisplacementThermo Declaration
\*---------------------------------------------------------------------------*/
class solidDisplacementThermo
:
public solidThermo
{
// Private data
//- Switch to enable plane stress
Switch planeStress_;
//- Switch to enable thermal stress
Switch thermalStress_;
//- Heat capacity at constant pressure [J/kg/K]
volScalarField Cp_;
//- Thermal diffusivity for temperature [W/m/K]
volScalarField kappa_;
//- Youngs modulus [Pa]
volScalarField E_;
//- Poisson's ratio []
volScalarField nu_;
//- Volumetric thermal expansion coefficient [1/T]
volScalarField alphav_;
// Private member functions
void readProperty(volScalarField& prop) const;
public:
//- Runtime type information
TypeName("solidDisplacementThermo");
// Constructors
//- Construct from mesh and phase name
solidDisplacementThermo
(
const fvMesh&,
const word& phaseName = word::null
);
//- Destructor
virtual ~solidDisplacementThermo();
// Member Functions
//- Return the name of the thermo physics
virtual word thermoName() const
{
return type();
}
//- Return true if the equation of state is incompressible
// i.e. rho != f(p)
virtual bool incompressible() const
{
return true;
}
//- Return true if the equation of state is isochoric
// i.e. rho = const
virtual bool isochoric() const
{
return true;
}
//- Returns true to enable plane stress
bool planeStress() const
{
return planeStress_;
}
//- Returns true to enable thermal stress
bool thermalStress() const
{
return thermalStress_;
}
// Access to thermophysical state variables
//- Density [kg/m^3]
virtual tmp<volScalarField> rho() const;
//- Density for patch [kg/m^3]
virtual tmp<scalarField> rho(const label patchi) const;
//- Youngs modulus [Pa]
virtual const volScalarField& E() const;
//- Youngs modulus for a patch [Pa]
virtual const scalarField& E(const label patchi) const;
//- Poisson's ratio []
virtual const volScalarField& nu() const;
//- Poisson's ratio for a patch[]
virtual const scalarField& nu(const label patchi) const;
//- Volumetric thermal expansion coefficient [1/T]
virtual const volScalarField& alphav() const;
//- Volumetric thermal expansion coefficient for a patch [1/T]
virtual const scalarField& alphav(const label patchi) const;
//- Enthalpy/Internal energy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& he();
//- Enthalpy/Internal energy [J/kg]
virtual const volScalarField& he() const;
// Fields derived from thermodynamic state variables
//- Enthalpy/Internal energy
// for given pressure and temperature [J/kg]
virtual tmp<volScalarField> he
(
const volScalarField& p,
const volScalarField& T
) const;
//- Enthalpy/Internal energy for cell-set [J/kg]
virtual tmp<scalarField> he
(
const scalarField& T,
const labelList& cells
) const;
//- Enthalpy/Internal energy for patch [J/kg]
virtual tmp<scalarField> he
(
const scalarField& T,
const label patchi
) const;
//- Absolute enthalpy [J/kg/K]
virtual tmp<volScalarField> ha() const;
//- Absolute enthalpy
// for given pressure and temperature [J/kg]
virtual tmp<volScalarField> ha
(
const volScalarField& p,
const volScalarField& T
) const;
//- Absolute enthalpy for patch [J/kg/K]
virtual tmp<scalarField> ha
(
const scalarField& T,
const label patchi
) const;
//- Absolute enthalpy for cell-set [J/kg]
virtual tmp<scalarField> ha
(
const scalarField& T,
const labelList& cells
) const;
//- Chemical enthalpy [J/kg]
virtual tmp<volScalarField> hc() const;
//- Temperature from enthalpy/internal energy for cell-set
virtual tmp<scalarField> THE
(
const scalarField& he,
const scalarField& T0, // starting temperature
const labelList& cells
) const;
//- Temperature from enthalpy/internal energy for patch
virtual tmp<scalarField> THE
(
const scalarField& he,
const scalarField& T0, // starting temperature
const label patchi
) const;
//- Heat capacity at constant pressure [J/kg/K]
virtual tmp<volScalarField> Cp() const;
//- Heat capacity at constant pressure for patch [J/kg/K]
virtual tmp<scalarField> Cp
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant volume [J/kg/K]
virtual tmp<volScalarField> Cv() const;
//- Heat capacity at constant volume for patch [J/kg/K]
virtual tmp<scalarField> Cv
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant pressure/volume [J/kg/K]
virtual tmp<volScalarField> Cpv() const;
//- Heat capacity at constant pressure/volume for patch [J/kg/K]
virtual tmp<scalarField> Cpv
(
const scalarField& T,
const label patchi
) const;
//- Heat capacity ratio []
virtual tmp<volScalarField> CpByCpv() const;
//- Heat capacity ratio for patch []
virtual tmp<scalarField> CpByCpv
(
const scalarField& T,
const label patchi
) const;
// Fields derived from transport state variables
//- Thermal diffusivity for temperature of mixture [W/m/K]
virtual tmp<volScalarField> kappa() const;
//- Thermal diffusivity for temperature of mixture for patch [W/m/K]
virtual tmp<scalarField> kappa(const label patchi) const;
//- Thermal diffusivity for energy of mixture [kg/m/s]
virtual tmp<volScalarField> alphahe() const;
//- Thermal diffusivity for energy of mixture for patch [kg/m/s]
virtual tmp<scalarField> alphahe(const label patchi) const;
//- Effective thermal turbulent diffusivity for temperature
// of mixture [W/m/K]
virtual tmp<volScalarField> kappaEff
(
const volScalarField&
) const;
//- Effective thermal turbulent diffusivity of mixture [kg/m/s]
virtual tmp<volScalarField> alphaEff
(
const volScalarField& alphat
) const;
//- Effective thermal turbulent diffusivity for temperature
// of mixture for patch [W/m/K]
virtual tmp<scalarField> kappaEff
(
const scalarField& alphat,
const label patchi
) const;
//- Effective thermal turbulent diffusivity of mixture
// for patch [kg/m/s]
virtual tmp<scalarField> alphaEff
(
const scalarField& alphat,
const label patchi
) const;
//- Return true if thermal conductivity is isotropic
virtual bool isotropic() const
{
return true;
}
//- Anisotropic thermal conductivity [W/m/K]
virtual tmp<volVectorField> Kappa() const;
//- Anisotropic thermal conductivity [W/m/K]
virtual tmp<vectorField> Kappa
(
const label patchi
) const;
//- Update properties
virtual void correct();
// I-O
//- Read thermophysicalProperties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,15 @@
EXE_INC = \
-I. \
-I.. \
-I../solidDisplacementThermo \
-ItractionDisplacementCorrection \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lsolidThermo \
-lsolidDisplacementThermo \
-lmeshTools

View File

@ -1,4 +1,4 @@
#include "readMechanicalProperties.H"
#include "readThermophysicalProperties.H"
Info<< "Reading displacement field D\n" << endl;
volVectorField D

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,7 +36,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "Switch.H"
#include "solidDisplacementThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -50,6 +50,7 @@ int main(int argc, char *argv[])
#include "createMesh.H"
#include "createControls.H"
#include "createFields.H"
#include "createFieldRefs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,8 +24,8 @@ License
\*---------------------------------------------------------------------------*/
#include "tractionDisplacementCorrectionFvPatchVectorField.H"
#include "solidDisplacementThermo.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -145,32 +145,26 @@ void tractionDisplacementCorrectionFvPatchVectorField::updateCoeffs()
return;
}
const dictionary& mechanicalProperties = db().lookupObject<IOdictionary>
const label patchi = patch().index();
const solidDisplacementThermo& thermo =
db().lookupObject<solidDisplacementThermo>
(
solidDisplacementThermo::dictName
);
const scalarField& E = thermo.E(patchi);
const scalarField& nu = thermo.nu(patchi);
const scalarField mu(E/(2.0*(1.0 + nu)));
const scalarField lambda
(
"mechanicalProperties"
thermo.planeStress()
? nu*E/((1 + nu)*(1 - nu))
: nu*E/((1 + nu)*(1 - 2*nu))
);
const fvPatchField<scalar>& rho =
patch().lookupPatchField<volScalarField, scalar>("rho");
const fvPatchField<scalar>& rhoE =
patch().lookupPatchField<volScalarField, scalar>("E");
const fvPatchField<scalar>& nu =
patch().lookupPatchField<volScalarField, scalar>("nu");
scalarField E(rhoE/rho);
scalarField mu(E/(2.0*(1.0 + nu)));
scalarField lambda(nu*E/((1.0 + nu)*(1.0 - 2.0*nu)));
Switch planeStress(mechanicalProperties.lookup("planeStress"));
if (planeStress)
{
lambda = nu*E/((1.0 + nu)*(1.0 - nu));
}
vectorField n(patch().nf());
const vectorField n(patch().nf());
const fvPatchField<symmTensor>& sigmaD =
patch().lookupPatchField<volSymmTensorField, symmTensor>("sigmaD");
@ -180,7 +174,7 @@ void tractionDisplacementCorrectionFvPatchVectorField::updateCoeffs()
gradient() =
(
(traction_ + pressure_*n)/rho - (n & (sigmaD + sigmaExp))
(traction_ + pressure_*n) - (n & (sigmaD + sigmaExp))
)/(2.0*mu + lambda);
fixedGradientFvPatchVectorField::updateCoeffs();

View File

@ -1,10 +0,0 @@
EXE_INC = \
-I. \
-I../solidDisplacementFoam \
-ItractionDisplacementCorrection \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools

View File

@ -96,7 +96,7 @@ Foam::radiationModels::absorptionEmissionModels::greyMeanSolid::greyMeanSolid
:
absorptionEmissionModel(dict, mesh),
coeffsDict_((dict.optionalSubDict(typeName + "Coeffs"))),
thermo_(mesh.lookupObject<solidThermo>(basicThermo::dictName)),
thermo_(mesh.lookupObject<solidPressureThermo>(basicThermo::dictName)),
speciesNames_(0),
mixture_(dynamic_cast<const basicSpecieMixture&>(thermo_)),
solidData_(mixture_.Y().size())

View File

@ -49,7 +49,7 @@ SourceFiles
#define greyMeanSolid_H
#include "absorptionEmissionModel.H"
#include "solidThermo.H"
#include "solidPressureThermo.H"
#include "basicSpecieMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -85,7 +85,7 @@ private:
dictionary coeffsDict_;
//- SLG thermo package
const solidThermo& thermo_;
const solidPressureThermo& thermo_;
//- Hash table of species names
HashTable<label> speciesNames_;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -50,7 +50,7 @@ Foam::solidThermo::solidThermo
(
IOobject
(
phasePropertyName("thermo:rho"),
phasePropertyName("rho"),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
@ -74,7 +74,7 @@ Foam::solidThermo::solidThermo
(
IOobject
(
phasePropertyName("thermo:rho"),
phasePropertyName("rho"),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,

View File

@ -56,7 +56,6 @@ protected:
// Protected data
//- Density field [kg/m^3]
// Named 'thermo:rho' to avoid (potential) conflict with solver density
volScalarField rho_;
@ -127,16 +126,6 @@ public:
// Member Functions
// Access to thermodynamic state variables
//- Pressure [Pa]
// Non-const access allowed for transport equations
virtual volScalarField& p() = 0;
//- Pressure [Pa]
virtual const volScalarField& p() const = 0;
// Fields derived from thermodynamic state variables
//- Density [kg/m^3]

View File

@ -1,39 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object mechanicalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
rho
{
type uniform;
value 7854;
}
nu
{
type uniform;
value 0.3;
}
E
{
type uniform;
value 2e+11;
}
planeStress yes;
// ************************************************************************* //

View File

@ -15,24 +15,43 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
C
rho
{
type uniform;
value 7854;
}
nu
{
type uniform;
value 0.3;
}
E
{
type uniform;
value 2e+11;
}
Cp
{
type uniform;
value 434;
}
k
kappa
{
type uniform;
value 60.5;
}
alpha
alphav
{
type uniform;
value 1.1e-05;
}
planeStress yes;
thermalStress no;

View File

@ -42,7 +42,7 @@ laplacianSchemes
{
default none;
laplacian(DD,D) Gauss linear corrected;
laplacian(DT,T) Gauss linear corrected;
laplacian(kappa,T) Gauss linear corrected;
}
interpolationSchemes

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 0;
boundaryField
{
topSurface
{
type calculated;
value uniform 0;
}
bottomSurface
{
type calculated;
value uniform 0;
}
fixedEnd
{
type calculated;
value uniform 0;
}
tractionEnd
{
type calculated;
value uniform 0;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //

View File

@ -1,39 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object thermalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
C
{
type uniform;
value 434;
}
k
{
type uniform;
value 60.5;
}
alpha
{
type uniform;
value 1.1e-05;
}
thermalStress no;
// ************************************************************************* //

View File

@ -33,6 +33,25 @@ E
value 2e+11;
}
Cp
{
type uniform;
value 434;
}
kappa
{
type uniform;
value 60.5;
}
alphav
{
type uniform;
value 1.1e-05;
}
planeStress yes;
thermalStress no;
// ************************************************************************* //