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/viscoElasticSolidFoam/writeHistory.H

43 lines
1.6 KiB
C++

//- write force displacement to file
if(historyPatchID != -1)
{
Info << "Writing disp-force to file for patch " << historyPatchName
<< endl;
vector disp = gAverage(U.boundaryField()[historyPatchID]);
//- for small strain or moving mesh
vector force =
gSum(mesh.boundary()[historyPatchID].Sf() & sigma.boundaryField()[historyPatchID]);
//- for large strain total lagrangian
// tensorField F = I + gradU.boundaryField()[historyPatchID];
// vector force = gSum(mesh.Sf().boundaryField()[historyPatchID] & (sigma.boundaryField()[historyPatchID] & F));
// Info << "Writing strain-stress to file for patch " << historyPatchName
// << endl;
// average stress strain
//symmTensor stress = gAverage(sigma.boundaryField()[historyPatchID]);
//symmTensor strain = gAverage(epsilon.boundaryField()[historyPatchID]);
// write to file
if(Pstream::master())
{
OFstream& forceDispFile = *forceFilePtr;
label width = 20;
forceDispFile << disp.x() << " " << disp.y() << " " << disp.z();
forceDispFile.width(width);
forceDispFile << force.x() << " " << force.y() << " " << force.z()
<< endl;
// OFstream& stressStrainFile = *stressFilePtr;
// stressStrainFile << strain.xx() << " " << strain.xy() << " " << strain.xz() << " "
// << strain.yy() << " " << strain.yz() << " " << strain.zz();
// stressStrainFile.width(width);
// stressStrainFile << stress.xx() << " " << stress.xy() << " " << stress.xz() << " "
// << stress.yy() << " " << stress.yz() << " " << stress.zz()
// << endl;
}
}