hydrostaticDisplacementFvPatchVectorField: New experimental traction boundary condition for solidDisplacementFoam

Description
    Fixed traction boundary condition for the standard linear elastic, fixed
    coefficient displacement equation in which the traction is caused by
    the hydrostatic pressure of an external liquid reservoir.
This commit is contained in:
Henry Weller
2018-09-21 22:12:21 +01:00
parent 82d8784901
commit a098cdb710
6 changed files with 324 additions and 28 deletions

View File

@ -1,4 +1,5 @@
tractionDisplacement/tractionDisplacementFvPatchVectorField.C
derivedFvPatchFields/tractionDisplacement/tractionDisplacementFvPatchVectorField.C
derivedFvPatchFields/hydrostaticDisplacement/hydrostaticDisplacementFvPatchVectorField.C
solidDisplacementFoam.C
EXE = $(FOAM_APPBIN)/solidDisplacementFoam

View File

@ -1,6 +1,6 @@
EXE_INC = \
-I. \
-ItractionDisplacement \
-IderivedFvPatchFields/tractionDisplacement \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude

View File

@ -0,0 +1,149 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 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 "hydrostaticDisplacementFvPatchVectorField.H"
#include "uniformDimensionedFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::hydrostaticDisplacementFvPatchVectorField::
hydrostaticDisplacementFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
tractionDisplacementFvPatchVectorField(p, iF),
rhoLiquid_(0.0),
liquidSurfacePressure_(0.0),
liquidSurfacePoint_(Zero)
{}
Foam::hydrostaticDisplacementFvPatchVectorField::
hydrostaticDisplacementFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
tractionDisplacementFvPatchVectorField(p, iF),
rhoLiquid_(readScalar(dict.lookup("rhoLiquid"))),
liquidSurfacePressure_(readScalar(dict.lookup("liquidSurfacePressure"))),
liquidSurfacePoint_(dict.lookup("liquidSurfacePoint"))
{}
Foam::hydrostaticDisplacementFvPatchVectorField::
hydrostaticDisplacementFvPatchVectorField
(
const hydrostaticDisplacementFvPatchVectorField& tdpvf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
tractionDisplacementFvPatchVectorField(tdpvf, p, iF, mapper),
rhoLiquid_(tdpvf.rhoLiquid_),
liquidSurfacePressure_(tdpvf.liquidSurfacePressure_),
liquidSurfacePoint_(tdpvf.liquidSurfacePoint_)
{}
Foam::hydrostaticDisplacementFvPatchVectorField::
hydrostaticDisplacementFvPatchVectorField
(
const hydrostaticDisplacementFvPatchVectorField& tdpvf
)
:
tractionDisplacementFvPatchVectorField(tdpvf),
rhoLiquid_(tdpvf.rhoLiquid_),
liquidSurfacePressure_(tdpvf.liquidSurfacePressure_),
liquidSurfacePoint_(tdpvf.liquidSurfacePoint_)
{}
Foam::hydrostaticDisplacementFvPatchVectorField::
hydrostaticDisplacementFvPatchVectorField
(
const hydrostaticDisplacementFvPatchVectorField& tdpvf,
const DimensionedField<vector, volMesh>& iF
)
:
tractionDisplacementFvPatchVectorField(tdpvf, iF),
rhoLiquid_(tdpvf.rhoLiquid_),
liquidSurfacePressure_(tdpvf.liquidSurfacePressure_),
liquidSurfacePoint_(tdpvf.liquidSurfacePoint_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::hydrostaticDisplacementFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
const uniformDimensionedVectorField& g =
db().lookupObject<uniformDimensionedVectorField>("g");
pressure() =
liquidSurfacePressure_
+ rhoLiquid_
*max(g.value() & (patch().Cf() - liquidSurfacePoint_), scalar(0));
tractionDisplacementFvPatchVectorField::updateCoeffs();
}
void Foam::hydrostaticDisplacementFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
os.writeKeyword("rhoLiquid") << rhoLiquid_ << token::END_STATEMENT << nl;
os.writeKeyword("liquidSurfacePressure")
<< liquidSurfacePressure_ << token::END_STATEMENT << nl;
os.writeKeyword("liquidSurfacePoint")
<< liquidSurfacePoint_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
hydrostaticDisplacementFvPatchVectorField
);
}
// ************************************************************************* //

View File

