8 #include "../sm/Elements/PlaneStress/trplanstrssxfem.h" 10 #include "../sm/Materials/structuralmaterial.h" 11 #include "../sm/CrossSections/structuralcrosssection.h" 136 for (
size_t i = 0; i < nodeEiIndices.size(); i++ ) {
166 const double regularizationCoeff =
mRegCoeff;
168 for(
int i = 0; i < numRows; i++) {
169 if( fabs(answer(i,i)) < tol ) {
170 answer(i,i) += regularizationCoeff;
202 const double regularizationCoeff =
mRegCoeff;
204 for(
int i = 0; i < numRows; i++) {
205 if( fabs(K(i,i)) < tol ) {
206 answer(i) += regularizationCoeff*u(i);
220 return EGT_Composite;
222 return EGT_Composite;
225 return EGT_triangle_1;
247 iRule->givePatch()->draw(gc);
278 val = iRule->giveMaterial();
286 val /= iRule->giveNumberOfIntegrationPoints();
288 s.at(1) = s.at(2) = s.at(3) = val;
367 const int numCells =
mSubTri.size();
371 vtkPieces[0].setNumberOfCells(1);
373 int numTotalNodes = 3;
374 vtkPieces[0].setNumberOfNodes(numTotalNodes);
377 std :: vector< FloatArray >nodeCoords;
378 for(
int i = 1; i <= 3; i++) {
382 vtkPieces[0].setNodeCoords(i, x);
387 vtkPieces[0].setConnectivity(1, nodes1);
391 vtkPieces[0].setOffset(1, offset);
394 vtkPieces[0].setCellType(1, 5);
400 vtkPieces[0].setNumberOfPrimaryVarsToExport(primaryVarsToExport.
giveSize(), numTotalNodes);
402 for (
int fieldNum = 1; fieldNum <= primaryVarsToExport.
giveSize(); fieldNum++ ) {
405 for (
int nodeInd = 1; nodeInd <= numTotalNodes; nodeInd++ ) {
407 if ( type == DisplacementVector ) {
430 u = {uTemp[0], uTemp[1], 0.0};
433 vtkPieces[0].setPrimaryVarInNode(fieldNum, nodeInd, u);
435 printf(
"fieldNum: %d\n", fieldNum);
448 vtkPieces[0].setNumberOfInternalVarsToExport(0, numTotalNodes);
452 vtkPieces[0].setNumberOfCellVarsToExport(cellVarsToExport.
giveSize(), 1);
453 for (
int i = 1; i <= cellVarsToExport.
giveSize(); i++ ) {
459 average = {0., 0., 0., 0., 0., 0.};
463 vtkPieces[0].setCellVar( i, 1, average );
468 averageV9.
at(1) = average.
at(1);
469 averageV9.
at(5) = average.
at(2);
470 averageV9.
at(9) = average.
at(3);
471 averageV9.
at(6) = averageV9.
at(8) = average.
at(4);
472 averageV9.
at(3) = averageV9.
at(7) = average.
at(5);
473 averageV9.
at(2) = averageV9.
at(4) = average.
at(6);
475 vtkPieces[0].setCellVar( i, 1, averageV9 );
493 for (
int enrItIndex = 1; enrItIndex <= nEnrIt; enrItIndex++ ) {
495 for (
int nodeInd = 1; nodeInd <= numTotalNodes; nodeInd++ ) {
506 if ( xfemstype == XFEMST_LevelSetPhi ) {
507 double levelSet = 0.0, levelSetInNode = 0.0;
509 for(
int elNodeInd = 1; elNodeInd <= nDofMan; elNodeInd++) {
513 levelSet += N.
at(elNodeInd)*levelSetInNode;
518 vtkPieces[0].setInternalXFEMVarInNode(field, enrItIndex, nodeInd, valueArray);
520 }
else if ( xfemstype == XFEMST_LevelSetGamma ) {
521 double levelSet = 0.0, levelSetInNode = 0.0;
523 for(
int elNodeInd = 1; elNodeInd <= nDofMan; elNodeInd++) {
527 levelSet += N.
at(elNodeInd)*levelSetInNode;
532 vtkPieces[0].setInternalXFEMVarInNode(field, enrItIndex, nodeInd, valueArray);
534 }
else if ( xfemstype == XFEMST_NodeEnrMarker ) {
535 double nodeEnrMarker = 0.0, nodeEnrMarkerInNode = 0.0;
537 for(
int elNodeInd = 1; elNodeInd <= nDofMan; elNodeInd++) {
541 nodeEnrMarker += N.
at(elNodeInd)*nodeEnrMarkerInNode;
546 vtkPieces[0].setInternalXFEMVarInNode(field, enrItIndex, nodeInd, valueArray);
std::vector< Triangle > mSubTri
virtual void drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
int testElementGraphicActivity(Element *)
Test if particular element passed fulfills various filtering criteria for its graphics output...
InternalStateType
Type representing the physical meaning of element or constitutive model internal variable.
void subtract(const FloatArray &src)
Subtracts array src to receiver.
virtual void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord)
Evaluates nodal representation of real internal forces.
Abstract class representing entity, which is included in the FE model using one (or more) global func...
virtual void XfemElementInterface_computeDeformationGradientVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep)
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in full form.
bool evalNodeEnrMarkerInNode(double &oNodeEnrMarker, int iNodeInd) const
virtual void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo)=0
Evaluates the array of interpolation functions (shape functions) at given point.
void giveSubtriangulationCompositeExportData(std::vector< VTKPiece > &vtkPieces, IntArray &primaryVarsToExport, IntArray &internalVarsToExport, IntArray cellVarsToExport, TimeStep *tStep)
VTK Interface.
void computeVectorOf(ValueModeType u, TimeStep *tStep, FloatArray &answer)
Returns local vector of unknowns.
bool isDofManEnriched(const DofManager &iDMan) const
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
virtual void computeEnrichedDofManDofIdArray(IntArray &oDofIdArray, DofManager &iDMan)
Compute Id's of enriched dofs for a given DofManager.
Element_Geometry_Type
Enumerative type used to classify element geometry Possible values are: EGT_point - point in space EG...
virtual ~TrPlaneStress2dXFEM()
int giveGlobalNumber() const
Domain * domain
Link to domain object, useful for communicating with other FEM components.
virtual FEInterpolation * giveInterpolation() const
virtual void computeGaussPoints()
Initializes the array of integration rules member variable.
Provides Xfem interface for an element.
std::unique_ptr< FloatArray > initialDisplacements
Initial displacement vector, describes the initial nodal displacements when element has been casted...
const std::vector< int > & giveNodeEnrichmentItemIndices(int iNodeIndex) const
double & at(int i)
Coefficient access function.
void XfemElementInterface_createEnrBHmatrixAt(FloatMatrix &oAnswer, GaussPoint &iGP, Element &iEl)
Creates enriched BH-matrix.
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
virtual void drawScalar(oofegGraphicContext &gc, TimeStep *tStep)
Elements with geometry defined as EGT_Composite are exported using individual pieces.
oofem::oofegGraphicContext gc[OOFEG_LAST_LAYER]
virtual int checkConsistency()
Performs consistency check.
virtual FloatArray * giveCoordinates()
virtual void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
virtual void initializeCZMaterial()
Base class for dof managers.
virtual void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep)
Computes the stiffness matrix of receiver.
MaterialMode
Type representing material mode of integration point.
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
MatResponseMode
Describes the character of characteristic material matrix.
void XfemElementInterface_createEnrBmatrixAt(FloatMatrix &oAnswer, GaussPoint &iGP, Element &iEl)
Creates enriched B-matrix.
virtual void giveCZInputRecord(DynamicInputRecord &input)
virtual void computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, int lowerIndx=1, int upperIndx=ALL_STRAINS)
Computes the geometrical matrix of receiver in given integration point.
XfemManager * giveXfemManager()
virtual int giveNumberOfDofManagers() const
virtual IRResultType initializeCZFrom(InputRecord *ir)
virtual void computeStressVector(FloatArray &answer, const FloatArray &strain, GaussPoint *gp, TimeStep *tStep)
Computes the stress vector of receiver at given integration point, at time step tStep.
virtual void computeCohesiveTangent(FloatMatrix &answer, TimeStep *tStep)
Class representing a general abstraction for finite element interpolation class.
int giveNumberOfEnrichmentItems() const
InternalStateType giveIntVarType()
void updateYourselfCZ(TimeStep *tStep)
int giveNumberOfDofs() const
virtual int computeNumberOfDofs()
Computes or simply returns total number of element's local DOFs.
virtual int checkConsistency()
Performs consistency check.
virtual void computeBHmatrixAt(GaussPoint *gp, FloatMatrix &answer)
Computes a matrix which, multiplied by the column matrix of nodal displacements, gives the displaceme...
virtual void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep)
UnknownType
Type representing particular unknown (its physical meaning).
bool evalLevelSetNormalInNode(double &oLevelSet, int iNodeInd, const FloatArray &iGlobalCoord) const
void XfemElementInterface_createEnrNmatrixAt(FloatMatrix &oAnswer, const FloatArray &iLocCoord, Element &iEl, bool iSetDiscontContribToZero)
Creates enriched N-matrix.
Wrapper around element definition to provide FEICellGeometry interface.
virtual void giveDofManDofIDMask(int inode, IntArray &answer) const
Returns dofmanager dof mask for node.
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix and anArray.
virtual void computeField(ValueModeType mode, TimeStep *tStep, const FloatArray &lcoords, FloatArray &answer)
Computes the unknown vector interpolated at the specified local coordinates.
virtual void giveElementDofIDMask(IntArray &answer) const
Returns element dof mask for node.
virtual void computeNmatrixAt(const FloatArray &iLocCoord, FloatMatrix &answer)
Computes interpolation matrix for element unknowns.
virtual MaterialMode giveMaterialMode()
Returns material mode for receiver integration points.
int giveDofManPlaceInArray(int iGlobalDofManNum) const
Returns the array index of the dofman with global number iGlobalDofManNum, so that it can be fetched ...
InternalStateMode giveIntVarMode()
virtual Interface * giveInterface(InterfaceType)
Interface requesting service.
bool evalLevelSetTangInNode(double &oLevelSet, int iNodeInd, const FloatArray &iGlobalCoord) const
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
Class representing vector of real numbers.
virtual Element_Geometry_Type giveGeometryType() const
Returns the element geometry type.
virtual void computeDeformationGradientVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep)
Computes the deformation gradient in Voigt form at integration point ip and at time step tStep...
Implementation of matrix containing floating point numbers.
MaterialMode giveMaterialMode()
This class manages the xfem part.
IRResultType
Type defining the return values of InputRecord reading operations.
virtual void updateYourself(TimeStep *tStep)
Updates element state after equilibrium in time step has been reached.
static void computeIPAverage(FloatArray &answer, IntegrationRule *iRule, Element *elem, InternalStateType isType, TimeStep *tStep)
Computes a cell average of an InternalStateType varible based on the weights in the integrationpoints...
virtual void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep)
Computes the stiffness matrix of receiver.
IntArray vtkExportFields
List with the fields that should be exported to VTK.
virtual void postInitialize()
Performs post initialization steps.
bool isElementEnriched(const Element *elem)
void followedBy(const IntArray &b, int allocChunk=0)
Appends array b at the end of receiver.
EnrichmentItem * giveEnrichmentItem(int n)
virtual bool computeLocalCoordinates(FloatArray &answer, const FloatArray &gcoords)
Computes the element local coordinates from given global coordinates.
std::vector< std::unique_ptr< IntegrationRule > > integrationRulesArray
List of integration rules of receiver (each integration rule contains associated integration points a...
virtual bool XfemElementInterface_updateIntegrationRule()
Updates integration rule based on the triangulation.
Domain * giveDomain() const
InterfaceType
Enumerative type, used to identify interface type.
virtual void updateYourself(TimeStep *tStep)
Updates element state after equilibrium in time step has been reached.
void push_back(const double &iVal)
Add one element.
virtual void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord=0)
Evaluates nodal representation of real internal forces.
virtual void giveCompositeExportData(std::vector< VTKPiece > &vtkPieces, IntArray &primaryVarsToExport, IntArray &internalVarsToExport, IntArray cellVarsToExport, TimeStep *tStep)
VTK Interface.
virtual void giveElementDofIDMask(IntArray &answer) const
Returns element dof mask for node.
virtual void postInitialize()
Performs post initialization steps.
virtual Interface * giveInterface(InterfaceType it)
Interface requesting service.
int giveSize() const
Returns the size of receiver.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual void computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *, TimeStep *tStep)
Computes constitutive matrix of receiver.
DofManager * giveDofManager(int i) const
virtual void computeCohesiveForces(FloatArray &answer, TimeStep *tStep)
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
virtual void giveDofManDofIDMask(int inode, IntArray &answer) const
Returns dofmanager dof mask for node.
virtual void computeGaussPoints()
Initializes the array of integration rules member variable.
int giveNumberOfRows() const
Returns number of rows of receiver.
Class representing integration point in finite element program.
Class representing solution step.
virtual void XfemElementInterface_computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *, TimeStep *tStep)
PatchIntegrationRule provides integration over a triangle patch.
virtual void XfemElementInterface_computeStressVector(FloatArray &answer, const FloatArray &strain, GaussPoint *gp, TimeStep *tStep)