This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/solvers/solidMechanics/elasticSolidFoam/writeHistory.H
2014-06-01 20:12:52 +02:00

24 lines
679 B
C

//- write force displacement to file
if(historyPatchID != -1)
{
Info << "Found patch "<<historyPatchName<<", writing y force and displacement to file"
<< endl;
//- for small strain or moving mesh
vector force =
gSum(mesh.boundary()[historyPatchID].Sf() & sigma.boundaryField()[historyPatchID]);
vector disp = gAverage(U.boundaryField()[historyPatchID]);
//- write to file
if(Pstream::master())
{
OFstream& forceDispFile = *filePtr;
forceDispFile << disp.x() << " "
<< disp.y() << " "
<< disp.z() << " "
<< force.x() << " "
<< force.y() << " "
<< force.z() << endl;
}
}