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/elasticPlasticNonLinTLSolidFoam/createHistory.H

37 lines
1.2 KiB
C
Raw Normal View History

OFstream * forceFilePtr(NULL);
OFstream * stressFilePtr(NULL);
word historyPatchName(mesh.solutionDict().subDict("stressedFoam").lookup("historyPatch"));
label historyPatchID = mesh.boundaryMesh().findPatchID(historyPatchName);
if(historyPatchID == -1)
{
Warning << "history patch " << historyPatchName
<< " not found. Force-displacement will not be written"
<< endl;
}
else if(Pstream::master())
{
fileName historyDir = "history";
mkDir(historyDir);
{
fileName forceFileName(historyDir/"forceDisp_"+historyPatchName+".dat");
Info << "\nForce-displacement for patch " << historyPatchName
<< " will be written to " << forceFileName
<< endl;
forceFilePtr = new OFstream(forceFileName);
OFstream& forceDispFile = *forceFilePtr;
forceDispFile << "#Disp(mm)\tForce(N)" << endl;
}
{
fileName stressFileName(historyDir/"stressStrain_"+historyPatchName+".dat");
Info << "\nStress(2nd Piola-Kirchoff)-strain(Green) for patch "
<< historyPatchName
<< " will be written to " << stressFileName
<< endl;
stressFilePtr = new OFstream(stressFileName);
OFstream& stressStrainFile = *stressFilePtr;
stressStrainFile << "#Strain(-)\tStress(Pa)" << endl;
}
}