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-2022 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,
35  const DimensionedField<vector, volMesh>& iF
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,
51  const DimensionedField<vector, volMesh>& iF,
52  const dictionary& dict
53 )
54 :
55  fixedGradientFvPatchVectorField(p, iF),
56  traction_("traction", dict, p.size()),
57  pressure_(Function1<scalar>::New("pressure", dict))
58 {
59  fvPatchVectorField::operator=(patchInternalField());
60  gradient() = Zero;
61 }
62 
63 
66 (
68  const fvPatch& p,
69  const DimensionedField<vector, volMesh>& iF,
70  const fvPatchFieldMapper& mapper
71 )
72 :
73  fixedGradientFvPatchVectorField(tdpvf, p, iF, mapper),
74  traction_(mapper(tdpvf.traction_)),
75  pressure_(tdpvf.pressure_, false)
76 {}
77 
78 
81 (
83  const DimensionedField<vector, volMesh>& iF
84 )
85 :
86  fixedGradientFvPatchVectorField(tdpvf, iF),
87  traction_(tdpvf.traction_),
88  pressure_(tdpvf.pressure_, false)
89 {}
90 
91 
92 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
93 
95 (
96  const fvPatchFieldMapper& m
97 )
98 {
99  fixedGradientFvPatchVectorField::autoMap(m);
100  m(traction_, traction_);
101 }
102 
103 
105 (
106  const fvPatchVectorField& ptf,
107  const labelList& addr
108 )
109 {
110  fixedGradientFvPatchVectorField::rmap(ptf, addr);
111 
113  refCast<const tractionDisplacementFvPatchVectorField>(ptf);
114 
115  traction_.rmap(dmptf.traction_, addr);
116 }
117 
118 
120 (
121  const fvPatchVectorField& ptf
122 )
123 {
124  fixedGradientFvPatchVectorField::reset(ptf);
125 
127  refCast<const tractionDisplacementFvPatchVectorField>(ptf);
128 
129  traction_.reset(dmptf.traction_);
130 }
131 
132 
134 {
135  if (updated())
136  {
137  return;
138  }
139 
140  this->updateCoeffs(pressure_->value(this->db().time().userTimeValue()));
141 }
142 
143 
145 {
147  writeEntry(os, "traction", traction_);
148  writeEntry(os, pressure_());
149  writeEntry(os, "value", *this);
150 }
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 namespace Foam
156 {
158  (
161  );
162 }
163 
164 
165 // ************************************************************************* //
fvPatchField< vector > fvPatchVectorField
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void write(Ostream &) const
Write.
tractionDisplacementFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:243
Macros for easy insertion into run-time selection tables.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
virtual void reset(const fvPatchVectorField &)
Reset the fvPatchField to the given fvPatchField.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
List< label > labelList
A List of labels.
Definition: labelList.H:56
static const zero Zero
Definition: zero.H:97
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
virtual void operator=(const UList< Type > &)
Definition: fvPatchField.C:258
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Namespace for OpenFOAM.