mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: Changing dictinary entries for thermal and mechanic properties
This commit is contained in:
@ -13,70 +13,176 @@
|
||||
);
|
||||
|
||||
const dictionary& rhoDict(mechanicalProperties.subDict("rho"));
|
||||
word rhoType(rhoDict.lookup("rho"));
|
||||
word rhoType(rhoDict.lookup("type"));
|
||||
|
||||
volScalarField rho
|
||||
autoPtr<volScalarField> rhoPtr;
|
||||
|
||||
IOobject rhoIO
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
"rho",
|
||||
runTime.timeName(0),
|
||||
mesh,
|
||||
dimensionedScalar("zero", dimMass/dimVolume, 0.0)
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (rhoType == "rhoInf")
|
||||
if (rhoType == "uniform")
|
||||
{
|
||||
rho = rhoDict.lookup("rhoInf");
|
||||
scalar rhoValue(readScalar(rhoDict.lookup("value")));
|
||||
|
||||
rhoPtr.reset
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
rhoIO,
|
||||
mesh,
|
||||
dimensionedScalar
|
||||
(
|
||||
"rho",
|
||||
dimMass/dimVolume,
|
||||
rhoValue
|
||||
),
|
||||
zeroGradientFvPatchField<scalar>::typeName
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (rhoType == "field")
|
||||
{
|
||||
rhoIO.readOpt() = IOobject::MUST_READ;
|
||||
|
||||
rhoPtr.reset
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
rhoIO,
|
||||
mesh
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"readMechanicalProperties.H"
|
||||
) << "Valid type entries are uniform or field for rho"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
volScalarField rhoE
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"E",
|
||||
runTime.timeName(0),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimMass/dimLength/sqr(dimTime), 0.0)
|
||||
);
|
||||
volScalarField& rho = rhoPtr();
|
||||
|
||||
const dictionary& EDict(mechanicalProperties.subDict("E"));
|
||||
word EType(EDict.lookup("E"));
|
||||
if (EType == "EInf")
|
||||
word EType(EDict.lookup("type"));
|
||||
|
||||
autoPtr<volScalarField> EPtr;
|
||||
|
||||
IOobject EIO
|
||||
(
|
||||
"E",
|
||||
runTime.timeName(0),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (EType == "uniform")
|
||||
{
|
||||
rhoE = EDict.lookup("EInf");
|
||||
scalar rhoEValue(readScalar(EDict.lookup("value")));
|
||||
|
||||
EPtr.reset
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
EIO,
|
||||
mesh,
|
||||
dimensionedScalar
|
||||
(
|
||||
"Erho",
|
||||
dimMass/dimLength/sqr(dimTime),
|
||||
rhoEValue
|
||||
),
|
||||
zeroGradientFvPatchField<scalar>::typeName
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (EType == "field")
|
||||
{
|
||||
EIO.readOpt() = IOobject::MUST_READ;
|
||||
|
||||
EPtr.reset
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
EIO,
|
||||
mesh
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"readMechanicalProperties.H"
|
||||
) << "Valid type entries are uniform or field for E"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
volScalarField& rhoE = EPtr();
|
||||
|
||||
volScalarField nu
|
||||
autoPtr<volScalarField> nuPtr;
|
||||
|
||||
IOobject nuIO
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"nu",
|
||||
runTime.timeName(0),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
"nu",
|
||||
runTime.timeName(0),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimless, 0.0)
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
const dictionary& nuDict(mechanicalProperties.subDict("nu"));
|
||||
word nuType(nuDict.lookup("nu"));
|
||||
word nuType(nuDict.lookup("type"));
|
||||
|
||||
if (nuType == "nuInf")
|
||||
if (nuType == "uniform")
|
||||
{
|
||||
nu = nuDict.lookup("nuInf");
|
||||
scalar nuValue(readScalar(nuDict.lookup("value")));
|
||||
nuPtr.reset
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
nuIO,
|
||||
mesh,
|
||||
dimensionedScalar
|
||||
(
|
||||
"nu",
|
||||
dimless,
|
||||
nuValue
|
||||
),
|
||||
zeroGradientFvPatchField<scalar>::typeName
|
||||
)
|
||||
);
|
||||
}
|
||||
else if(nuType == "field")
|
||||
{
|
||||
nuIO.readOpt() = IOobject::MUST_READ;
|
||||
nuPtr.reset
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
nuIO,
|
||||
mesh
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"readMechanicalProperties.H"
|
||||
) << "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;
|
||||
|
||||
@ -46,70 +46,180 @@ volScalarField DT
|
||||
|
||||
if (thermalStress)
|
||||
{
|
||||
volScalarField C
|
||||
|
||||
autoPtr<volScalarField> CPtr;
|
||||
|
||||
IOobject CIO
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"C",
|
||||
runTime.timeName(0),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
"C",
|
||||
runTime.timeName(0),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimensionSet(0, 2, -2 , -1, 0), 0.0)
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
const dictionary& CDict(thermalProperties.subDict("C"));
|
||||
word CType(CDict.lookup("C"));
|
||||
if (CType == "CInf")
|
||||
word CType(CDict.lookup("type"));
|
||||
if (CType == "uniform")
|
||||
{
|
||||
C = CDict.lookup("CInf");
|
||||
scalar CValue(readScalar(CDict.lookup("value")));
|
||||
|
||||
CPtr.reset
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
CIO,
|
||||
mesh,
|
||||
dimensionedScalar
|
||||
(
|
||||
"C",
|
||||
dimensionSet(0, 2, -2 , -1, 0),
|
||||
CValue
|
||||
),
|
||||
zeroGradientFvPatchField<scalar>::typeName
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
else if(CType == "field")
|
||||
{
|
||||
CIO.readOpt() = IOobject::MUST_READ;
|
||||
|
||||
CPtr.reset
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
CIO,
|
||||
mesh
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"readThermalProperties.H"
|
||||
) << "Valid type entries are uniform or field for C"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
volScalarField& C = CPtr();
|
||||
|
||||
volScalarField rhoK
|
||||
autoPtr<volScalarField> rhoKPtr;
|
||||
|
||||
IOobject rhoKIO
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"k",
|
||||
runTime.timeName(0),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
"k",
|
||||
runTime.timeName(0),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimensionSet(1, 1, -3 , -1, 0), 0.0)
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
const dictionary& kDict(thermalProperties.subDict("k"));
|
||||
word kType(kDict.lookup("k"));
|
||||
if (kType == "kInf")
|
||||
word kType(kDict.lookup("type"));
|
||||
if (kType == "uniform")
|
||||
{
|
||||
rhoK = kDict.lookup("kInf");
|
||||
scalar rhoKValue(readScalar(kDict.lookup("value")));
|
||||
|
||||
rhoKPtr.reset
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
rhoKIO,
|
||||
mesh,
|
||||
dimensionedScalar
|
||||
(
|
||||
"rhoK",
|
||||
dimensionSet(1, 1, -3 , -1, 0),
|
||||
rhoKValue
|
||||
),
|
||||
zeroGradientFvPatchField<scalar>::typeName
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
else if (kType == "field")
|
||||
{
|
||||
rhoKIO.readOpt() = IOobject::MUST_READ;
|
||||
|
||||
rhoKPtr.reset
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
rhoKIO,
|
||||
mesh
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"readThermalProperties.H"
|
||||
) << "Valid type entries are uniform or field for K"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
volScalarField alpha
|
||||
volScalarField& rhoK = rhoKPtr();
|
||||
|
||||
autoPtr<volScalarField> alphaPtr;
|
||||
|
||||
IOobject alphaIO
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"alpha",
|
||||
runTime.timeName(0),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
"alpha",
|
||||
runTime.timeName(0),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimensionSet(0, 0, 0 , -1, 0), 0.0)
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
const dictionary& alphaDict(thermalProperties.subDict("alpha"));
|
||||
word alphaType(alphaDict.lookup("alpha"));
|
||||
|
||||
if (alphaType == "alphaInf")
|
||||
const dictionary& alphaDict(thermalProperties.subDict("alpha"));
|
||||
word alphaType(alphaDict.lookup("type"));
|
||||
|
||||
if (alphaType == "uniform")
|
||||
{
|
||||
alpha = alphaDict.lookup("alphaInf");
|
||||
scalar alphaValue(readScalar(alphaDict.lookup("value")));
|
||||
alphaPtr.reset
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
alphaIO,
|
||||
mesh,
|
||||
dimensionedScalar
|
||||
(
|
||||
"alpha",
|
||||
inv(dimTemperature),
|
||||
alphaValue
|
||||
),
|
||||
zeroGradientFvPatchField<scalar>::typeName
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (alphaType == "field")
|
||||
{
|
||||
alphaIO.readOpt() = IOobject::MUST_READ;
|
||||
|
||||
alphaPtr.reset
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
alphaIO,
|
||||
mesh
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"readThermalProperties.H"
|
||||
) << "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;
|
||||
|
||||
@ -150,13 +150,18 @@ void tractionDisplacementCorrectionFvPatchVectorField::updateCoeffs()
|
||||
"mechanicalProperties"
|
||||
);
|
||||
|
||||
dimensionedScalar rho(mechanicalProperties.lookup("rho"));
|
||||
dimensionedScalar rhoE(mechanicalProperties.lookup("E"));
|
||||
dimensionedScalar nu(mechanicalProperties.lookup("nu"));
|
||||
const fvPatchField<scalar>& rho =
|
||||
patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||
|
||||
dimensionedScalar E = rhoE/rho;
|
||||
dimensionedScalar mu = E/(2.0*(1.0 + nu));
|
||||
dimensionedScalar lambda = nu*E/((1.0 + nu)*(1.0 - 2.0*nu));
|
||||
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"));
|
||||
|
||||
@ -175,8 +180,8 @@ void tractionDisplacementCorrectionFvPatchVectorField::updateCoeffs()
|
||||
|
||||
gradient() =
|
||||
(
|
||||
(traction_ + pressure_*n)/rho.value() - (n & (sigmaD + sigmaExp))
|
||||
)/(2.0*mu + lambda).value();
|
||||
(traction_ + pressure_*n)/rho - (n & (sigmaD + sigmaExp))
|
||||
)/(2.0*mu + lambda);
|
||||
|
||||
fixedGradientFvPatchVectorField::updateCoeffs();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user