Replace tabs by 4 spaces in applications/solvers/solidMechanics
[foam-extend-3.2.git] / applications / solvers / solidMechanics / elasticPlasticNonLinTLSolidFoam / writeHistory.H
blob4e8be7e35f8910c2a649ecc00dbf38a338e46fe9
1 //- write force displacement to file
2 if(historyPatchID != -1)
3   {
4     Info << "Writing disp-force to file for patch " << historyPatchName
5       << endl;
7      //- for small strain or moving mesh
8      //scalar force = gSum(
9      //            direction &
10      //            (mesh.boundary()[historyPatchID].Sf() & sigma.boundaryField()[historyPatchID])
11      //            );
13      //- for large strain total lagrangian
14      tensorField F = I + gradU.boundaryField()[historyPatchID];
15      vector force = gSum(mesh.Sf().boundaryField()[historyPatchID] & (sigma.boundaryField()[historyPatchID] & F));
16      vector disp = gAverage(U.boundaryField()[historyPatchID]);
19     Info << "Writing strain-stress to file for patch " << historyPatchName
20       << endl;
22      // avaerage stress strain
23      symmTensor stress = gAverage(sigma.boundaryField()[historyPatchID]);
24      symmTensor strain = gAverage(epsilon.boundaryField()[historyPatchID]);
27      // write to file
28      if(Pstream::master())
29        {
30      OFstream& forceDispFile = *forceFilePtr;
31      label width = 20;
32      forceDispFile << disp.x() << " " << disp.y() << " " << disp.z();
33      forceDispFile.width(width);
34      forceDispFile << force.x() << " " << force.y() << " " << force.z()
35                << endl;
37      OFstream& stressStrainFile = *stressFilePtr;
38      stressStrainFile << strain.xx() << " " << strain.xy() << " " << strain.xz() << " "
39               << strain.yy() << " " << strain.yz() << " " << strain.zz();
40      stressStrainFile.width(width);
41      stressStrainFile << stress.xx() << " " << stress.xy() << " " << stress.xz() << " "
42               << stress.yy() << " " << stress.yz() << " " << stress.zz()
43               << endl;
44        }
45    }