ENH: Changing mechanical and thermal properties to volScalarFields
This commit is contained in:
parent
72cc4cd7d8
commit
8ebd492595
@ -12,18 +12,80 @@
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar rho(mechanicalProperties.lookup("rho"));
|
||||
dimensionedScalar rhoE(mechanicalProperties.lookup("E"));
|
||||
dimensionedScalar nu(mechanicalProperties.lookup("nu"));
|
||||
const dictionary& rhoDict(mechanicalProperties.subDict("rho"));
|
||||
word rhoType(rhoDict.lookup("rho"));
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("zero", dimMass/dimVolume, 0.0)
|
||||
);
|
||||
|
||||
if (rhoType == "rhoInf")
|
||||
{
|
||||
rho = rhoDict.lookup("rhoInf");
|
||||
}
|
||||
|
||||
volScalarField rhoE
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"E",
|
||||
runTime.timeName(0),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimMass/dimLength/sqr(dimTime), 0.0)
|
||||
);
|
||||
|
||||
const dictionary& EDict(mechanicalProperties.subDict("E"));
|
||||
word EType(EDict.lookup("E"));
|
||||
if (EType == "EInf")
|
||||
{
|
||||
rhoE = EDict.lookup("EInf");
|
||||
}
|
||||
|
||||
|
||||
volScalarField nu
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"nu",
|
||||
runTime.timeName(0),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimless, 0.0)
|
||||
);
|
||||
|
||||
const dictionary& nuDict(mechanicalProperties.subDict("nu"));
|
||||
word nuType(nuDict.lookup("nu"));
|
||||
|
||||
if (nuType == "nuInf")
|
||||
{
|
||||
nu = nuDict.lookup("nuInf");
|
||||
}
|
||||
|
||||
Info<< "Normalising E : E/rho\n" << endl;
|
||||
dimensionedScalar E = rhoE/rho;
|
||||
volScalarField E = rhoE/rho;
|
||||
|
||||
Info<< "Calculating Lame's coefficients\n" << endl;
|
||||
|
||||
dimensionedScalar mu = E/(2.0*(1.0 + nu));
|
||||
dimensionedScalar lambda = nu*E/((1.0 + nu)*(1.0 - 2.0*nu));
|
||||
dimensionedScalar threeK = E/(1.0 - 2.0*nu);
|
||||
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"));
|
||||
|
||||
@ -38,7 +100,3 @@
|
||||
{
|
||||
Info<< "Plane Strain\n" << endl;
|
||||
}
|
||||
|
||||
Info<< "mu = " << mu.value() << " Pa/rho\n";
|
||||
Info<< "lambda = " << lambda.value() << " Pa/rho\n";
|
||||
Info<< "threeK = " << threeK.value() << " Pa/rho\n";
|
||||
|
@ -1,46 +1,122 @@
|
||||
Info<< "Reading thermal properties\n" << endl;
|
||||
Info<< "Reading thermal properties\n" << endl;
|
||||
|
||||
IOdictionary thermalProperties
|
||||
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("0", dimensionSet(0, 2, -2 , -1, 0), 0.0)
|
||||
);
|
||||
|
||||
|
||||
volScalarField DT
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"DT",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimensionSet(0, 2, -1 , 0, 0), 0.0)
|
||||
);
|
||||
|
||||
|
||||
if (thermalStress)
|
||||
{
|
||||
volScalarField C
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"thermalProperties",
|
||||
runTime.constant(),
|
||||
"C",
|
||||
runTime.timeName(0),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimensionSet(0, 2, -2 , -1, 0), 0.0)
|
||||
);
|
||||
|
||||
Switch thermalStress(thermalProperties.lookup("thermalStress"));
|
||||
|
||||
dimensionedScalar threeKalpha
|
||||
(
|
||||
"threeKalpha",
|
||||
dimensionSet(0, 2, -2 , -1, 0),
|
||||
0
|
||||
);
|
||||
|
||||
dimensionedScalar DT
|
||||
(
|
||||
"DT",
|
||||
dimensionSet(0, 2, -1 , 0, 0),
|
||||
0
|
||||
);
|
||||
|
||||
if (thermalStress)
|
||||
const dictionary& CDict(thermalProperties.subDict("C"));
|
||||
word CType(CDict.lookup("C"));
|
||||
if (CType == "CInf")
|
||||
{
|
||||
dimensionedScalar C(thermalProperties.lookup("C"));
|
||||
dimensionedScalar rhoK(thermalProperties.lookup("k"));
|
||||
dimensionedScalar alpha(thermalProperties.lookup("alpha"));
|
||||
|
||||
Info<< "Normalising k : k/rho\n" << endl;
|
||||
dimensionedScalar k = rhoK/rho;
|
||||
|
||||
Info<< "Calculating thermal coefficients\n" << endl;
|
||||
|
||||
threeKalpha = threeK*alpha;
|
||||
DT.value() = (k/C).value();
|
||||
|
||||
Info<< "threeKalpha = " << threeKalpha.value() << " Pa/rho\n";
|
||||
C = CDict.lookup("CInf");
|
||||
}
|
||||
|
||||
|
||||
volScalarField rhoK
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"k",
|
||||
runTime.timeName(0),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimensionSet(1, 1, -3 , -1, 0), 0.0)
|
||||
);
|
||||
|
||||
const dictionary& kDict(thermalProperties.subDict("k"));
|
||||
word kType(kDict.lookup("k"));
|
||||
if (kType == "kInf")
|
||||
{
|
||||
rhoK = kDict.lookup("kInf");
|
||||
}
|
||||
|
||||
volScalarField alpha
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"alpha",
|
||||
runTime.timeName(0),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimensionSet(0, 0, 0 , -1, 0), 0.0)
|
||||
);
|
||||
|
||||
const dictionary& alphaDict(thermalProperties.subDict("alpha"));
|
||||
word alphaType(alphaDict.lookup("alpha"));
|
||||
|
||||
if (alphaType == "alphaInf")
|
||||
{
|
||||
alpha = alphaDict.lookup("alphaInf");
|
||||
}
|
||||
|
||||
Info<< "Normalising k : k/rho\n" << endl;
|
||||
volScalarField k = rhoK/rho;
|
||||
|
||||
Info<< "Calculating thermal coefficients\n" << endl;
|
||||
|
||||
threeKalpha = threeK*alpha;
|
||||
DT = k/C;
|
||||
|
||||
}
|
||||
|
@ -149,14 +149,20 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
|
||||
const dictionary& thermalProperties =
|
||||
db().lookupObject<IOdictionary>("thermalProperties");
|
||||
|
||||
dimensionedScalar rho(mechanicalProperties.lookup("rho"));
|
||||
dimensionedScalar rhoE(mechanicalProperties.lookup("E"));
|
||||
dimensionedScalar nu(mechanicalProperties.lookup("nu"));
|
||||
|
||||
dimensionedScalar E = rhoE/rho;
|
||||
dimensionedScalar mu = E/(2.0*(1.0 + nu));
|
||||
dimensionedScalar lambda = nu*E/((1.0 + nu)*(1.0 - 2.0*nu));
|
||||
dimensionedScalar threeK = E/(1.0 - 2.0*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));
|
||||
scalarField threeK = E/(1.0 - 2.0*nu);
|
||||
|
||||
Switch planeStress(mechanicalProperties.lookup("planeStress"));
|
||||
|
||||
@ -166,7 +172,7 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
|
||||
threeK = E/(1.0 - nu);
|
||||
}
|
||||
|
||||
scalar twoMuLambda = (2*mu + lambda).value();
|
||||
scalarField twoMuLambda = (2*mu + lambda);
|
||||
|
||||
vectorField n(patch().nf());
|
||||
|
||||
@ -175,7 +181,7 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
|
||||
|
||||
gradient() =
|
||||
(
|
||||
(traction_ + pressure_*n)/rho.value()
|
||||
(traction_ + pressure_*n)/rho
|
||||
+ twoMuLambda*fvPatchField<vector>::snGrad() - (n & sigmaD)
|
||||
)/twoMuLambda;
|
||||
|
||||
@ -183,13 +189,13 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
|
||||
|
||||
if (thermalStress)
|
||||
{
|
||||
dimensionedScalar alpha(thermalProperties.lookup("alpha"));
|
||||
dimensionedScalar threeKalpha = threeK*alpha;
|
||||
const fvPatchField<scalar>& threeKalpha=
|
||||
patch().lookupPatchField<volScalarField, scalar>("threeKalpha");
|
||||
|
||||
const fvPatchField<scalar>& T =
|
||||
patch().lookupPatchField<volScalarField, scalar>("T");
|
||||
|
||||
gradient() += n*threeKalpha.value()*T/twoMuLambda;
|
||||
gradient() += n*threeKalpha*T/twoMuLambda;
|
||||
}
|
||||
|
||||
fixedGradientFvPatchVectorField::updateCoeffs();
|
||||
|
@ -15,11 +15,23 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
rho rho [ 1 -3 0 0 0 0 0 ] 7854;
|
||||
rho
|
||||
{
|
||||
rho rhoInf;
|
||||
rhoInf rhoInf [ 1 -3 0 0 0 0 0 ] 7854;
|
||||
}
|
||||
|
||||
nu nu [ 0 0 0 0 0 0 0 ] 0.3;
|
||||
nu
|
||||
{
|
||||
nu nuInf;
|
||||
nuInf nuInf [ 0 0 0 0 0 0 0 ] 0.3;
|
||||
}
|
||||
|
||||
E E [ 1 -1 -2 0 0 0 0 ] 2e+11;
|
||||
E
|
||||
{
|
||||
E EInf;
|
||||
EInf EInf [ 1 -1 -2 0 0 0 0 ] 2e+11;
|
||||
}
|
||||
|
||||
planeStress yes;
|
||||
|
||||
|
@ -15,11 +15,23 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
C C [ 0 2 -2 -1 0 0 0 ] 434;
|
||||
C
|
||||
{
|
||||
C CInf;
|
||||
CInf CInf [ 0 2 -2 -1 0 0 0 ] 434;
|
||||
}
|
||||
|
||||
k k [ 1 1 -3 -1 0 0 0 ] 60.5;
|
||||
k
|
||||
{
|
||||
k kInf;
|
||||
kInf kInf [ 1 1 -3 -1 0 0 0 ] 60.5;
|
||||
}
|
||||
|
||||
alpha alpha [ 0 0 0 -1 0 0 0 ] 1.1e-05;
|
||||
alpha
|
||||
{
|
||||
alpha alphaInf;
|
||||
alphaInf alphaInf [ 0 0 0 -1 0 0 0 ] 1.1e-05;
|
||||
}
|
||||
|
||||
thermalStress no;
|
||||
|
||||
|
@ -20,6 +20,11 @@ d2dt2Schemes
|
||||
default steadyState;
|
||||
}
|
||||
|
||||
ddtSchemes
|
||||
{
|
||||
default Euler;
|
||||
}
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
default leastSquares;
|
||||
|
Loading…
Reference in New Issue
Block a user