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/>.
25 Generate analytical solution for a infinite plaste with a circular
27 Stress field sigma is generated.
28 Based on solution outlined in Timoshenko, Theory of Elasticity.
31 plateHoleSolution function by Z. Tukovic
32 utility assembled by P. Cardiff
34 \*---------------------------------------------------------------------------*/
37 #include "volFields.H"
39 #include "fixedValueFvPatchFields.H"
40 #include "coordinateSystem.H"
42 symmTensor plateHoleSolution(const vector& C);
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 int main(int argc, char *argv[])
48 # include "setRootCase.H"
49 # include "createTime.H"
50 # include "createMesh.H"
54 Info << "Writing analytical solution for an infinite plate with a circular hole,\nwhere"
56 << "\n\tdistant traction = (10,000 0 0 )"
59 volSymmTensorField sigma
63 "sigmaAnalyticalCylin",
70 dimensionedSymmTensor("zero", dimForce/dimArea, symmTensor::zero)
73 const volVectorField& C = mesh.C();
75 forAll(sigma.internalField(), celli)
77 vector curR = vector(C[celli].x(), C[celli].y(), 0);
79 sigma.internalField()[celli] = plateHoleSolution(curR);
82 forAll(sigma.boundaryField(), patchi)
84 forAll(sigma.boundaryField()[patchi], facei)
86 vector curR = vector(C.boundaryField()[patchi][facei].x(), C.boundaryField()[patchi][facei].y(), 0);
88 sigma.boundaryField()[patchi][facei] = plateHoleSolution(curR);
92 Info << "Writing analytical sigma tensor" << endl;
95 Info << nl << "End" << endl;
100 // ************************************************************************* //
103 symmTensor plateHoleSolution(const vector& C)
105 tensor sigma = tensor::zero;
110 scalar r = ::sqrt(sqr(C.x()) + sqr(C.y()));
111 scalar theta = Foam::atan2(C.y(), C.x());
113 coordinateSystem cs("polarCS", C, vector(0, 0, 1), C/mag(C));
116 T*(1 - sqr(a)/sqr(r))/2
117 + T*(1 + 3*pow(a,4)/pow(r,4) - 4*sqr(a)/sqr(r))*::cos(2*theta)/2;
120 - T*(1 - 3*pow(a,4)/pow(r,4) + 2*sqr(a)/sqr(r))*::sin(2*theta)/2;
122 sigma.yx() = sigma.xy();
125 T*(1 + sqr(a)/sqr(r))/2
126 - T*(1 + 3*pow(a,4)/pow(r,4))*::cos(2*theta)/2;
129 // Transformation to global coordinate system
130 sigma = ((cs.R()&sigma)&cs.R().T());
132 symmTensor S = symmTensor::zero;