OOFEM 3.0
Loading...
Searching...
No Matches
propagationlaw.C
Go to the documentation of this file.
1/*
2 *
3 * ##### ##### ###### ###### ### ###
4 * ## ## ## ## ## ## ## ### ##
5 * ## ## ## ## #### #### ## # ##
6 * ## ## ## ## ## ## ## ##
7 * ## ## ## ## ## ## ## ##
8 * ##### ##### ## ###### ## ##
9 *
10 *
11 * OOFEM : Object Oriented Finite Element Code
12 *
13 * Copyright (C) 1993 - 2025 Borek Patzak
14 *
15 *
16 *
17 * Czech Technical University, Faculty of Civil Engineering,
18 * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19 *
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License as published by the Free Software Foundation; either
23 * version 2.1 of the License, or (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public
31 * License along with this library; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 */
34
35
36
37#include "propagationlaw.h"
38#include "tipinfo.h"
39#include "classfactory.h"
40#include "mathfem.h"
41#include "dynamicinputrecord.h"
42#include "spatiallocalizer.h"
43#include "floatmatrix.h"
44#include "gausspoint.h"
45#include "enrichmentitem.h"
46#include "feinterpol.h"
47#include "xfemmanager.h"
48
49#include "XFEMDebugTools.h"
50
51namespace oofem {
57
58PropagationLaw :: ~PropagationLaw() { }
59
60void PLDoNothing :: giveInputRecord(DynamicInputRecord &input)
61{
62 int number = 1;
63 input.setRecordKeywordField(this->giveInputRecordName(), number);
64}
65
66void PLCrackPrescribedDir :: initializeFrom(InputRecord &ir)
67{
70
71 // printf("In PLCrackPrescribedDir :: initializeFrom: mAngle: %e mIncrementLength: %e\n", mAngle, mIncrementLength);
72}
73
74void PLCrackPrescribedDir :: giveInputRecord(DynamicInputRecord &input)
75{
76 int number = 1;
77 input.setRecordKeywordField(this->giveInputRecordName(), number);
78
81}
82
83bool PLCrackPrescribedDir :: propagateInterface(Domain &iDomain, EnrichmentFront &iEnrFront, TipPropagation &oTipProp)
84{
85 if ( !iEnrFront.propagationIsAllowed() ) {
86 return false;
87 }
88
89 const TipInfo &tipInfo = iEnrFront.giveTipInfo();
90
91 SpatialLocalizer *localizer = iDomain.giveSpatialLocalizer();
92 // It is meaningless to propagate a tip that is not inside any element
93 if ( tipInfo.mGlobalCoord.giveSize() == 0 ) {
94 return false;
95 }
96
97 Element *el = localizer->giveElementContainingPoint(tipInfo.mGlobalCoord);
98 if ( el == NULL ) {
99 return false;
100 }
101
102
103 double angleRad = mAngle * M_PI / 180.0;
104 FloatArray dir = Vec2(
105 cos(angleRad), sin(angleRad)
106 );
107
108 oTipProp.mTipIndex = tipInfo.mTipIndex;
109 oTipProp.mPropagationDir = dir;
111
112 return true;
113}
114
115void PLnodeRadius :: initializeFrom(InputRecord &ir)
116{
118
119 //printf("In PLnodeRadius :: initializeFrom: mRadius: %e \n", mRadius);
120}
121
122void PLnodeRadius :: giveInputRecord(DynamicInputRecord &input)
123{
124 int number = 1;
125 input.setRecordKeywordField(this->giveInputRecordName(), number);
126
128}
129
130bool PLnodeRadius :: propagateInterface(Domain &iDomain, EnrichmentFront &iEnrFront, TipPropagation &oTipProp)
131{
132 if ( !iEnrFront.propagationIsAllowed() ) {
133 printf("EnrichmentFront.propagationIsAllowed is false \n");
134 return false;
135 }
136
137 const TipInfo &tipInfo = iEnrFront.giveTipInfo(); // includes the dofman numbers which represent the boundary of the EI.
138 //tipInfo.mTipDofManNumbers.printYourself();
139
140 // No listbased tip (or EI) present, so nothing to propagate.
141 if ( tipInfo.mTipDofManNumbers.giveSize() == 0 ) {
142 printf("No dofmans in tip; nothing to propagate. \n");
143 return false;
144 }
145
146 // Localise nodes within certain radius from tip nodes
148 SpatialLocalizer *localizer = iDomain.giveSpatialLocalizer();
149
150 for ( int i = 1 ; i <= tipInfo.mTipDofManNumbers.giveSize() ; i++ ) {
151
152 //DofManager *dofMan = iDomain.giveDofManager(tipInfo.mTipDofManNumbers.at(i));
153 //const FloatArray gCoords = dofMan->giveCoordinates();
154 Node *iNode = iDomain.giveNode(tipInfo.mTipDofManNumbers.at(i));
155 const auto &gCoords = iNode->giveCoordinates();
156
157 std :: list< int > nodeList;
158 localizer->giveAllNodesWithinBox(nodeList,gCoords,mRadius);
159 for ( int jNode : nodeList ) {
160 //printf("nodeList node %d \n",jNode);
162 }
163
164 }
165 //oTipProp.mPropagationDofManNumbers.printYourself(" The following noded will be propagated to:");
166
167 return true;
168}
169
170} // end namespace oofem
#define REGISTER_PropagationLaw(class)
const FloatArray & giveCoordinates() const
Definition dofmanager.h:390
SpatialLocalizer * giveSpatialLocalizer()
Definition domain.C:1255
Node * giveNode(int n)
Definition domain.h:398
void setRecordKeywordField(std ::string keyword, int number)
void setField(int item, InputFieldType id)
const TipInfo & giveTipInfo() const
virtual bool propagationIsAllowed() const
Index giveSize() const
Returns the size of receiver.
Definition floatarray.h:261
bool insertSortedOnce(int value, int allocChunk=0)
Definition intarray.C:309
int & at(std::size_t i)
Definition intarray.h:104
int giveSize() const
Definition intarray.h:211
const char * giveInputRecordName() const override
const char * giveInputRecordName() const override
const char * giveInputRecordName() const override
virtual Element * giveElementContainingPoint(const FloatArray &coords, const IntArray *regionList=nullptr)=0
virtual void giveAllNodesWithinBox(nodeContainerType &nodeList, const FloatArray &coords, const double radius)=0
IntArray mTipDofManNumbers
Local number of which edge the crack enters the element (2d).
Definition tipinfo.h:36
FloatArray mGlobalCoord
Definition tipinfo.h:30
#define IR_GIVE_FIELD(__ir, __value, __id)
Definition inputrecord.h:67
#define M_PI
Definition mathfem.h:52
static FloatArray Vec2(const double &a, const double &b)
Definition floatarray.h:606
#define _IFT_PLCrackPrescribedDir_Dir
#define _IFT_PLCrackPrescribedDir_IncLength
#define _IFT_PLnodeRadius_Radius
double mPropagationLength
Definition tipinfo.h:45
FloatArray mPropagationDir
Definition tipinfo.h:44
IntArray mPropagationDofManNumbers
Definition tipinfo.h:46

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011