35 #ifndef PRESCRIBEDGRADIENTBCWEAK_H_ 36 #define PRESCRIBEDGRADIENTBCWEAK_H_ 43 #include <unordered_map> 47 #define _IFT_PrescribedGradientBCWeak_Name "prescribedgradientbcweak" 48 #define _IFT_PrescribedGradientBCWeak_TractionInterpOrder "tractioninterporder" 49 #define _IFT_PrescribedGradientBCWeak_NumTractionNodesAtIntersections "numnodesatintersections" 50 #define _IFT_PrescribedGradientBCWeak_NumTractionNodeSpacing "tractionnodespacing" 51 #define _IFT_PrescribedGradientBCWeak_DuplicateCornerNodes "duplicatecornernodes" 52 #define _IFT_PrescribedGradientBCWeak_TangDistPadding "tangdistpadding" 53 #define _IFT_PrescribedGradientBCWeak_TracDofScaling "tracdofscaling" 54 #define _IFT_PrescribedGradientBCWeak_PeriodicityNormal "periodicitynormal" 55 #define _IFT_PrescribedGradientBCWeak_MirrorFunction "mirrorfunction" 58 class IntegrationRule;
69 printf(
"\nTracSegArray segments:\n");
72 l.giveVertex(1).printYourself();
73 l.giveVertex(2).printYourself();
80 l += line.giveLength();
121 virtual int giveNumberOfInternalDofManagers();
122 virtual DofManager *giveInternalDofManager(
int i);
129 virtual void postInitialize();
139 void computeIntForceGPContrib(
FloatArray &oContrib_disp,
IntArray &oDisp_loc_array,
FloatArray &oContrib_trac,
IntArray &oTrac_loc_array,
TracSegArray &iEl,
GaussPoint &iGP,
int iDim,
TimeStep *tStep,
const FloatArray &iBndCoord,
const double &iScaleFac,
ValueModeType mode,
CharType type,
const UnknownNumberingScheme &s);
151 virtual void giveLocationArrays(std :: vector< IntArray > &rows, std :: vector< IntArray > &cols,
CharType type,
157 virtual void giveDisplacementLocationArray(
IntArray &rows,
160 void compute_x_times_N_1(
FloatMatrix &o_x_times_N);
161 void compute_x_times_N_2(
FloatMatrix &o_x_times_N);
170 virtual const char *
giveClassName()
const {
return "PrescribedGradientBCWeak"; }
175 void giveTractionElCoord(
size_t iElInd,
FloatArray &oStartCoord,
FloatArray &oEndCoord)
const { oStartCoord = mpTracElNew [ iElInd ]->mInteriorSegments[0].giveVertex(1); oEndCoord = mpTracElNew [ iElInd ]->mInteriorSegments.back().giveVertex(2); }
177 void giveTractionElArcPos(
size_t iElInd,
double &oXiStart,
double &oXiEnd)
const;
178 void giveBoundaries(
IntArray &oBoundaries);
193 void setDomainSize(
double iDomainSize) {mDomainSize = std::move(iDomainSize);};
284 void recomputeTractionMesh();
290 void createTractionMesh(
bool iEnforceCornerPeriodicity,
int iNumSides);
292 void splitSegments(std :: vector< TracSegArray * > &ioElArray);
294 bool damageExceedsTolerance(
Element *el);
298 bool pointIsOnGammaPlus(
const FloatArray &iPos)
const;
301 virtual void checkIfCorner(
bool &oIsCorner,
bool &oDuplicatable,
const FloatArray &iPos,
const double &iNodeDistTol)
const = 0;
302 virtual bool boundaryPointIsOnActiveBoundary(
const FloatArray &iPos)
const = 0;
304 int giveSideIndex(
const FloatArray &iPos)
const;
307 void findHoleCoord(std::vector<FloatArray> &oHoleCoordUnsorted, std::vector<FloatArray> &oAllCoordUnsorted);
308 void findCrackBndIntersecCoord(std::vector<FloatArray> &oHoleCoordUnsorted);
309 void findPeriodicityCoord(std::vector<FloatArray> &oHoleCoordUnsorted);
311 void removeClosePoints(std::vector<FloatArray> &ioCoords,
const double &iAbsTol);
312 void removeSegOverHoles(
TracSegArray &ioTSeg,
const double &iAbsTol);
323 return mStartPos.distance_square(iVec1) < mStartPos.distance_square(iVec2);
343 bool operator()(
const std :: pair< FloatArray, T > &iVec1,
const std :: pair< FloatArray, int > &iVec2)
const 345 return calcArcPos(iVec1.first) < calcArcPos(iVec2.first);
350 double Lx = mUC [ 0 ] - mLC [ 0 ];
351 double Ly = mUC [ 1 ] - mLC [ 1 ];
353 if ( mSideInd == 0 ) {
354 const FloatArray &x = { mUC [ 0 ], mLC [ 1 ] };
355 double dist = Lx + iPos.
distance(x);
359 if ( mSideInd == 1 ) {
360 double dist = Lx + Ly + iPos.
distance(mUC);
364 if ( mSideInd == 2 ) {
365 const FloatArray &x = { mLC [ 0 ], mUC [ 1 ] };
366 double dist = Lx + Ly + Lx + iPos.
distance(x);
370 if ( mSideInd == 3 ) {
402 return calcArcPos(iVec1) < calcArcPos(iVec2);
407 double Lx = mUC [ 0 ] - mLC [ 0 ];
408 double Ly = mUC [ 1 ] - mLC [ 1 ];
413 if( iPos[0] > Lx - Lx*mRelTol ) {
417 if( iPos[1] > Ly - Ly*mRelTol ) {
421 if( iPos[0] < Lx*mRelTol ) {
425 if( iPos[1] < Ly*mRelTol ) {
429 if ( sideInd == 0 ) {
430 const FloatArray &x = { mUC [ 0 ], mLC [ 1 ] };
431 double dist = Lx + iPos.
distance(x);
435 if ( sideInd == 1 ) {
436 double dist = Lx + Ly + iPos.
distance(mUC);
440 if ( sideInd == 2 ) {
441 const FloatArray &x = { mLC [ 0 ], mUC [ 1 ] };
442 double dist = Lx + Ly + Lx + iPos.
distance(x);
446 if ( sideInd == 3 ) {
bool mMeshIsPeriodic
true -> the traction lives only on gammaPlus, so that we get strong periodicity as a special case...
std::vector< Line > mInteriorSegments
bool operator()(const FloatArray &iVec1, const FloatArray &iVec2) const
void giveTractionElCoord(size_t iElInd, FloatArray &oStartCoord, FloatArray &oEndCoord) const
size_t giveNumberOfTractionElements() const
Base class for all matrices stored in sparse format.
const IntArray mRegularDispDofIDs
FloatArray mUC
Upper corner of domain (assuming a rectangular RVE)
Class for homogenization of applied gradients.
virtual double domainSize()
std::unique_ptr< IntegrationRule > mIntRule
const IntArray mDispLockDofIDs
ArcPosSortFunction(const FloatArray &iStartPos)
bool operator()(const FloatArray &iVec1, const FloatArray &iVec2) const
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
void setupIntegrationRuleOnEl()
int mTractionNodeSpacing
Use every (mTractionNodeSpacing) displacement nodes when constructing the traction element mesh...
void setDomainSize(double iDomainSize)
Abstract base class for all finite elements.
Node * mpDisplacementLock
Lock displacements in one node if periodic.
Base class for dof managers.
virtual bcType giveType() const
ArcPosSortFunction3(const FloatArray &iLC, const FloatArray &iUC, const double &iTol, int iSideInd)
#define _IFT_PrescribedGradientBCWeak_Name
int mTractionInterpOrder
Order of interpolation for traction (0->piecewise constant, 1->piecewise linear)
Class implementing an array of integers.
ArcPosSortFunction4(const FloatArray &iLC, const FloatArray &iUC, const double &iRelTol)
int mMirrorFunction
Mirror function (i.e.
double distance(const FloatArray &x) const
Computes the distance between position represented by receiver and position given as parameter...
void giveTractionLocationArray(IntArray &rows, CharType type, const UnknownNumberingScheme &s)
bcType
Type representing the type of bc.
const IntArray & giveTracDofIDs() const
const IntArray & giveDispLockDofIDs() const
double calcArcPos(const FloatArray &iPos) const
double mTangDistPadding
Parameter for creation of traction mesh.
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
bool operator()(const std::pair< FloatArray, T > &iVec1, const std::pair< FloatArray, int > &iVec2) const
FloatArray mPeriodicityNormal
Periodicity direction.
Abstract base class for all active boundary conditions.
double calcArcPos(const FloatArray &iPos) const
std::vector< Line > mInteriorSegmentsFine
int mNumTractionNodesAtIntersections
If traction nodes should be inserted where cracks intersect the RVE boundary.
Imposes a prescribed gradient weakly on the boundary with an independent traction discretization...
void setUpperCorner(FloatArray iUC)
virtual const char * giveClassName() const
Class representing vector of real numbers.
Implementation of matrix containing floating point numbers.
IRResultType
Type defining the return values of InputRecord reading operations.
std::unique_ptr< Node > mFirstNode
FloatArray mLC
Lower corner of domain (assuming a rectangular RVE)
const FloatArray mStartPos
void setMirrorFunction(int iMirrorFunction)
virtual const char * giveInputRecordName() const
void setLowerCorner(FloatArray iLC)
const IntArray & giveRegularDispDofIDs() const
the oofem namespace is to define a context or scope in which all oofem names are defined.
Class implementing node in finite element mesh.
double mSpringPenaltyStiffness
std::vector< TracSegArray * > mpTracElNew
Elements for the independent traction discretization.
virtual double domainSize()
Class representing integration point in finite element program.
Class representing solution step.
void setPeriodicityNormal(const FloatArray &iPeriodicityNormal)
bool mDuplicateCornerNodes
0 -> Do not duplicate corner traction nodes 1 -> Duplicate corner traction nodes
std::vector< FloatArray > mInteriorSegmentsPointsFine