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 "orthotropicLinearElastic.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "zeroGradientFvPatchFields.H"
29 #include "transformField.H"
30 #include "transformGeometricField.H"
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
36 defineTypeNameAndDebug(orthotropicLinearElastic, 0);
37 addToRunTimeSelectionTable
38 (rheologyLaw, orthotropicLinearElastic, dictionary);
42 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47 // Construct from dictionary
48 Foam::orthotropicLinearElastic::orthotropicLinearElastic
51 const volSymmTensorField& sigma,
52 const dictionary& dict
55 rheologyLaw(name, sigma, dict),
56 rho_(dict.lookup("rho")),
57 Ex_(dict.lookup("Ex")),
58 Ey_(dict.lookup("Ey")),
59 Ez_(dict.lookup("Ez")),
61 nuxy_(dict.lookup("nuxy")),
62 nuyz_(dict.lookup("nuyz")),
63 nuzx_(dict.lookup("nuzx")),
68 Gxy_(dict.lookup("Gxy")),
69 Gyz_(dict.lookup("Gyz")),
70 Gzx_(dict.lookup("Gzx")),
72 (1 - nuxy_*nuyx_ - nuyz_*nuzy_ - nuzx_*nuxz_ - 2*nuyx_*nuzy_*nuxz_)
75 A11_( (1 - nuyz_*nuzy_)/(J_*Ey_*Ez_) ),
76 A22_( (1 - nuxz_*nuzx_)/(J_*Ex_*Ez_) ),
77 A33_( (1 - nuyx_*nuxy_)/(J_*Ey_*Ex_) ),
78 A12_( (nuxy_ + nuzy_*nuxz_)/(J_*Ex_*Ez_) ),
79 A31_( (nuzx_ + nuyx_*nuzy_)/(J_*Ey_*Ez_) ),
80 A23_( (nuyz_ + nuyx_*nuxz_)/(J_*Ex_*Ey_) ),
88 mesh().time().timeName(),
94 dimensionedSymmTensor4thOrder
98 symmTensor4thOrder(A11_.value(), A12_.value(), A31_.value(),
99 A22_.value(), A23_.value(),
105 zeroGradientFvPatchSymmTensor4thOrderField::typeName
110 "materialDirections",
111 mesh().time().timeName(),
119 //- check material properties lie within physical constraints
120 //- ref Abaqus analysis user's manual orthotropic material
121 Info<< "\tChecking physical constraints on the orthotropic"
122 << " material properties" << endl;
124 //- E and G should be greater than zero
125 if (Ex_.value() < 0.0 || Ey_.value() < 0.0 || Ez_.value() < 0.0
126 || Gxy_.value() < 0.0 || Gyz_.value() < 0.0 || Gzx_.value() < 0.0)
128 FatalError << "Ex, Ey, Ez, Gxy, Gyz, Gzx should all be greater than zero!"
132 //- restriction on Poisson's ratio
133 if (mag(nuxy_.value()) >= sqrt(Ex_.value()/Ey_.value())
134 || mag(nuyz_.value()) >= sqrt(Ey_.value()/Ez_.value())
135 || mag(nuzx_.value()) >= sqrt(Ez_.value()/Ex_.value()))
137 FatalError << "mag(nuij) should be less sqrt(Ei/Ej)"
143 (1 - nuxy_*nuyx_ - nuyz_*nuzy_
144 - nuzx_*nuxz_ - 2*nuyx_*nuzy_*nuxz_).value()
148 << "(1 - nuxy*nuyx - nuyz*nuzy "
149 << "- nuzx*nuxz - 2*nuyx*nuzy*nuxz) should be greater than zero!"
154 Info<< "\tRotating local material properties to global coordinate system"
162 mesh().time().timeName(),
168 dimensionedTensor("zero", dimless, tensor::zero),
169 zeroGradientFvPatchTensorField::typeName
172 //- make sure matDir_ are unit directions
173 forAll(matDir_, celli)
177 mag(vector(matDir_[celli][0], matDir_[celli][1], matDir_[celli][2]));
178 matDir_[celli][0] /= magVec;
179 matDir_[celli][1] /= magVec;
180 matDir_[celli][2] /= magVec;
184 mag(vector(matDir_[celli][3], matDir_[celli][4], matDir_[celli][5]));
185 matDir_[celli][3] /= magVec;
186 matDir_[celli][4] /= magVec;
187 matDir_[celli][5] /= magVec;
191 mag(vector(matDir_[celli][6], matDir_[celli][7], matDir_[celli][8]));
192 matDir_[celli][6] /= magVec;
193 matDir_[celli][7] /= magVec;
194 matDir_[celli][8] /= magVec;
205 // R_ij = xold_i & xnew_i;
207 vector mD(matDir_[celli][0], matDir_[celli][1], matDir_[celli][2]);
208 R[celli][0] = e0 & mD;
209 R[celli][1] = e1 & mD;
210 R[celli][2] = e2 & mD;
213 vector mD(matDir_[celli][3], matDir_[celli][4], matDir_[celli][5]);
214 R[celli][3] = e0 & mD;
215 R[celli][4] = e1 & mD;
216 R[celli][5] = e2 & mD;
219 vector mD(matDir_[celli][6], matDir_[celli][7], matDir_[celli][8]);
220 R[celli][6] = e0 & mD;
221 R[celli][7] = e1 & mD;
222 R[celli][8] = e2 & mD;
226 //Info << "R is " << R.internalField() << endl;
227 R.correctBoundaryConditions();
230 //- rotate C to global corrdinate system
231 //C_.correctBoundaryConditions();
232 C_ = transform(R, C_);
233 C_.correctBoundaryConditions();
237 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
239 Foam::orthotropicLinearElastic::~orthotropicLinearElastic()
243 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
245 Foam::tmp<Foam::volScalarField> Foam::orthotropicLinearElastic::rho() const
247 tmp<volScalarField> tresult
254 mesh().time().timeName(),
261 zeroGradientFvPatchScalarField::typeName
265 tresult().correctBoundaryConditions();
271 Foam::tmp<Foam::volScalarField> Foam::orthotropicLinearElastic::E() const
273 tmp<volScalarField> tresult
280 mesh().time().timeName(),
287 zeroGradientFvPatchScalarField::typeName
291 tresult().correctBoundaryConditions();
297 Foam::tmp<Foam::volScalarField> Foam::orthotropicLinearElastic::nu() const
299 tmp<volScalarField> tresult
306 mesh().time().timeName(),
313 zeroGradientFvPatchScalarField::typeName
317 tresult().correctBoundaryConditions();
322 Foam::tmp<Foam::volScalarField> Foam::orthotropicLinearElastic::Ep() const
324 // notImplemented(type() + "::Ep()");
326 return tmp<volScalarField>
333 mesh().time().timeName(),
339 dimensionedScalar("zeroEp", dimForce/dimArea, 0.0),
340 zeroGradientFvPatchScalarField::typeName
345 Foam::tmp<Foam::volScalarField> Foam::orthotropicLinearElastic::sigmaY() const
347 // notImplemented(type() + "::sigmaY()");
349 return tmp<volScalarField>
356 mesh().time().timeName(),
362 dimensionedScalar("zeroSigmaY", dimForce/dimArea, GREAT),
363 zeroGradientFvPatchScalarField::typeName
368 Foam::scalar Foam::orthotropicLinearElastic::sigmaY
369 (const scalar epsilonPEq, const label cellID) const
374 //Foam::tmp<Foam::volTensorField> Foam::orthotropicLinearElastic::K() const
375 Foam::tmp<Foam::volDiagTensorField> Foam::orthotropicLinearElastic::K() const
377 tmp<volDiagTensorField> tresult
379 new volDiagTensorField
384 mesh().time().timeName(),
390 dimensionedDiagTensor("zero", A11_.dimensions(), diagTensor::zero),
391 zeroGradientFvPatchScalarField::typeName
395 volDiagTensorField& K = tresult();
399 K[celli].xx() = C_[celli].xxxx();
400 K[celli].yy() = C_[celli].yyyy();
401 K[celli].zz() = C_[celli].zzzz();
404 K.correctBoundaryConditions();
409 Foam::tmp<Foam::volSymmTensor4thOrderField>
410 Foam::orthotropicLinearElastic::C() const
412 tmp<volSymmTensor4thOrderField> tresult
414 new volSymmTensor4thOrderField
420 volSymmTensor4thOrderField& result = tresult();
422 result.correctBoundaryConditions();
426 // ************************************************************************* //