BUGFIX: Uninitialised member variables
[foam-extend-3.2.git] / applications / solvers / solidMechanics / elasticAcpSolidFoam / writeHistory.H
blob1eae447bff730f82ddbf5861277c19c4183cf8c9
1 //- write force displacement to file
2 if(historyPatchID != -1)
3   {
4     Info << "Writing disp and force of patch "<<historyPatchName<<" to file"
5           << endl;
7      //- for small strain or moving mesh
8     vector force = gSum(mesh.boundary()[historyPatchID].Sf() & sigma.boundaryField()[historyPatchID]);
9      
10      //- for large strain total lagrangian
11      // tensorField F = I + gradU.boundaryField()[historyPatchID];
12      // vectorField totalForce = mesh.Sf().boundaryField()[historyPatchID] & (sigma.boundaryField()[historyPatchID] & F);
13      
14      //vector force = sum( totalForce );
15      
16      //scalar force = force[vector::Y];
17      
18      //- patchIntegrate utility integrates it this way but this is worng because the sigma tensor should
19      //- be dotted with the surface normal to give the actual traction/force
20      //- you cannot just take the component of the sigma tensor
21      //scalar forcePatchIntegrateMethod = gSum(
22      //                                     mesh.magSf().boundaryField()[historyPatchID]
23      //                                     *sigma.boundaryField()[historyPatchID].component(symmTensor::XY)
24      //                                     );
25      
26      vector avDisp = gAverage(U.boundaryField()[historyPatchID]);
27      
28      //- write to file
29      if(Pstream::master())
30        {
31          OFstream& forceDispFile = *filePtr;
32          forceDispFile << avDisp.x() << " " << avDisp.y() << " " << avDisp.z() << " "
33                        << force.x() << " " << force.y() << " " << force.z() << endl;
34        }
35    }