OOFEM 3.0
Loading...
Searching...
No Matches
enrichmentfrontlinbranchfuncradius.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
37#include "dynamicinputrecord.h"
38#include "classfactory.h"
39#include "xfem/xfemmanager.h"
40#include "domain.h"
41#include "connectivitytable.h"
42#include "gausspoint.h"
43
44namespace oofem {
46
47EnrFrontLinearBranchFuncRadius :: EnrFrontLinearBranchFuncRadius() :
48 mEnrichmentRadius(0.0),
49 mpBranchFunc()
50{ }
51
52EnrFrontLinearBranchFuncRadius :: ~EnrFrontLinearBranchFuncRadius() { }
53
54void EnrFrontLinearBranchFuncRadius :: MarkNodesAsFront(std :: unordered_map< int, NodeEnrichmentType > &ioNodeEnrMarkerMap, XfemManager &ixFemMan, const std :: unordered_map< int, double > &iLevelSetNormalDirMap, const std :: unordered_map< int, double > &iLevelSetTangDirMap, const TipInfo &iTipInfo)
55{
56 // Enrich all nodes within a prescribed radius around the crack tips.
57 // TODO: If performance turns out to be an issue, we may wish
58 // to put the nodes in a Kd tree (or similar) to speed up searching.
59 // For now, loop over all nodes.
60
61 mTipInfo = iTipInfo;
62
63 Domain *d = ixFemMan.giveDomain();
64 int nNodes = d->giveNumberOfDofManagers();
65
66 // Make sure that the tip element gets enriched,
67 // even if the radius is smaller than the element size
68 MarkTipElementNodesAsFront(ioNodeEnrMarkerMap, ixFemMan, iLevelSetNormalDirMap, iLevelSetTangDirMap, iTipInfo);
69
70 for ( int i = 1; i <= nNodes; i++ ) {
71 DofManager *dMan = d->giveDofManager(i);
72 const auto &nodePos = dMan->giveCoordinates();
73
74 double radius2 = distance_square(iTipInfo.mGlobalCoord, nodePos);
75
76 if ( radius2 < mEnrichmentRadius * mEnrichmentRadius ) {
77 if ( ( ioNodeEnrMarkerMap [ i ] == NodeEnr_START_TIP && iTipInfo.mTipIndex == 1 ) ||
78 ( ioNodeEnrMarkerMap [ i ] == NodeEnr_END_TIP && iTipInfo.mTipIndex == 0 ) ) {
79 ioNodeEnrMarkerMap [ i ] = NodeEnr_START_AND_END_TIP;
80 } else {
81 if ( iTipInfo.mTipIndex == 0 ) {
82 ioNodeEnrMarkerMap [ i ] = NodeEnr_START_TIP;
83 }
84
85 if ( iTipInfo.mTipIndex == 1 ) {
86 ioNodeEnrMarkerMap [ i ] = NodeEnr_END_TIP;
87 }
88 }
89 }
90 }
91}
92
93int EnrFrontLinearBranchFuncRadius :: giveNumEnrichments(const DofManager &iDMan) const
94{
95 return 4;
96}
97
98void EnrFrontLinearBranchFuncRadius :: evaluateEnrFuncAt(std :: vector< double > &oEnrFunc, const EfInput &iEfInput) const
99{
100 FloatArray xTip = Vec2(
101 mTipInfo.mGlobalCoord.at(1), mTipInfo.mGlobalCoord.at(2)
102 );
103
104 FloatArray pos = Vec2(
105 iEfInput.mPos.at(1), iEfInput.mPos.at(2)
106 );
107
108 // Crack tangent and normal
109 FloatArray t, n;
110 bool flipTangent = false;
111 computeCrackTangent(t, n, flipTangent, iEfInput);
112
113 double r = 0.0, theta = 0.0;
114 EnrichmentItem :: calcPolarCoord(r, theta, xTip, pos, n, t, iEfInput, flipTangent);
115
116 mpBranchFunc.evaluateEnrFuncAt(oEnrFunc, r, theta);
117}
118
119void EnrFrontLinearBranchFuncRadius :: evaluateEnrFuncDerivAt(std :: vector< FloatArray > &oEnrFuncDeriv, const EfInput &iEfInput, const FloatArray &iGradLevelSet) const
120{
121 const FloatArray &xTip = mTipInfo.mGlobalCoord;
122
123 // Crack tangent and normal
124 FloatArray t, n;
125 bool flipTangent = false;
126 computeCrackTangent(t, n, flipTangent, iEfInput);
127
128 double r = 0.0, theta = 0.0;
129 EnrichmentItem :: calcPolarCoord(r, theta, xTip, iEfInput.mPos, n, t, iEfInput, flipTangent);
130
131
132 size_t sizeStart = oEnrFuncDeriv.size();
133 mpBranchFunc.evaluateEnrFuncDerivAt(oEnrFuncDeriv, r, theta);
134
139 E.resize(2, 2);
140 E.setColumn(t, 1);
141 E.setColumn(n, 2);
142
143
144 for ( size_t j = sizeStart; j < oEnrFuncDeriv.size(); j++ ) {
145 FloatArray enrFuncDerivGlob;
146 enrFuncDerivGlob.beProductOf(E, oEnrFuncDeriv [ j ]);
147 oEnrFuncDeriv [ j ] = enrFuncDerivGlob;
148 }
149}
150
151void EnrFrontLinearBranchFuncRadius :: evaluateEnrFuncJumps(std :: vector< double > &oEnrFuncJumps, GaussPoint &iGP, int iNodeInd, bool iGPLivesOnCurrentCrack, const double &iNormalSignDist) const
152{
153 const FloatArray &xTip = mTipInfo.mGlobalCoord;
154 const FloatArray &gpCoord = iGP.giveGlobalCoordinates();
155 double radius = distance(gpCoord, xTip);
156
157 std :: vector< double >jumps;
158 mpBranchFunc.giveJump(jumps, radius);
159
160 oEnrFuncJumps.insert( oEnrFuncJumps.end(), jumps.begin(), jumps.end() );
161}
162
163void EnrFrontLinearBranchFuncRadius :: initializeFrom(InputRecord &ir)
164{
166}
167
168void EnrFrontLinearBranchFuncRadius :: giveInputRecord(DynamicInputRecord &input)
169{
170 int number = 1;
171 input.setRecordKeywordField(this->giveInputRecordName(), number);
172
174}
175} // end namespace oofem
#define E(a, b)
#define REGISTER_EnrichmentFront(class)
const FloatArray & giveCoordinates() const
Definition dofmanager.h:390
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
Definition domain.h:461
DofManager * giveDofManager(int n)
Definition domain.C:317
void setRecordKeywordField(std ::string keyword, int number)
void setField(int item, InputFieldType id)
void MarkTipElementNodesAsFront(std ::unordered_map< int, NodeEnrichmentType > &ioNodeEnrMarkerMap, XfemManager &ixFemMan, const std ::unordered_map< int, double > &iLevelSetNormalDirMap, const std ::unordered_map< int, double > &iLevelSetTangDirMap, const TipInfo &iTipInfo)
TipInfo mTipInfo
reference to the associated enrichment item
void computeCrackTangent(FloatArray &oTangent, FloatArray &oNormal, bool &oFlipTangent, const EfInput &iEfInput) const
double & at(Index i)
Definition floatarray.h:202
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Definition floatarray.C:689
const FloatArray & giveGlobalCoordinates()
Definition gausspoint.h:159
FloatArray mGlobalCoord
Definition tipinfo.h:30
Domain * giveDomain()
#define _IFT_EnrFrontLinearBranchFuncRadius_Radius
#define IR_GIVE_FIELD(__ir, __value, __id)
Definition inputrecord.h:67
static FloatArray Vec2(const double &a, const double &b)
Definition floatarray.h:606
@ NodeEnr_START_TIP
@ NodeEnr_END_TIP
@ NodeEnr_START_AND_END_TIP
double distance(const FloatArray &x, const FloatArray &y)
double distance_square(const FloatArray &x, const FloatArray &y)

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