Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / applications / solvers / solidMechanics / elasticNonLinIncrTLSolidFoam / writeFields.H
blob6aa4612085e4c2b7ca18eee929131179f8e96fd5
1 if (runTime.outputTime())
3     volScalarField epsilonEq
4     (
5         IOobject
6         (
7             "epsilonEq",
8             runTime.timeName(),
9             mesh,
10             IOobject::NO_READ,
11             IOobject::AUTO_WRITE
12         ),
13         sqrt((2.0/3.0)*magSqr(dev(epsilon)))
14     );
16     Info<< "Max epsilonEq = " << max(epsilonEq).value()
17         << endl;
19     volScalarField sigmaEq
20     (
21         IOobject
22         (
23             "sigmaEq",
24             runTime.timeName(),
25             mesh,
26             IOobject::NO_READ,
27             IOobject::AUTO_WRITE
28         ),
29         sqrt((3.0/2.0)*magSqr(dev(sigma)))
30     );
32     Info<< "Max sigmaEq = " << max(sigmaEq).value()
33         << endl;
35     //- Calculate Cauchy stress
36     volTensorField F = I + gradU;
37     volScalarField J = det(F);
39     //- update density
40     rho = rho/J;
42     volSymmTensorField sigmaCauchy
43     (
44         IOobject
45         (
46             "sigmaCauchy",
47             runTime.timeName(),
48             mesh,
49             IOobject::NO_READ,
50             IOobject::AUTO_WRITE
51         ),
52         (1/J) * symm(F.T() & sigma & F)
53     );
55     //- Cauchy von Mises stress
56     volScalarField sigmaCauchyEq
57     (
58         IOobject
59         (
60             "sigmaCauchyEq",
61             runTime.timeName(),
62             mesh,
63             IOobject::NO_READ,
64             IOobject::AUTO_WRITE
65        ),
66        sqrt((3.0/2.0)*magSqr(dev(sigmaCauchy)))
67     );
69     Info<< "Max sigmaCauchyEq = " << max(sigmaCauchyEq).value()
70         << endl;
72     volTensorField Finv = inv(F);
73     volSymmTensorField epsilonAlmansi
74     (
75         IOobject
76         (
77             "epsilonAlmansi",
78             runTime.timeName(),
79             mesh,
80             IOobject::NO_READ,
81             IOobject::AUTO_WRITE
82        ),
83        symm(Finv & epsilon & Finv.T())
84     );
86     //- boundary traction
87     volVectorField traction
88     (
89         IOobject
90         (
91             "tractionCauchy",
92             runTime.timeName(),
93             mesh,
94             IOobject::NO_READ,
95             IOobject::AUTO_WRITE
96         ),
97         mesh,
98         dimensionedVector("zero", dimForce/dimArea, vector::zero)
99     );
100     forAll(traction.boundaryField(), patchi)
101     {
102         tensorField Fpatch = I + gradU.boundaryField()[patchi];
104         traction.boundaryField()[patchi] =
105             n.boundaryField()[patchi] & (sigma.boundaryField()[patchi] & Fpatch);
106     }
108     runTime.write();