45 #include "../sm/EngineeringModels/structengngmodel.h" 51 #include "../sm/Materials/InterfaceMaterials/structuralinterfacematerialstatus.h" 73 mExportReactionForces(false),
74 mExportBoundaryConditions(false),
75 mExportBoundaryConditionsExtra(false),
78 mExportCrackLength(false),
79 mExportInterfaceEl(false),
80 mMonitorNodeIndex(-1),
122 for(
int i = 1; i <= numBC; i++) {
125 if(presGradBC != NULL) {
131 if(presGradBCNeumann != NULL) {
136 if(presGradBCWeak != NULL) {
151 std::vector< std::vector<FloatArray> > points;
153 for(
int i = 1; i <= numEI; i++) {
159 std::vector<FloatArray> eiPoints;
161 points.push_back(eiPoints);
202 OOFEM_ERROR(
"failed to cast to StructuralEngngModel.");
206 IntArray dofManMap, dofidMap, eqnMap;
222 int maxIndPresDof = 0;
223 for (
int i = 1; i <= dofManMap.
giveSize(); i++ ) {
224 maxIndPresDof =
std::max(maxIndPresDof, dofidMap.
at(i));
230 std::vector<FloatArray> emptyArray;
236 while (
mDispHist.size() < size_t(numBC) ) {
237 std::vector<double> emptyArray;
241 for(
int bcInd = 0; bcInd < numBC; bcInd++) {
246 for (
int i = 1; i <= dofManMap.
giveSize(); i++ ) {
251 fR.at( dofidMap.
at(i) ) += reactions.
at( eqnMap.
at(i) );
270 sprintf(fileNameX,
"ReactionForceGnuplotBC%dX.dat", bcInd+1);
271 pFileX = fopen ( fileNameX ,
"wb" );
273 fprintf(pFileX,
"#u Fx\n");
274 for (
size_t j = 0; j <
mDispHist[bcInd].size(); j++ ) {
283 sprintf(fileNameY,
"ReactionForceGnuplotBC%dY.dat", bcInd+1);
284 pFileY = fopen ( fileNameY ,
"wb" );
286 fprintf(pFileY,
"#u Fx\n");
287 for (
size_t j = 0; j <
mDispHist[bcInd].size(); j++ ) {
307 std::vector<double> arcLengthPositions, normalJumps, tangJumps, normalTractions, tangTractions;
342 size_t num_cz_gp = czGaussPoints.size();
345 for(
size_t gp_ind = 0; gp_ind < num_cz_gp; gp_ind++) {
352 if(matStat != NULL) {
356 double tangDist = 0.0, arcPos = 0.0;
359 arcLengthPositions.push_back(arcPos);
365 double normalJump = jumpLoc.
at(3);
366 normalJumps.push_back(normalJump);
369 tangJumps.push_back( jumpLoc.
at(2) );
375 tangTractions.push_back(trac.
at(2));
384 double tangDist = 0.0, arcPos = 0.0;
387 arcLengthPositions.push_back(arcPos);
396 sig_m(0,0) = sig_v(0);
397 sig_m(1,1) = sig_v(1);
398 sig_m(0,1) = sig_m(1,0) = sig_v( sig_v.
giveSize()-1 );
401 trac(0) = sig_m(0,0)*n(0) + sig_m(0,1)*n(1);
402 trac(1) = sig_m(1,0)*n(0) + sig_m(1,1)*n(1);
403 double trac_n = trac(0)*n(0) + trac(1)*n(1);
404 normalTractions.push_back(trac_n);
407 double trac_t = trac(0)*t(0) + trac(1)*t(1);
408 tangTractions.push_back(trac_t);
422 if ( xMan != NULL ) {
432 std :: stringstream strNormalJump;
433 strNormalJump <<
"NormalJumpGnuplotEI" << eiIndex <<
"Time" << time <<
".dat";
434 std :: string nameNormalJump = strNormalJump.str();
437 std :: stringstream strTangJump;
438 strTangJump <<
"TangJumpGnuplotEI" << eiIndex <<
"Time" << time <<
".dat";
439 std :: string nameTangJump = strTangJump.str();
442 std :: stringstream strNormalTrac;
443 strNormalTrac <<
"NormalTracGnuplotEI" << eiIndex <<
"Time" << time <<
".dat";
444 std :: string nameNormalTrac = strNormalTrac.str();
447 std :: stringstream strTangTrac;
448 strTangTrac <<
"TangTracGnuplotEI" << eiIndex <<
"Time" << time <<
".dat";
449 std :: string nameTangTrac = strTangTrac.str();
453 std::vector<FloatArray> matForcesStart, matForcesEnd;
454 std::vector<double> radii;
459 radii.push_back(matForceRadius);
465 mpMatForceEvaluator->computeMaterialForce(matForceStart, *domain, tipInfoStart, tStep, matForceRadius);
468 matForcesStart.push_back(matForceStart);
471 matForcesStart.push_back({0.0,0.0});
479 mpMatForceEvaluator->computeMaterialForce(matForceEnd, *domain, tipInfoEnd, tStep, matForceRadius);
482 matForcesEnd.push_back(matForceEnd);
485 matForcesEnd.push_back({0.0,0.0});
490 std::vector< std::vector<FloatArray> > matForcesStartArray, matForcesEndArray;
491 matForcesStartArray.push_back(matForcesStart);
492 matForcesEndArray.push_back(matForcesEnd);
495 std :: stringstream strRadii;
496 strRadii <<
"MatForceRadiiGnuplotTime" << time <<
"Crack" << iCrack.
giveNumber() <<
".dat";
500 std :: stringstream strMatForcesStart;
501 strMatForcesStart <<
"MatForcesStartGnuplotTime" << time <<
"Crack" << iCrack.
giveNumber() <<
".dat";
505 std :: stringstream strMatForcesEnd;
506 strMatForcesEnd <<
"MatForcesEndGnuplotTime" << time <<
"Crack" << iCrack.
giveNumber() <<
".dat";
512 std :: stringstream strCrackLength;
513 strCrackLength <<
"CrackLengthGnuplotEI" << eiIndex <<
"Time" << time <<
".dat";
527 std :: stringstream strCracks;
528 strCracks <<
"CracksTime" << time <<
".dat";
529 std :: string nameCracks = strCracks.str();
537 printf(
"Mean stress computed in Gnuplot export module: "); stress.
printYourself();
549 std :: stringstream strMeanStress;
550 strMeanStress <<
"PrescribedGradientGnuplotMeanStress" << bcIndex <<
"Time" << time <<
".dat";
551 std :: string nameMeanStress = strMeanStress.str();
552 std::vector<double> componentArray, stressArray;
554 for(
int i = 1; i <= stress.
giveSize(); i++) {
555 componentArray.push_back(i);
556 stressArray.push_back(stress.
at(i));
571 printf(
"Mean stress computed in Gnuplot export module: "); stress.
printYourself();
582 std :: stringstream strMeanStress;
583 strMeanStress <<
"PrescribedGradientGnuplotMeanStress" << bcIndex <<
"Time" << time <<
".dat";
584 std :: string nameMeanStress = strMeanStress.str();
585 std::vector<double> componentArray, stressArray;
587 for(
int i = 1; i <= stress.
giveSize(); i++) {
588 componentArray.push_back(i);
589 stressArray.push_back(stress.
at(i));
606 printf(
"Mean stress computed in Gnuplot export module: "); stress.
printYourself();
607 printf(
"sigXX: %.12e\n", stress(0) );
618 std :: stringstream strMeanStress;
619 strMeanStress <<
"PrescribedGradientGnuplotMeanStress" << bcIndex <<
"Time" << time <<
".dat";
620 std :: string nameMeanStress = strMeanStress.str();
621 std::vector<double> componentArray, stressArray;
623 for(
int i = 1; i <= stress.
giveSize(); i++) {
624 componentArray.push_back(i);
625 stressArray.push_back(stress.
at(i));
640 printf(
"timeFactor: %e\n", timeFactor );
641 grad.times(timeFactor);
642 printf(
"Mean grad computed in Gnuplot export module: "); grad.printYourself();
644 std :: stringstream strMeanGrad;
645 strMeanGrad <<
"PrescribedGradientGnuplotMeanGrad" << bcIndex <<
"Time" << time <<
".dat";
646 std :: string nameMeanGrad = strMeanGrad.str();
647 std::vector<double> componentArrayGrad, gradArray;
649 for(
int i = 1; i <= grad.giveSize(); i++) {
650 componentArrayGrad.push_back(i);
651 gradArray.push_back(grad.at(i));
660 std::vector< std::vector<FloatArray> > nodePointArray;
662 for(
size_t i = 0; i < numTracEl; i++) {
664 std::vector<FloatArray> points;
667 points.push_back(xS);
668 points.push_back(xE);
670 nodePointArray.push_back(points);
673 std :: stringstream strTractionNodes;
674 strTractionNodes <<
"TractionNodesGnuplotTime" << time <<
".dat";
675 std :: string nameTractionNodes = strTractionNodes.str();
682 std::vector< std::vector<FloatArray> > nodeNormalArray;
683 for(
size_t i = 0; i < numTracEl; i++) {
685 std::vector<FloatArray> points;
691 nodeNormalArray.push_back(points);
694 std :: stringstream strTractionNodeNormals;
695 strTractionNodeNormals <<
"TractionNodeNormalsGnuplotTime" << time <<
".dat";
696 std :: string nameTractionNodeNormals = strTractionNodeNormals.str();
703 std::vector< std::vector<FloatArray> > nodeTractionArray;
704 for(
size_t i = 0; i < numTracEl; i++) {
706 std::vector<FloatArray> tractions;
711 tractions.push_back(tS);
712 tractions.push_back(tE);
713 nodeTractionArray.push_back(tractions);
716 std :: stringstream strTractions;
717 strTractions <<
"TractionsGnuplotTime" << time <<
".dat";
718 std :: string nameTractions = strTractions.str();
725 std::vector< std::vector<FloatArray> > arcPosArray;
726 for(
size_t i = 0; i < numTracEl; i++) {
727 std::vector<FloatArray> arcPos;
728 double xiS = 0.0, xiE = 0.0;
733 arcPosArray.push_back(arcPos);
736 std :: stringstream strArcPos;
737 strArcPos <<
"ArcPosGnuplotTime" << time <<
".dat";
738 std :: string nameArcPos = strArcPos.str();
744 std::vector< std::vector<FloatArray> > nodeTractionNTArray;
745 for(
size_t i = 0; i < numTracEl; i++) {
747 std::vector<FloatArray> tractions;
757 tractions.push_back( {tSn ,tSt} );
761 tractions.push_back( {tEn, tEt} );
762 nodeTractionNTArray.push_back(tractions);
765 std :: stringstream strTractionsNT;
766 strTractionsNT <<
"TractionsNormalTangentGnuplotTime" << time <<
".dat";
767 std :: string nameTractionsNT = strTractionsNT.str();
777 std::vector< std::vector<FloatArray> > bndNodes;
779 for (
int pos = 1; pos <= boundaries.
giveSize() / 2; ++pos ) {
782 int boundary = boundaries.
at(pos * 2);
786 std::vector<FloatArray> bndSegNodes;
800 bndSegNodes.push_back(xS);
813 bndSegNodes.push_back(xE);
815 bndNodes.push_back(bndSegNodes);
818 std :: stringstream strBndNodes;
819 strBndNodes <<
"BndNodesGnuplotTime" << time <<
".dat";
820 std :: string nameBndNodes = strBndNodes.str();
831 printf(
"timeFactor: %e\n", timeFactor );
832 grad.
times(timeFactor);
833 printf(
"Mean grad computed in Gnuplot export module: "); grad.
printYourself();
838 std :: stringstream strMeanGrad;
839 strMeanGrad <<
"PrescribedGradientGnuplotMeanGrad" << bc <<
"Time" << time <<
".dat";
840 std :: string nameMeanGrad = strMeanGrad.str();
841 std::vector<double> componentArrayGrad, gradArray;
843 for(
int i = 1; i <= grad.
giveSize(); i++) {
844 componentArrayGrad.push_back(i);
845 gradArray.push_back(grad.
at(i));
853 std::vector< std::vector<FloatArray> > pointArray;
858 int numEdges = el->giveNumberOfNodes();
861 for (
int edgeIndex = 1; edgeIndex <= numEdges; edgeIndex++ ) {
862 std::vector<FloatArray> points;
865 el->giveInterpolation()->boundaryGiveNodes(bNodes, edgeIndex);
867 int niLoc = bNodes.
at(1);
868 const FloatArray &xS = *(el->giveNode(niLoc)->giveCoordinates() );
872 const FloatArray &xE = *(el->giveNode(njLoc)->giveCoordinates() );
875 pointArray.push_back(points);
888 std :: stringstream strMesh;
889 strMesh <<
"MeshGnuplotTime" << time <<
".dat";
890 std :: string nameMesh = strMesh.str();
906 std::vector< std::vector<FloatArray> > nodeDispHist;
909 std :: string name =
"MonitorNodeSolGnuplot.dat";
916 std::vector<FloatArray> points, tractions, tractionsProj;
919 for(
int i = 1; i <= numEl; i++) {
925 printf(
"Found StructuralInterfaceElement.\n");
932 for(
int gpInd = 0; gpInd < numGP; gpInd++ ) {
964 std :: stringstream strFileNameX;
965 strFileNameX <<
"NormalTractionVsXTime" << time <<
".dat";
966 std :: string nameStringX = strFileNameX.str();
968 pFileX = fopen ( nameStringX.c_str() ,
"wb" );
970 fprintf(pFileX,
"#x tn\n");
971 for (
size_t j = 0; j < points.size(); j++ ) {
972 fprintf(pFileX,
"%e %e\n", points[j][0], tractions[j].at(3) );
997 std :: stringstream strFileNameXshear;
998 strFileNameXshear <<
"ShearTractionVsXTime" << time <<
".dat";
999 std :: string nameStringXshear = strFileNameXshear.str();
1001 pFileXshear = fopen ( nameStringXshear.c_str() ,
"wb" );
1003 fprintf(pFileXshear,
"#x tn\n");
1004 for (
size_t j = 0; j < points.size(); j++ ) {
1005 fprintf(pFileXshear,
"%e %e\n", points[j][0], tractions[j].at(1) );
1008 fclose(pFileXshear);
1015 std :: stringstream strFileNameY;
1016 strFileNameY <<
"NormalTractionVsYTime" << time <<
".dat";
1017 std :: string nameStringY = strFileNameY.str();
1019 pFileY = fopen ( nameStringY.c_str() ,
"wb" );
1021 fprintf(pFileY,
"#y tn\n");
1022 for (
size_t j = 0; j < points.size(); j++ ) {
1023 fprintf(pFileY,
"%e %e\n", points[j][1], tractions[j].at(3) );
1033 std :: stringstream strFileNameYshear;
1034 strFileNameYshear <<
"ShearTractionVsYTime" << time <<
".dat";
1035 std :: string nameStringYshear = strFileNameYshear.str();
1037 pFileYshear = fopen ( nameStringYshear.c_str() ,
"wb" );
1039 fprintf(pFileYshear,
"#y tn\n");
1040 for (
size_t j = 0; j < points.size(); j++ ) {
1041 fprintf(pFileYshear,
"%e %e\n", points[j][1], tractions[j].at(1) );
1044 fclose(pFileYshear);
1051 std :: ofstream file;
1052 file.open( iName.data() );
1055 file << std :: scientific;
1059 for(
auto posVec: iPoints) {
1060 for(
auto pos: posVec) {
1062 for(
int i = 0; i < pos.giveSize(); i++) {
1063 file << pos[i] <<
" ";
virtual void computeField(FloatArray &sigma, TimeStep *tStep)
Computes the homogenized, macroscopic, field (stress).
bool testTimeStepOutput(TimeStep *tStep)
Tests if given time step output is required.
Prescribes or where are primary unknowns for the subscale.
std::vector< double > mTimeHist
Abstract class representing entity, which is included in the FE model using one (or more) global func...
virtual void initialize()
void outputBoundaryCondition(PrescribedGradient &iBC, TimeStep *tStep)
Boundary condition output.
EnrichmentFront * giveEnrichmentFrontStart()
void giveSubPolygon(std::vector< FloatArray > &oPoints, const double &iXiStart, const double &iXiEnd) const
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Access method for default integration rule.
const std::vector< double > & giveCohesiveZoneArcPositions() const
void giveTractionElCoord(size_t iElInd, FloatArray &oStartCoord, FloatArray &oEndCoord) const
size_t giveNumberOfTractionElements() const
virtual double give(Dof *dof, ValueModeType mode, TimeStep *tStep)
Returns the value of a prescribed unknown, respecting requested mode for given time.
void outputXFEM(EnrichmentItem &iEI, TimeStep *tStep)
XFEM output.
int giveNumberOfBoundaryConditions() const
Returns number of boundary conditions in domain.
Imposes a prescribed gradient weakly on the boundary with a Neumann boundary condition.
double & at(int i)
Coefficient access function.
Function * giveTimeFunction()
FloatArray mMatForceRadii
bool mExportReactionForces
void outputXFEMGeometry(const std::vector< std::vector< FloatArray > > &iEnrItemPoints)
TipInfo gathers useful information about a crack tip, like its position and tangent direction...
virtual void computeTangentialSignDist(double &oDist, const FloatArray &iPoint, double &oMinDistArcPos) const =0
virtual FloatArray * giveCoordinates()
virtual double giveUnknown(ValueModeType mode, TimeStep *tStep)=0
The key method of class Dof.
virtual void initialize()
void outputGradient(int bc, Domain &d, FloatArray &grad, TimeStep *tStep)
Help functions.
double giveTargetTime()
Returns target time.
const FloatArray & giveFirstPKTraction() const
Returns the const pointer to receiver's first Piola-Kirchhoff traction vector.
Abstract base class for all finite elements.
void giveTraction(size_t iElInd, FloatArray &oStartTraction, FloatArray &oEndTraction, ValueModeType mode, TimeStep *tStep)
Base class for dof managers.
int giveNumberOfElements() const
Returns number of elements in domain.
double evaluate(TimeStep *tStep, ValueModeType mode)
Returns the value of load time function at given time.
int giveNumberOfSpatialDimensions()
Returns number of spatial dimensions.
Represents export output module - a base class for all output modules.
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
Abstract representation of Geometry.
XfemManager * giveXfemManager()
virtual void terminate()
Terminates the receiver.
virtual FEInterpolation * giveInterpolation() const
#define _IFT_GnuplotExportModule_xfem
Abstract base class representing integration rule.
void giveTractionElNormal(size_t iElInd, FloatArray &oNormal, FloatArray &oTangent) const
GeneralBoundaryCondition * giveBc(int n)
Service for accessing particular domain bc.
#define _IFT_GnuplotExportModule_interface_el
virtual void computeField(FloatArray &sigma, TimeStep *tStep)
Computes the homogenized, macroscopic, field (stress).
void outputInterfaceEl(Domain &d, TimeStep *tStep)
Custom output for interface elements.
int giveNumberOfEnrichmentItems() const
#define _IFT_GnuplotExportModule_BoundaryConditionsExtra
void buildReactionTable(IntArray &restrDofMans, IntArray &restrDofs, IntArray &eqn, TimeStep *tStep, int di)
Builds the reaction force table.
virtual int giveBcId()=0
Returns the id of associated boundary condition, if there is any.
Class implementing Dirichlet boundary condition on DOF (primary boundary condition).
void giveBoundaries(IntArray &oBoundaries)
Element * giveElement(int n)
Service for accessing particular domain fe element.
double dotProduct(const FloatArray &x) const
Computes the dot product (or inner product) of receiver and argument.
#define _IFT_GnuplotExportModule_BoundaryConditions
EngngModel * emodel
Problem pointer.
const FloatArray & giveNormal() const
Class EnrichmentFront: describes the edge or tip of an XFEM enrichment.
static void WritePointsToGnuplot(const std::string &iName, const std::vector< std::vector< FloatArray > > &iPoints)
This class implements a structural interface material status information.
virtual ~GnuplotExportModule()
#define _IFT_GnuplotExportModule_monitornode
void giveCompleteUnknownVector(FloatArray &answer, ValueModeType mode, TimeStep *tStep)
Assembles the complete unknown vector in node.
Imposes a prescribed gradient weakly on the boundary with an independent traction discretization...
bool mExportBoundaryConditions
const std::vector< GaussPoint * > & giveCohesiveZoneGaussPoints() const
const FloatArray & giveJump() const
Returns the const pointer to receiver's jump.
const FloatArray & giveGlobalCoordinates()
Abstract base class representing a material status information.
virtual void boundaryGiveNodes(IntArray &answer, int boundary)=0
Gives the boundary nodes for requested boundary number.
Class representing vector of real numbers.
const FloatArray & giveTraction() const
Returns the const pointer to receiver's traction vector.
virtual void computeField(FloatArray &sigma, TimeStep *tStep)
Computes the homogenized, macroscopic, field (stress).
Implementation of matrix containing floating point numbers.
This class manages the xfem part.
IRResultType
Type defining the return values of InputRecord reading operations.
GaussPoint * getIntegrationPoint(int n)
Access particular integration point of receiver.
const FloatArray & giveStressVector() const
Returns the const pointer to receiver's stress vector.
std::unique_ptr< MaterialForceEvaluator > mpMatForceEvaluator
Evaluator for material forces.
#define _IFT_GnuplotExportModule_cracklength
IntegrationPointStatus * giveMaterialStatus()
Returns reference to associated material status (NULL if not defined).
std::vector< FloatArray > mMonitorNodeDispHist
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
#define _IFT_GnuplotExportModule_ReactionForces
const FloatArray & giveProjectedTraction() const
Returns the projected traction.
virtual void printYourself() const
Print receiver on stdout.
virtual void doOutput(TimeStep *tStep, bool forcedOutput=false)
Writes the output.
BasicGeometry * giveGeometry()
Dof * giveDofWithID(int dofID) const
Returns DOF with given dofID; issues error if not present.
int giveNumberOfIntegrationPoints() const
Returns number of integration points of receiver.
void giveTractionElArcPos(size_t iElInd, double &oXiStart, double &oXiEnd) const
void times(double s)
Multiplies receiver with scalar.
EnrichmentItem * giveEnrichmentItem(int n)
std::vector< std::vector< FloatArray > > mReactionForceHistory
Stores the sum of reaction forces for each BC.
void outputReactionForces(TimeStep *tStep)
void giveGradientVoigt(FloatArray &oGradient) const
Gives back the applied gradient in Voigt form.
Domain * giveDomain() const
This class implements extension of EngngModel for structural models.
#define _IFT_GnuplotExportModule_materialforceradii
const TipInfo & giveTipInfo() const
#define _IFT_GnuplotExportModule_mesh
void push_back(const double &iVal)
Add one element.
std::vector< std::unique_ptr< Element > > & giveElements()
void computeReaction(FloatArray &answer, TimeStep *tStep, int di)
Computes reaction forces.
Abstract base class representing the "problem" under consideration.
Abstract base class for all structural interface elements.
virtual TimeStep * giveCurrentStep(bool force=false)
Returns current time step.
Evaluates material forces.
int giveSize() const
Returns the size of receiver.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
std::vector< std::vector< double > > mDispHist
the oofem namespace is to define a context or scope in which all oofem names are defined.
DofManager * giveDofManager(int i) const
Domain * giveDomain(int n)
Service for accessing particular problem domain.
Abstract class Dof represents Degree Of Freedom in finite element mesh.
virtual void callGnuplotExportModule(GnuplotExportModule &iExpMod, TimeStep *tStep)
DofManager * giveDofManager(int n)
Service for accessing particular domain dof manager.
void outputMesh(Domain &iDomain)
Mesh output.
void outputNodeDisp(DofManager &iDMan, TimeStep *tStep)
Monitor node output.
bool mExportBoundaryConditionsExtra
virtual double evaluateAtTime(double t)
Returns the value of the function at given time.
(Under development) The Gnuplot export module enables OOFEM to export some data in a format that can ...
Class representing integration point in finite element program.
std::unordered_map< int, std::vector< double > > mCrackLengthHist
Store time history of crack lengths.
Class representing solution step.
REGISTER_ExportModule(ErrorCheckingExportModule)
EnrichmentFront * giveEnrichmentFrontEnd()
EnrichmentItem with geometry described by BasicGeometry.