tractionDisplacementFvPatchVectorField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
33 (
34  const fvPatch& p,
36 )
37 :
38  fixedGradientFvPatchVectorField(p, iF),
39  traction_(p.size(), Zero),
40  pressure_()
41 {
42  fvPatchVectorField::operator=(patchInternalField());
43  gradient() = Zero;
44 }
45 
46 
49 (
50  const fvPatch& p,
52  const dictionary& dict
53 )
54 :
55  fixedGradientFvPatchVectorField(p, iF),
56  traction_("traction", dimPressure, dict, p.size()),
57  pressure_
58  (
59  Function1<scalar>::New
60  (
61  "pressure",
62  db().time().userUnits(),
64  dict
65  )
66  )
67 {
68  fvPatchVectorField::operator=(patchInternalField());
69  gradient() = Zero;
70 }
71 
72 
75 (
77  const fvPatch& p,
79  const fieldMapper& mapper
80 )
81 :
82  fixedGradientFvPatchVectorField(tdpvf, p, iF, mapper),
83  traction_(mapper(tdpvf.traction_)),
84  pressure_(tdpvf.pressure_, false)
85 {}
86 
87 
90 (
93 )
94 :
95  fixedGradientFvPatchVectorField(tdpvf, iF),
96  traction_(tdpvf.traction_),
97  pressure_(tdpvf.pressure_, false)
98 {}
99 
100 
101 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
102 
104 (
105  const fvPatchVectorField& ptf,
106  const fieldMapper& mapper
107 )
108 {
109  fixedGradientFvPatchVectorField::map(ptf, mapper);
110 
112  refCast<const tractionDisplacementFvPatchVectorField>(ptf);
113 
114  mapper(traction_, dmptf.traction_);
115 }
116 
117 
119 (
120  const fvPatchVectorField& ptf
121 )
122 {
123  fixedGradientFvPatchVectorField::reset(ptf);
124 
126  refCast<const tractionDisplacementFvPatchVectorField>(ptf);
127 
128  traction_.reset(dmptf.traction_);
129 }
130 
131 
133 {
134  if (updated())
135  {
136  return;
137  }
138 
139  this->updateCoeffs(pressure_->value(db().time().value()));
140 }
141 
142 
144 {
146  writeEntry(os, "traction", traction_);
147  writeEntry(os, db().time().userUnits(), dimPressure, pressure_());
148  writeEntry(os, "value", *this);
149 }
150 
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 namespace Foam
155 {
157  (
160  );
161 }
162 
163 
164 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Run-time selectable general function of one variable.
Definition: Function1.H:125
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Abstract base class for field mapping.
Definition: fieldMapper.H:48
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:88
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:229
virtual void operator=(const UList< Type > &)
Definition: fvPatchField.C:249
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
Fixed traction boundary condition for the standard linear elastic, fixed coefficient displacement equ...
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void reset(const fvPatchVectorField &)
Reset the fvPatchField to the given fvPatchField.
tractionDisplacementFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
virtual void map(const fvPatchVectorField &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
Namespace for OpenFOAM.
static const zero Zero
Definition: zero.H:97
const dimensionSet dimPressure
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
dictionary dict
volScalarField & p