1 //- write force displacement to file
3 label leftPatchID = mesh.boundaryMesh().findPatchID("leftClamp");
6 FatalError << "Cannot find patch left for calculating force" << endl;
9 //- calculate force in x direction on leftClamp patch
10 scalar leftForce = gSum(
12 (mesh.boundary()[leftPatchID].Sf() & sigma.boundaryField()[leftPatchID])
15 //- patchIntegrate utility integrates it this way but this is worng because the sigma tensor should
16 //- be dotted with the surface normal to give the actual traction/force
17 //- you cannot just take the component of the sigma tensor
18 //scalar leftForcePatchIntegrateMethod = gSum(
19 // mesh.magSf().boundaryField()[leftPatchID]
20 // *sigma.boundaryField()[leftPatchID].component(symmTensor::XY)
23 vector gaugeU1 = vector::zero;
24 vector gaugeU2 = vector::zero;
25 if(gaugeFaceID1 != -1)
27 gaugeU1 = U.boundaryField()[gaugeFacePatchID1][gaugeFaceID1];
29 if(gaugeFaceID2 != -1)
31 gaugeU2 = U.boundaryField()[gaugeFacePatchID2][gaugeFaceID2];
34 //- reduce across procs
35 reduce(gaugeU1, sumOp<vector>());
36 reduce(gaugeU2, sumOp<vector>());
38 Pout << "gaugeU1 is " << gaugeU1 << nl
39 << "gaugeU2 is " << gaugeU2 << endl;
41 scalar gaugeDisp = mag(gaugeU1 - gaugeU2);
46 OFstream& forceDispFile = *filePtr;
47 forceDispFile << 1000*gaugeDisp << "\t" << -1*leftForce << endl;