2013-10-14 08:26:40 +00:00
|
|
|
/*---------------------------------------------------------------------------*\
|
|
|
|
========= |
|
2013-12-11 16:09:41 +00:00
|
|
|
\\ / F ield | foam-extend: Open Source CFD
|
2016-06-20 15:00:40 +00:00
|
|
|
\\ / O peration | Version: 4.0
|
2015-05-17 13:32:07 +00:00
|
|
|
\\ / A nd | Web: http://www.foam-extend.org
|
|
|
|
\\/ M anipulation | For copyright notice see file Copyright
|
2013-10-14 08:26:40 +00:00
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
License
|
2013-12-11 16:09:41 +00:00
|
|
|
This file is part of foam-extend.
|
2013-10-14 08:26:40 +00:00
|
|
|
|
2013-12-11 16:09:41 +00:00
|
|
|
foam-extend is free software: you can redistribute it and/or modify it
|
2013-10-14 08:26:40 +00:00
|
|
|
under the terms of the GNU General Public License as published by the
|
2013-12-11 16:09:41 +00:00
|
|
|
Free Software Foundation, either version 3 of the License, or (at your
|
2013-10-14 08:26:40 +00:00
|
|
|
option) any later version.
|
|
|
|
|
2013-12-11 16:09:41 +00:00
|
|
|
foam-extend 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.
|
2013-10-14 08:26:40 +00:00
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2013-12-11 16:09:41 +00:00
|
|
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
2013-10-14 08:26:40 +00:00
|
|
|
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
#include "tractionDisplacementFvPatchVectorField.H"
|
|
|
|
#include "addToRunTimeSelectionTable.H"
|
|
|
|
#include "volFields.H"
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
namespace Foam
|
|
|
|
{
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
tractionDisplacementFvPatchVectorField::
|
|
|
|
tractionDisplacementFvPatchVectorField
|
|
|
|
(
|
|
|
|
const fvPatch& p,
|
|
|
|
const DimensionedField<vector, volMesh>& iF
|
|
|
|
)
|
|
|
|
:
|
|
|
|
fixedGradientFvPatchVectorField(p, iF),
|
|
|
|
traction_(p.size(), vector::zero),
|
|
|
|
pressure_(p.size(), 0.0)
|
|
|
|
{
|
|
|
|
fvPatchVectorField::operator=(patchInternalField());
|
|
|
|
gradient() = vector::zero;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tractionDisplacementFvPatchVectorField::
|
|
|
|
tractionDisplacementFvPatchVectorField
|
|
|
|
(
|
|
|
|
const tractionDisplacementFvPatchVectorField& tdpvf,
|
|
|
|
const fvPatch& p,
|
|
|
|
const DimensionedField<vector, volMesh>& iF,
|
|
|
|
const fvPatchFieldMapper& mapper
|
|
|
|
)
|
|
|
|
:
|
|
|
|
fixedGradientFvPatchVectorField(tdpvf, p, iF, mapper),
|
|
|
|
traction_(tdpvf.traction_, mapper),
|
|
|
|
pressure_(tdpvf.pressure_, mapper)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
tractionDisplacementFvPatchVectorField::
|
|
|
|
tractionDisplacementFvPatchVectorField
|
|
|
|
(
|
|
|
|
const fvPatch& p,
|
|
|
|
const DimensionedField<vector, volMesh>& iF,
|
|
|
|
const dictionary& dict
|
|
|
|
)
|
|
|
|
:
|
|
|
|
fixedGradientFvPatchVectorField(p, iF),
|
|
|
|
traction_("traction", dict, p.size()),
|
|
|
|
pressure_("pressure", dict, p.size())
|
|
|
|
{
|
|
|
|
fvPatchVectorField::operator=(patchInternalField());
|
|
|
|
gradient() = vector::zero;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tractionDisplacementFvPatchVectorField::
|
|
|
|
tractionDisplacementFvPatchVectorField
|
|
|
|
(
|
|
|
|
const tractionDisplacementFvPatchVectorField& tdpvf
|
|
|
|
)
|
|
|
|
:
|
|
|
|
fixedGradientFvPatchVectorField(tdpvf),
|
|
|
|
traction_(tdpvf.traction_),
|
|
|
|
pressure_(tdpvf.pressure_)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
tractionDisplacementFvPatchVectorField::
|
|
|
|
tractionDisplacementFvPatchVectorField
|
|
|
|
(
|
|
|
|
const tractionDisplacementFvPatchVectorField& tdpvf,
|
|
|
|
const DimensionedField<vector, volMesh>& iF
|
|
|
|
)
|
|
|
|
:
|
|
|
|
fixedGradientFvPatchVectorField(tdpvf, iF),
|
|
|
|
traction_(tdpvf.traction_),
|
|
|
|
pressure_(tdpvf.pressure_)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
void tractionDisplacementFvPatchVectorField::autoMap
|
|
|
|
(
|
|
|
|
const fvPatchFieldMapper& m
|
|
|
|
)
|
|
|
|
{
|
|
|
|
fixedGradientFvPatchVectorField::autoMap(m);
|
|
|
|
traction_.autoMap(m);
|
|
|
|
pressure_.autoMap(m);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void tractionDisplacementFvPatchVectorField::rmap
|
|
|
|
(
|
|
|
|
const fvPatchVectorField& ptf,
|
|
|
|
const labelList& addr
|
|
|
|
)
|
|
|
|
{
|
|
|
|
fixedGradientFvPatchVectorField::rmap(ptf, addr);
|
|
|
|
|
|
|
|
const tractionDisplacementFvPatchVectorField& dmptf =
|
|
|
|
refCast<const tractionDisplacementFvPatchVectorField>(ptf);
|
|
|
|
|
|
|
|
traction_.rmap(dmptf.traction_, addr);
|
|
|
|
pressure_.rmap(dmptf.pressure_, addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void tractionDisplacementFvPatchVectorField::updateCoeffs()
|
|
|
|
{
|
|
|
|
if (updated())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const dictionary& mechanicalProperties =
|
|
|
|
db().lookupObject<IOdictionary>("mechanicalProperties");
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
Switch planeStress(mechanicalProperties.lookup("planeStress"));
|
|
|
|
|
|
|
|
if (planeStress)
|
|
|
|
{
|
|
|
|
lambda = nu*E/((1.0 + nu)*(1.0 - nu));
|
|
|
|
threeK = E/(1.0 - nu);
|
|
|
|
}
|
|
|
|
|
|
|
|
scalar twoMuLambda = (2*mu + lambda).value();
|
|
|
|
|
|
|
|
vectorField n = patch().nf();
|
|
|
|
|
|
|
|
const fvPatchField<symmTensor>& sigmaD =
|
|
|
|
patch().lookupPatchField<volSymmTensorField, symmTensor>("sigmaD");
|
|
|
|
|
|
|
|
gradient() =
|
|
|
|
(
|
|
|
|
(traction_ + pressure_*n)/rho.value()
|
2014-06-01 18:12:52 +00:00
|
|
|
+ twoMuLambda*fvPatchField<vector>::snGrad() - (n & sigmaD)
|
2013-10-14 08:26:40 +00:00
|
|
|
)/twoMuLambda;
|
|
|
|
|
|
|
|
Switch thermalStress(thermalProperties.lookup("thermalStress"));
|
|
|
|
|
|
|
|
if (thermalStress)
|
|
|
|
{
|
|
|
|
dimensionedScalar alpha(thermalProperties.lookup("alpha"));
|
|
|
|
dimensionedScalar threeKalpha = threeK*alpha;
|
|
|
|
|
2014-06-01 18:12:52 +00:00
|
|
|
const fvPatchField<scalar>& T =
|
2013-10-14 08:26:40 +00:00
|
|
|
patch().lookupPatchField<volScalarField, scalar>("T");
|
|
|
|
|
|
|
|
gradient() += n*threeKalpha.value()*T/twoMuLambda;
|
|
|
|
}
|
|
|
|
|
|
|
|
fixedGradientFvPatchVectorField::updateCoeffs();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void tractionDisplacementFvPatchVectorField::write(Ostream& os) const
|
|
|
|
{
|
|
|
|
fvPatchVectorField::write(os);
|
|
|
|
traction_.writeEntry("traction", os);
|
|
|
|
pressure_.writeEntry("pressure", os);
|
|
|
|
writeEntry("value", os);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
makePatchTypeField(fvPatchVectorField, tractionDisplacementFvPatchVectorField);
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
} // End namespace Foam
|
|
|
|
|
|
|
|
// ************************************************************************* //
|