1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "analyticalPlateHoleTractionFvPatchVectorField.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "volFields.H"
29 #include "constitutiveModel.H"
30 #include "volFields.H"
32 #include "fixedValueFvPatchFields.H"
33 #include "coordinateSystem.H"
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 analyticalPlateHoleTractionFvPatchVectorField::
43 analyticalPlateHoleTractionFvPatchVectorField
46 const DimensionedField<vector, volMesh>& iF
49 fixedGradientFvPatchVectorField(p, iF),
52 fvPatchVectorField::operator=(patchInternalField());
53 gradient() = vector::zero;
57 analyticalPlateHoleTractionFvPatchVectorField::
58 analyticalPlateHoleTractionFvPatchVectorField
61 const DimensionedField<vector, volMesh>& iF,
62 const dictionary& dict
65 fixedGradientFvPatchVectorField(p, iF),
68 fvPatchVectorField::operator=(patchInternalField());
69 gradient() = vector::zero;
73 analyticalPlateHoleTractionFvPatchVectorField::
74 analyticalPlateHoleTractionFvPatchVectorField
76 const analyticalPlateHoleTractionFvPatchVectorField& stpvf,
78 const DimensionedField<vector, volMesh>& iF,
79 const fvPatchFieldMapper& mapper
82 fixedGradientFvPatchVectorField(stpvf, p, iF, mapper),
87 analyticalPlateHoleTractionFvPatchVectorField::
88 analyticalPlateHoleTractionFvPatchVectorField
90 const analyticalPlateHoleTractionFvPatchVectorField& stpvf
93 fixedGradientFvPatchVectorField(stpvf),
98 analyticalPlateHoleTractionFvPatchVectorField::
99 analyticalPlateHoleTractionFvPatchVectorField
101 const analyticalPlateHoleTractionFvPatchVectorField& stpvf,
102 const DimensionedField<vector, volMesh>& iF
105 fixedGradientFvPatchVectorField(stpvf, iF),
110 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
112 void analyticalPlateHoleTractionFvPatchVectorField::autoMap
114 const fvPatchFieldMapper& m
117 fixedGradientFvPatchVectorField::autoMap(m);
121 // Reverse-map the given fvPatchField onto this fvPatchField
122 void analyticalPlateHoleTractionFvPatchVectorField::rmap
124 const fvPatchVectorField& ptf,
125 const labelList& addr
128 fixedGradientFvPatchVectorField::rmap(ptf, addr);
132 // Update the coefficients associated with the patch field
133 void analyticalPlateHoleTractionFvPatchVectorField::updateCoeffs()
140 vectorField n = patch().nf();
142 const constitutiveModel& rheology =
143 this->db().objectRegistry::lookupObject<constitutiveModel>
144 ("rheologyProperties");
146 rheology.mu()().boundaryField()[patch().index()];
148 rheology.lambda()().boundaryField()[patch().index()];
150 const fvPatchField<tensor>& gradU =
151 patch().lookupPatchField<volTensorField, tensor>
152 ("grad(" + UName_ + ")");
154 vectorField Traction(n.size(),vector::zero);
156 const vectorField& Cf = patch().Cf();
158 forAll(Traction, faceI)
160 vector curC(Cf[faceI].x(), Cf[faceI].y(), 0);
161 vector curN = n[faceI];
163 if (patch().name() == "hole")
168 curN = -curC/mag(curC);
172 (n[faceI] & plateHoleSolution(curC));
175 //- set patch gradient
176 vectorField newGradient =
178 - (n & (mu*gradU.T() - (mu + lambda)*gradU))
179 - n*lambda*tr(gradU);
181 newGradient /= (2.0*mu + lambda);
183 gradient() = newGradient;
185 fixedGradientFvPatchVectorField::updateCoeffs();
189 void analyticalPlateHoleTractionFvPatchVectorField::evaluate
190 (const Pstream::commsTypes)
192 if (!this->updated())
194 this->updateCoeffs();
197 const fvPatchField<tensor>& gradDU =
198 patch().lookupPatchField<volTensorField, tensor>
200 "grad(" + UName_ + ")"
203 vectorField n = patch().nf();
204 vectorField delta = patch().delta();
206 vectorField k = delta - n*(n&delta);
208 Field<vector>::operator=
210 this->patchInternalField()
211 + (k&gradDU.patchInternalField())
212 + gradient()/this->patch().deltaCoeffs()
215 fvPatchField<vector>::evaluate();
219 void analyticalPlateHoleTractionFvPatchVectorField::write(Ostream& os) const
221 fvPatchVectorField::write(os);
222 writeEntry("value", os);
225 symmTensor analyticalPlateHoleTractionFvPatchVectorField::plateHoleSolution
228 tensor sigma = tensor::zero;
233 scalar r = ::sqrt(sqr(C.x()) + sqr(C.y()));
234 scalar theta = Foam::atan2(C.y(), C.x());
236 coordinateSystem cs("polarCS", C, vector(0, 0, 1), C/mag(C));
239 T*(1 - sqr(a)/sqr(r))/2
240 + T*(1 + 3*pow(a,4)/pow(r,4) - 4*sqr(a)/sqr(r))*::cos(2*theta)/2;
243 - T*(1 - 3*pow(a,4)/pow(r,4) + 2*sqr(a)/sqr(r))*::sin(2*theta)/2;
245 sigma.yx() = sigma.xy();
248 T*(1 + sqr(a)/sqr(r))/2
249 - T*(1 + 3*pow(a,4)/pow(r,4))*::cos(2*theta)/2;
252 // Transformation to global coordinate system
253 sigma = ((cs.R()&sigma)&cs.R().T());
255 symmTensor S = symmTensor::zero;
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
269 analyticalPlateHoleTractionFvPatchVectorField
272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
274 } // End namespace Foam
276 // ************************************************************************* //