OOFEM 3.0
Loading...
Searching...
No Matches
enrichmentfrontlinbranchfunconeel.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
36#include "dynamicinputrecord.h"
37#include "classfactory.h"
38#include "xfem/xfemmanager.h"
39#include "domain.h"
40#include "spatiallocalizer.h"
41#include "element.h"
42#include "gausspoint.h"
43#include "mathfem.h"
44
45namespace oofem {
47
48
49EnrFrontLinearBranchFuncOneEl :: EnrFrontLinearBranchFuncOneEl() :
50 mpBranchFunc()
51{ }
52
53EnrFrontLinearBranchFuncOneEl :: ~EnrFrontLinearBranchFuncOneEl() { }
54
55
56void EnrFrontLinearBranchFuncOneEl :: 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)
57{
58 MarkTipElementNodesAsFront(ioNodeEnrMarkerMap, ixFemMan, iLevelSetNormalDirMap, iLevelSetTangDirMap, iTipInfo);
59}
60
61int EnrFrontLinearBranchFuncOneEl :: giveNumEnrichments(const DofManager &iDMan) const
62{
63 return 4;
64}
65
66void EnrFrontLinearBranchFuncOneEl :: evaluateEnrFuncAt(std :: vector< double > &oEnrFunc, const EfInput &iEfInput) const
67{
68 FloatArray xTip = Vec2(
69 mTipInfo.mGlobalCoord.at(1), mTipInfo.mGlobalCoord.at(2)
70 );
71
72 FloatArray pos = Vec2(
73 iEfInput.mPos.at(1), iEfInput.mPos.at(2)
74 );
75
76 // Crack tangent and normal
77 FloatArray t, n;
78 bool flipTangent = false;
79 computeCrackTangent(t, n, flipTangent, iEfInput);
80
81 double r = 0.0, theta = 0.0;
82 EnrichmentItem :: calcPolarCoord(r, theta, xTip, pos, n, t, iEfInput, flipTangent);
83
84 mpBranchFunc.evaluateEnrFuncAt(oEnrFunc, r, theta);
85
86#ifdef DEBUG
87 for ( double val:oEnrFunc ) {
88 if ( !std :: isfinite(val) ) {
89 printf("r: %e theta: %e\n", r, theta);
90 OOFEM_ERROR("!std::isfinite(val)")
91 }
92 }
93#endif
94}
95
96void EnrFrontLinearBranchFuncOneEl :: evaluateEnrFuncDerivAt(std :: vector< FloatArray > &oEnrFuncDeriv, const EfInput &iEfInput, const FloatArray &iGradLevelSet) const
97{
98 const FloatArray &xTip = mTipInfo.mGlobalCoord;
99
100 // Crack tangent and normal
101 FloatArray t, n;
102 bool flipTangent = false;
103 computeCrackTangent(t, n, flipTangent, iEfInput);
104
105 double r = 0.0, theta = 0.0;
106 EnrichmentItem :: calcPolarCoord(r, theta, xTip, iEfInput.mPos, n, t, iEfInput, flipTangent);
107
108
109 size_t sizeStart = oEnrFuncDeriv.size();
110 mpBranchFunc.evaluateEnrFuncDerivAt(oEnrFuncDeriv, r, theta);
111
116 E.resize(2, 2);
117 E.setColumn(t, 1);
118 E.setColumn(n, 2);
119
120
121 for ( size_t j = sizeStart; j < oEnrFuncDeriv.size(); j++ ) {
122 FloatArray enrFuncDerivGlob;
123 enrFuncDerivGlob.beProductOf(E, oEnrFuncDeriv [ j ]);
124 oEnrFuncDeriv [ j ] = enrFuncDerivGlob;
125 }
126}
127
128void EnrFrontLinearBranchFuncOneEl :: evaluateEnrFuncJumps(std :: vector< double > &oEnrFuncJumps, GaussPoint &iGP, int iNodeInd, bool iGPLivesOnCurrentCrack, const double &iNormalSignDist) const
129{
130 const FloatArray &xTip = mTipInfo.mGlobalCoord;
131 const FloatArray &gpCoord = iGP.giveGlobalCoordinates();
132
133 double radius = distance(gpCoord, xTip);
134
135 std :: vector< double >jumps;
136 mpBranchFunc.giveJump(jumps, radius);
137
138 oEnrFuncJumps.insert( oEnrFuncJumps.end(), jumps.begin(), jumps.end() );
139}
140
141void EnrFrontLinearBranchFuncOneEl :: initializeFrom(InputRecord &ir)
142{
143}
144
145void EnrFrontLinearBranchFuncOneEl :: giveInputRecord(DynamicInputRecord &input)
146{
147 int number = 1;
148 input.setRecordKeywordField(this->giveInputRecordName(), number);
149}
150} // end namespace oofem
#define E(a, b)
#define REGISTER_EnrichmentFront(class)
void setRecordKeywordField(std ::string keyword, int number)
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
#define OOFEM_ERROR(...)
Definition error.h:79
static FloatArray Vec2(const double &a, const double &b)
Definition floatarray.h:606
double distance(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