Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / applications / solvers / solidMechanics / elasticIncrAcpSolidFoam / writeFields.H
blob306621ba226a6388b18c963c74f3d08ef18406d2
2 if (runTime.outputTime() || topoChange)
4     volScalarField sigmaEq
5     (
6         IOobject
7         (
8             "sigmaEq",
9             runTime.timeName(),
10             mesh,
11             IOobject::NO_READ,
12             IOobject::AUTO_WRITE
13         ),
14         sqrt((3.0/2.0)*magSqr(dev(sigma)))
15     );
17     Info<< "Max sigmaEq = " << max(sigmaEq).value()
18         << endl;
20     volScalarField epsilonEq
21     (
22         IOobject
23         (
24             "epsilonEq",
25             runTime.timeName(),
26             mesh,
27             IOobject::NO_READ,
28             IOobject::AUTO_WRITE
29         ),
30         sqrt((2.0/3.0)*magSqr(dev(epsilon)))
31     );
33     Info<< "Max epsilonEq = " << max(epsilonEq).value()
34         << endl;
36 //     Info << "\nCalculate maximal principal stress ..." << flush;
37 //     // Principal stresses
38 //     volVectorField sigmaMax
39 //     (
40 //         IOobject
41 //         (
42 //             "sigmaMax",
43 //             runTime.timeName(),
44 //             mesh,
45 //             IOobject::NO_READ,
46 //             IOobject::AUTO_WRITE
47 //         ),
48 //         mesh,
49 //         dimensionedVector("sigmaMax", dimPressure, vector::zero)
50 //     );
51 //     vectorField& sigmaMaxI = sigmaMax.internalField();
53 //     forAll (sigmaMaxI, cellI)
54 //     {
55 //         vector eValues = eigenValues(sigma.internalField()[cellI]);
56 //         tensor eVectors = eigenVectors(sigma.internalField()[cellI]);
58 //         scalar maxEValue = 0;
59 //         label iMax = -1;
60 //         forAll(eValues, i)
61 //         {
62 //             if (eValues[i] > maxEValue)
63 //             {
64 //                 maxEValue = eValues[i];
65 //                 iMax = i;
66 //             }
67 //         }
69 //         if (iMax != -1)
70 //         {
71 //             if (iMax == 0)
72 //             {
73 //                 sigmaMaxI[cellI] = eVectors.x()*eValues.x();
74 //             }
75 //             else if (iMax == 1)
76 //             {
77 //                 sigmaMaxI[cellI] = eVectors.y()*eValues.y();
78 //             }
79 //             else if (iMax == 2)
80 //             {
81 //                 sigmaMaxI[cellI] = eVectors.z()*eValues.z();
82 //             }
83 //         }
84 //     }
86 //     //- boundary traction
87 //     volVectorField tractionBoundary
88 //     (
89 //         IOobject
90 //         (
91 //             "tractionBoundary",
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 //     surfaceVectorField n = mesh.Sf()/mesh.magSf();
101 //     forAll(tractionBoundary.boundaryField(), patchi)
102 //     {
103 //     if(mesh.boundaryMesh()[patchi].type() != processorPolyPatch::typeName)
104 //     {
105 //         tractionBoundary.boundaryField()[patchi] =
106 //         n.boundaryField()[patchi] & sigma.boundaryField()[patchi];
107 //     }
108 // }
111     //- cohesive damage and cracking, and GII and GII
112     volScalarField damageAndCracks
113     (
114         IOobject
115         (
116             "damageAndCracks",
117             runTime.timeName(),
118             mesh,
119             IOobject::NO_READ,
120             IOobject::AUTO_WRITE
121         ),
122         mesh,
123         dimensionedScalar("zero", dimless, 0.0),
124         calculatedFvPatchVectorField::typeName
125     );
127     volScalarField GI
128     (
129         IOobject
130         (
131             "GI",
132             runTime.timeName(),
133             mesh,
134             IOobject::NO_READ,
135             IOobject::AUTO_WRITE
136        ),
137        mesh,
138        dimensionedScalar("zero", dimless, 0.0),
139        calculatedFvPatchVectorField::typeName
140     );
142     volScalarField GII
143     (
144         IOobject
145         (
146              "GII",
147              runTime.timeName(),
148              mesh,
149              IOobject::NO_READ,
150              IOobject::AUTO_WRITE
151         ),
152         mesh,
153         dimensionedScalar("zero", dimless, 0.0),
154         calculatedFvPatchVectorField::typeName
155     );
157     forAll(DU.boundaryField(), patchi)
158     {
159         // if(DU.boundaryField()[patchi].type() == cohesiveLawMultiMatFvPatchVectorField::typeName)
160         if(DU.boundaryField()[patchi].type() == solidCohesiveFvPatchVectorField::typeName)
161         {
162             // cohesiveLawMultiMatFvPatchVectorField& DUpatch =
163             //   refCast<cohesiveLawMultiMatFvPatchVectorField>(DU.boundaryField()[patchi]);
164             solidCohesiveFvPatchVectorField& DUpatch =
165                 refCast<solidCohesiveFvPatchVectorField>(DU.boundaryField()[patchi]);
167             GI.boundaryField()[patchi] = DUpatch.GI();
168             GII.boundaryField()[patchi] = DUpatch.GII();
169             damageAndCracks.boundaryField()[patchi] = DUpatch.crackingAndDamage();
170         }
171     }
173     //Info << "done" << endl;
175     runTime.writeNow();