OOFEM 3.0
Loading...
Searching...
No Matches
prescribeddispsliphomogenization.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 "domain.h"
37#include "dynamicinputrecord.h"
38#include "set.h"
39#include "feinterpol.h"
40#include "element.h"
41#include "mathfem.h"
42
43namespace oofem {
44
58
67
68
70{
71 int n = t.giveSize();
72 if ( n == 2 ) { // Then 2D
73 this->dispField.resize(2);
74 this->dispField.at(1) = t.at(1);
75 this->dispField.at(2) = t.at(2);
76 } else {
77 OOFEM_ERROR("Field is in strange format. Should be 2 or 3.");
78 }
79}
80
81
83{
84 int n = t.giveSize();
85 if ( n == 2 ) { // Then 2D
86 this->slipField.resize(2);
87 this->slipField.at(1) = t.at(1);
88 this->slipField.at(2) = t.at(2);
89 } else {
90 OOFEM_ERROR("Field is in strange format. Should be 2 or 3.");
91 }
92}
93
94
96{
97 int n = t.giveSize();
98 if ( n == 3 ) { // Then 2D
99 this->dispGradient.resize(2, 2);
100 this->dispGradient.at(1, 1) = t.at(1);
101 this->dispGradient.at(2, 2) = t.at(2);
102 // In voigt form, assuming the use of gamma_12 instead of eps_12
103 this->dispGradient.at(1, 2) = this->dispGradient.at(2, 1) = t.at(3) * 0.5;
104 } else {
105 OOFEM_ERROR("Tensor is in strange voigt format. Should be 3.");
106 }
107}
108
109
111{
112 int n = t.giveSize();
113 if ( n == 4 ) { // Then 2D
114 this->slipGradient.resize(2, 2);
115 this->slipGradient.at(1, 1) = t.at(1);
116 this->slipGradient.at(2, 2) = t.at(2);
117 this->slipGradient.at(1, 2) = t.at(3);
118 this->slipGradient.at(2,1) = t.at(4);
119 } else {
120 OOFEM_ERROR("Tensor is in strange voigt format. Should be 4.");
121 }
122
123}
124
125
127{
128 int size = dispField.giveSize();
129 if ( size == 2 ) {
130 oField = Vec2( dispField.at(1), dispField.at(2) );
131 } else {
132 OOFEM_ERROR("PrescribedDispSlipHomogenization :: giveDispField not implemented for 3D.\n");
133 }
134}
135
136
138{
139 int size = slipField.giveSize();
140 if ( size == 2 ) {
141 oField = Vec2( slipField.at(1), slipField.at(2) );
142 } else {
143 OOFEM_ERROR("PrescribedDispSlipHomogenization :: giveSlipField not implemented for 3D.\n");
144 }
145}
146
147
149{
150 int numRows = dispGradient.giveNumberOfRows();
151 if ( numRows == 2 ) {
152 oGradient = Vec4( dispGradient.at(1, 1), dispGradient.at(2, 2), dispGradient.at(1, 2), dispGradient.at(2, 1) );
153 } else {
154 OOFEM_ERROR("PrescribedDispSlipHomogenization :: giveDispGradient not implemented for 3D.\n");
155 }
156}
157
158
160{
161 int numRows = slipGradient.giveNumberOfRows();
162 if ( numRows == 2 ) {
163 oGradient = Vec4( slipGradient.at(1, 1), slipGradient.at(2, 2), slipGradient.at(1, 2), slipGradient.at(2, 1) );
164 } else {
165 OOFEM_ERROR("PrescribedDispSlipHomogenization :: giveSlipGradient not implemented for 3D.\n");
166 }
167}
168
169
171{
172 int nsd = d->giveNumberOfSpatialDimensions();
173 double domain_size = 0.0;
174 // This requires the boundary to be consistent and ordered correctly.
175 Set *set = d->giveSet(setNum);
176 const IntArray &boundaries = set->giveBoundaryList();
177
178 for ( int pos = 1; pos <= boundaries.giveSize() / 2; ++pos ) {
179 Element *e = d->giveElement( boundaries.at(pos * 2 - 1) );
180 int boundary = boundaries.at(pos * 2);
182 domain_size += fei->evalNXIntegral( boundary, FEIElementGeometryWrapper(e) );
183 }
184 return fabs(domain_size / nsd);
185}
186} /* namespace oofem */
Set * giveSet(int n)
Definition domain.C:366
Element * giveElement(int n)
Definition domain.C:165
int giveNumberOfSpatialDimensions()
Returns number of spatial dimensions.
Definition domain.C:1137
void setField(int item, InputFieldType id)
virtual FEInterpolation * giveInterpolation() const
Definition element.h:648
virtual double evalNXIntegral(int boundary, const FEICellGeometry &cellgeo) const
Definition feinterpol.h:477
double & at(Index i)
Definition floatarray.h:202
Index giveSize() const
Returns the size of receiver.
Definition floatarray.h:261
int & at(std::size_t i)
Definition intarray.h:104
int giveSize() const
Definition intarray.h:211
virtual void giveInputRecord(DynamicInputRecord &input)
const IntArray & giveBoundaryList()
Definition set.C:160
#define OOFEM_ERROR(...)
Definition error.h:79
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Definition inputrecord.h:75
static FloatArray Vec2(const double &a, const double &b)
Definition floatarray.h:606
static FloatArray Vec4(const double &a, const double &b, const double &c, const double &d)
Definition floatarray.h:608
#define _IFT_PrescribedDispSlipHomogenization_slipGrad
#define _IFT_PrescribedDispSlipHomogenization_slipField
#define _IFT_PrescribedDispSlipHomogenization_centercoords
#define _IFT_PrescribedDispSlipHomogenization_dispGrad
#define _IFT_PrescribedDispSlipHomogenization_dispField

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