Fixed URL for libccmio-2.6.1 (bug report #5 by Thomas Oliveira)
[foam-extend-3.2.git] / applications / solvers / solidMechanics / elasticPlasticSolidFoam / writeHistory.H
blob0a81e51cdd64fe44e4ccf13be24a2bb63007e44e
1 //- write force displacement to file
2 if(historyPatchID != -1)
4     Info << "Writing disp-force to file for patch " << historyPatchName
5         << endl;
7     vector disp = gAverage(U.boundaryField()[historyPatchID]);
9     //- for small strain or moving mesh
10     vector force =
11         gSum(mesh.boundary()[historyPatchID].Sf() & sigma.boundaryField()[historyPatchID]);
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));
17     Info << "Writing strain-stress to file for patch " << historyPatchName
18         << endl;
20     // average stress strain
21     symmTensor stress = gAverage(sigma.boundaryField()[historyPatchID]);
22     symmTensor strain = gAverage(epsilon.boundaryField()[historyPatchID]);
25     // write to file
26     if(Pstream::master())
27     {
28         OFstream& forceDispFile = *forceFilePtr;
29         label width = 20;
30         forceDispFile << disp.x() << " " << disp.y() << " " << disp.z();
31         forceDispFile.width(width);
32         forceDispFile << force.x() << " " << force.y() << " " << force.z()
33             << endl;
35         OFstream& stressStrainFile = *stressFilePtr;
36         stressStrainFile << strain.xx() << " " << strain.xy() << " " << strain.xz() << " "
37             << strain.yy() << " " << strain.yz() << " " << strain.zz();
38         stressStrainFile.width(width);
39         stressStrainFile << stress.xx() << " " << stress.xy() << " " << stress.xz() << " "
40             << stress.yy() << " " << stress.yz() << " " << stress.zz()
41             << endl;
42     }