@ -0,0 +1,153 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018 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::hydrostaticDisplacementFvPatchVectorField
Description
Fixed traction boundary condition for the standard linear elastic, fixed
coefficient displacement equation in which the traction is caused by
the hydrostatic pressure of an external liquid reservoir.
SourceFiles
hydrostaticDisplacementFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef hydrostaticDisplacementFvPatchVectorField_H
#define hydrostaticDisplacementFvPatchVectorField_H
#include "tractionDisplacementFvPatchVectorField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class hydrostaticDisplacementFvPatch Declaration
\*---------------------------------------------------------------------------*/
class hydrostaticDisplacementFvPatchVectorField
:
public tractionDisplacementFvPatchVectorField
{
// Private Data
//- Density of surrounding liquid
scalar rhoLiquid_;
//- Pressure above the liquid
scalar liquidSurfacePressure_;
//- Point on liquid surface
vector liquidSurfacePoint_;
public:
//- Runtime type information
TypeName("hydrostaticDisplacement");
// Constructors
//- Construct from patch and internal field
hydrostaticDisplacementFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
hydrostaticDisplacementFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// hydrostaticDisplacementFvPatchVectorField onto a new patch
hydrostaticDisplacementFvPatchVectorField
(
const hydrostaticDisplacementFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
hydrostaticDisplacementFvPatchVectorField
(
const hydrostaticDisplacementFvPatchVectorField&
);
//- Construct and return a clone
virtual tmp<fvPatchVectorField> clone() const
{
return tmp<fvPatchVectorField>
(
new hydrostaticDisplacementFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
hydrostaticDisplacementFvPatchVectorField
(
const hydrostaticDisplacementFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchVectorField> clone
(
const DimensionedField<vector, volMesh>& iF
) const
{
return tmp<fvPatchVectorField>
(
new hydrostaticDisplacementFvPatchVectorField(*this, iF)
);
}
// Member functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,17 +24,12 @@ License
\*---------------------------------------------------------------------------*/
#include "tractionDisplacementFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
tractionDisplacementFvPatchVectorField::
Foam::tractionDisplacementFvPatchVectorField::
tractionDisplacementFvPatchVectorField
(
const fvPatch& p,
@ -50,7 +45,7 @@ tractionDisplacementFvPatchVectorField
}
tractionDisplacementFvPatchVectorField::
Foam::tractionDisplacementFvPatchVectorField::
tractionDisplacementFvPatchVectorField
(
const tractionDisplacementFvPatchVectorField& tdpvf,
@ -65,7 +60,7 @@ tractionDisplacementFvPatchVectorField
{}
tractionDisplacementFvPatchVectorField::
Foam::tractionDisplacementFvPatchVectorField::
tractionDisplacementFvPatchVectorField
(
const fvPatch& p,
@ -82,7 +77,7 @@ tractionDisplacementFvPatchVectorField
}
tractionDisplacementFvPatchVectorField::
Foam::tractionDisplacementFvPatchVectorField::
tractionDisplacementFvPatchVectorField
(
const tractionDisplacementFvPatchVectorField& tdpvf
@ -94,7 +89,7 @@ tractionDisplacementFvPatchVectorField
{}
tractionDisplacementFvPatchVectorField::
Foam::tractionDisplacementFvPatchVectorField::
tractionDisplacementFvPatchVectorField
(
const tractionDisplacementFvPatchVectorField& tdpvf,
@ -109,7 +104,7 @@ tractionDisplacementFvPatchVectorField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void tractionDisplacementFvPatchVectorField::autoMap
void Foam::tractionDisplacementFvPatchVectorField::autoMap
(
const fvPatchFieldMapper& m
)
@ -120,7 +115,7 @@ void tractionDisplacementFvPatchVectorField::autoMap
}
void tractionDisplacementFvPatchVectorField::rmap
void Foam::tractionDisplacementFvPatchVectorField::rmap
(
const fvPatchVectorField& ptf,
const labelList& addr
@ -136,7 +131,7 @@ void tractionDisplacementFvPatchVectorField::rmap
}
void tractionDisplacementFvPatchVectorField::updateCoeffs()
void Foam::tractionDisplacementFvPatchVectorField::updateCoeffs()
{
if (updated())
{
@ -202,7 +197,7 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
}
void tractionDisplacementFvPatchVectorField::write(Ostream& os) const
void Foam::tractionDisplacementFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
traction_.writeEntry("traction", os);
@ -213,14 +208,14 @@ void tractionDisplacementFvPatchVectorField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchVectorField,
tractionDisplacementFvPatchVectorField
);
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
tractionDisplacementFvPatchVectorField
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -36,7 +36,6 @@ SourceFiles
#ifndef tractionDisplacementFvPatchVectorField_H
#define tractionDisplacementFvPatchVectorField_H
#include "fvPatchFields.H"
#include "fixedGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,7 +51,6 @@ class tractionDisplacementFvPatchVectorField
:
public fixedGradientFvPatchVectorField
{
// Private Data
vectorField traction_;
@ -146,7 +144,7 @@ public:
return pressure_;
}
virtual scalarField& pressure()
virtual scalarField& pressure()
{
return pressure_;
}