Fixed URL for libccmio-2.6.1 (bug report #5 by Thomas Oliveira)
[foam-extend-3.2.git] / applications / solvers / solidMechanics / stressFemFoam / calculateStress.H
blob3e4619cef0c884926627d927a797e68f2fb323ea
1     if (runTime.outputTime())
2     {
3         // Displacement gradient
4         tetPointTensorField gradU = tetFec::grad(U);
6         // Stress tensor
7         tetPointSymmTensorField sigma =
8             rho*(2.0*mu*symm(gradU) + lambda*I*tr(gradU));
11         // Create pointMesh for field post-processing
12         const pointMesh& pMesh = pointMesh::New(mesh);
14         // U
15         pointVectorField Up
16         (
17             IOobject
18             (
19                 "Up",
20                 runTime.timeName(),
21                 mesh,
22                 IOobject::NO_READ,
23                 IOobject::AUTO_WRITE
24             ),
25             pMesh,
26             U.dimensions()
27         );
29         Up.internalField() = vectorField::subField
30         (
31             U.internalField(),
32             pMesh.size()
33         );
35         // sigmaEq
36         pointScalarField sigmaEq
37         (
38             IOobject
39             (
40                 "sigmaEq",
41                 runTime.timeName(),
42                 mesh,
43                 IOobject::NO_READ,
44                 IOobject::AUTO_WRITE
45             ),
46             pMesh,
47             sigma.dimensions()
48         );
50         sigmaEq.internalField() = scalarField::subField
51         (
52             sqrt((3.0/2.0)*magSqr(dev(sigma.internalField())))(),
53             pMesh.size()
54         );
56         // sigmaXX
57         pointScalarField sigmaXX
58         (
59             IOobject
60             (
61                 "sigmaXX",
62                 runTime.timeName(),
63                 mesh,
64                 IOobject::NO_READ,
65                 IOobject::AUTO_WRITE
66             ),
67             pMesh,
68             sigma.dimensions()
69         );
71         sigmaXX.internalField() = scalarField::subField
72         (
73             sigma.component(symmTensor::XX)().internalField(),
74             pMesh.size()
75         );
77         // sigmaYY
78         pointScalarField sigmaYY
79         (
80             IOobject
81             (
82                 "sigmaYY",
83                 runTime.timeName(),
84                 mesh,
85                 IOobject::NO_READ,
86                 IOobject::AUTO_WRITE
87             ),
88             pMesh,
89             sigma.dimensions()
90         );
92         sigmaYY.internalField() = scalarField::subField
93         (
94             sigma.component(symmTensor::YY)().internalField(),
95             pMesh.size()
96         );
98         // sigmaXY
99         pointScalarField sigmaXY
100         (
101             IOobject
102             (
103                 "sigmaXY",
104                 runTime.timeName(),
105                 mesh,
106                 IOobject::NO_READ,
107                 IOobject::AUTO_WRITE
108             ),
109             pMesh,
110             sigma.dimensions()
111         );
113         sigmaXY.internalField() = scalarField::subField
114         (
115             sigma.component(symmTensor::XY)().internalField(),
116             pMesh.size()
117         );
119         runTime.write();
120     }