Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / applications / solvers / solidMechanics / elasticPlasticNonLinULSolidFoam / writeHistory.H
blobd0fe7b7ca6e43c39f250f4109af78359e1818c60
1 //- write force displacement to file
2 if(historyPatchID != -1)
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));
17     //- for large strain updated lagrangian
18     vector force = gSum(mesh.Sf().boundaryField()[historyPatchID] & sigma.boundaryField()[historyPatchID]);
20     vector disp = gAverage(U.boundaryField()[historyPatchID]);
23     Info << "Writing strain-stress to file for patch " << historyPatchName
24         << endl;
26     // avaerage stress strain
27     symmTensor stress = gAverage(sigma.boundaryField()[historyPatchID]);
28     symmTensor strain = gAverage(epsilon.boundaryField()[historyPatchID]);
31     // write to file
32     if(Pstream::master())
33     {
34          OFstream& forceDispFile = *forceFilePtr;
35          label width = 20;
36          forceDispFile << disp.x() << " " << disp.y() << " " << disp.z();
37          forceDispFile.width(width);
38          forceDispFile << force.x() << " " << force.y() << " " << force.z()
39              << endl;
41          OFstream& stressStrainFile = *stressFilePtr;
42          stressStrainFile << strain.xx() << " " << strain.xy() << " " << strain.xz() << " "
43              << strain.yy() << " " << strain.yz() << " " << strain.zz();
44          stressStrainFile.width(width);
45          stressStrainFile << stress.xx() << " " << stress.xy() << " " << stress.xz() << " "
46              << stress.yy() << " " << stress.yz() << " " << stress.zz()
47              << endl;
48     }