This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/solvers/solidMechanics/solidModels/fvPatchFields/fixedDisplacement/fixedDisplacementFvPatchVectorField.C

181 lines
5 KiB
C
Raw Normal View History

2012-09-11 15:42:55 +00:00
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "fixedDisplacementFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "fvcMeshPhi.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
fixedDisplacementFvPatchVectorField::fixedDisplacementFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchVectorField(p, iF),
fieldName_("undefined")
{}
fixedDisplacementFvPatchVectorField::fixedDisplacementFvPatchVectorField
(
const fixedDisplacementFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchVectorField(ptf, p, iF, mapper),
fieldName_(ptf.fieldName_)
{}
fixedDisplacementFvPatchVectorField::fixedDisplacementFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchVectorField(p, iF, dict),
fieldName_(dimensionedInternalField().name())
{
//- the leastSquares has zero non-orthogonal correction
//- on the boundary
//- so the gradient scheme should be extendedLeastSquares
2013-07-09 10:06:50 +00:00
if
(
Foam::word
(
dimensionedInternalField().mesh().schemesDict().gradScheme
(
"grad(" + fieldName_ + ")"
)
) != "extendedLeastSquares"
)
{
Warning << "The gradScheme for " << fieldName_
<< " should be \"extendedLeastSquares 0\" for the boundary "
<< "non-orthogonal correction to be right" << endl;
2013-07-09 10:06:50 +00:00
}
2012-09-11 15:42:55 +00:00
}
fixedDisplacementFvPatchVectorField::fixedDisplacementFvPatchVectorField
(
const fixedDisplacementFvPatchVectorField& pivpvf
)
:
fixedValueFvPatchVectorField(pivpvf),
fieldName_(pivpvf.fieldName_)
{}
fixedDisplacementFvPatchVectorField::fixedDisplacementFvPatchVectorField
(
const fixedDisplacementFvPatchVectorField& pivpvf,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchVectorField(pivpvf, iF),
fieldName_(pivpvf.fieldName_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::Field<vector> > fixedDisplacementFvPatchVectorField::
snGrad() const
{
//- fixedValue snGrad with no correction
// return (*this - patchInternalField())*this->patch().deltaCoeffs();
2012-09-11 15:42:55 +00:00
const fvPatchField<tensor>& gradField =
patch().lookupPatchField<volTensorField, tensor>
(
"grad(" +fieldName_ + ")"
);
vectorField n = this->patch().nf();
vectorField delta = this->patch().delta();
//- correction vector
vectorField k = delta - n*(n&delta);
return
2012-09-11 15:42:55 +00:00
(
*this
2012-09-11 15:42:55 +00:00
- (patchInternalField() + (k&gradField.patchInternalField()))
)*this->patch().deltaCoeffs();
}
tmp<Field<vector> > fixedDisplacementFvPatchVectorField::
gradientBoundaryCoeffs() const
{
const fvPatchField<tensor>& gradField =
patch().lookupPatchField<volTensorField, tensor>
(
"grad(" +fieldName_ + ")"
);
vectorField n = this->patch().nf();
vectorField delta = this->patch().delta();
//- correction vector
vectorField k = delta - n*(n&delta);
return this->patch().deltaCoeffs()
*(*this - (k&gradField.patchInternalField()));
}
void fixedDisplacementFvPatchVectorField::write(Ostream& os) const
{
fixedValueFvPatchVectorField::write(os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchVectorField,
fixedDisplacementFvPatchVectorField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //