OOFEM 3.0
Loading...
Searching...
No Matches
latticelinearelastic.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 program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 2 of the License, or
23 * (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
28 * GNU General Public License for more details.
29 *
30 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33 */
34
36#include "latticematstatus.h"
38#include "gausspoint.h"
39#include "floatmatrix.h"
40#include "floatmatrixf.h"
41#include "floatarray.h"
42#include "floatarrayf.h"
44#include "engngm.h"
45#include "mathfem.h"
47#include "datastream.h"
48#include "staggeredproblem.h"
49#include "contextioerr.h"
50#include "classfactory.h"
51
52namespace oofem {
54
55// constructor which creates a dummy material without a status and without random extension interface
56LatticeLinearElastic :: LatticeLinearElastic(int n, Domain *d, double e, double a1, double a2) :
58 eNormalMean(e),
59 alphaOne(a1),
60 alphaTwo(a2)
61{}
62
63
64bool
65LatticeLinearElastic :: hasMaterialModeCapability(MaterialMode mode) const
66{
67 return ( mode == _3dLattice );
68}
69
70
71void
72LatticeLinearElastic :: initializeFrom(InputRecord &ir)
73{
74 LatticeStructuralMaterial :: initializeFrom(ir);
75 RandomMaterialExtensionInterface :: initializeFrom(ir);
76
77 //Young's modulus of the material that the network element is made of
79
80 //Parameter which relates the shear stiffness to the normal stiffness. Default is 1
81 alphaOne = 1.;
83
84 //Parameter which is used for the definition of bending stiffness. Default is 0.
85 alphaTwo = 0.;
87
88 localRandomType = 0; //Default: No local random field
90 if ( localRandomType == 1 ) { //Gaussian random generator
93 }
94
95
96 this->cAlpha = 0;
98}
99
100std::unique_ptr<MaterialStatus>
101LatticeLinearElastic :: CreateStatus(GaussPoint *gp) const
102{
103 return std::make_unique<LatticeMaterialStatus>(gp);
104}
105
107LatticeLinearElastic :: giveStatus(GaussPoint *gp) const
108{
109 if (!gp->hasMaterialStatus()) {
110 // create a new one
111 gp->setMaterialStatus(this->CreateStatus(gp));
112 this->_generateStatusVariables(gp);
113 }
114
115 return static_cast<MaterialStatus*> (gp->giveMaterialStatus());
116}
117
118
120LatticeLinearElastic :: giveLatticeStress3d(const FloatArrayF< 6 > &strain,
121 GaussPoint *gp,
122 TimeStep *tStep)
123{
124 auto status = static_cast< LatticeMaterialStatus * >( this->giveStatus(gp) );
125
126 this->initTempStatus(gp);
127
128 // subtract stress independent part
129 auto reducedStrain = strain;
130 FloatArray indepStrain = this->computeStressIndependentStrainVector(gp, tStep, VM_Total);
131 if ( indepStrain.giveSize() > 0 ) {
132 reducedStrain -= FloatArrayF< 6 >(indepStrain);
133 }
134
135 auto stiffnessMatrix = LatticeLinearElastic :: give3dLatticeStiffnessMatrix(ElasticStiffness, gp, tStep);
136 auto stress = dot(stiffnessMatrix, reducedStrain);
137
138 //Read in fluid pressures from structural element if this is not a slave problem
139 FloatArray pressures;
140 if ( !domain->giveEngngModel()->giveMasterEngngModel() ) {
141 static_cast< LatticeStructuralElement * >( gp->giveElement() )->givePressures(pressures);
142 }
143
144 double waterPressure = 0.;
145 for ( int i = 0; i < pressures.giveSize(); i++ ) {
146 waterPressure += 1. / pressures.giveSize() * pressures [ i ];
147 }
148
149 stress.at(1) += waterPressure;
150
151 //Set all temp values
152 status->letTempLatticeStrainBe(strain);
153 status->letTempLatticeStressBe(stress);
154
155 return stress;
156}
157
158
159void LatticeLinearElastic :: giveRandomParameters(FloatArray &param)
160{
161 param.resize(3);
162 param.zero();
163 param.at(1) = localRandomType;
164
165 if ( localRandomType == 1 ) { //Gaussian
166 param.at(2) = coefficientOfVariation;
167 } else {
168 OOFEM_ERROR("Error: Unknown local random type:\n randomtype 1 = Gaussian\n");
169 }
170}
171
172
173Interface *
174LatticeLinearElastic :: giveInterface(InterfaceType type)
175{
176 return nullptr;
177}
178
179
181LatticeLinearElastic :: give3dLatticeStiffnessMatrix(MatResponseMode rmode, GaussPoint *gp, TimeStep *atTime) const
182{
183 //Needed to make sure that status exists before random values are requested for elastic stiffness. Problem is that gp->giveMaterialStatus does not check if status exist already
184
185 //static_cast< LatticeMaterialStatus * >( this->giveStatus(gp) );
186
188 1.,
189 this->alphaOne, // shear
190 this->alphaOne, // shear
191 this->alphaTwo, // torsion
192 this->alphaTwo, // torsion
193 this->alphaTwo, // torsion
194 };
195
196 return diag(d * this->give(eNormal_ID, gp) * this->eNormalMean);
197}
198
199
201LatticeLinearElastic :: give2dLatticeStiffnessMatrix(MatResponseMode rmode, GaussPoint *gp, TimeStep *atTime) const
202{
203 //Needed to make sure that status exists before random values are requested for elastic stiffness. Problem is that gp->giveMaterialStatus does not check if status exist already
204
205 //static_cast< LatticeMaterialStatus * >( this->giveStatus(gp) );
206
208 1.,
209 this->alphaOne, // shear
210 this->alphaTwo, // torsion
211 };
212
213 return diag(d * this->give(eNormal_ID, gp) * this->eNormalMean);
214}
215
216
218LatticeLinearElastic :: giveThermalDilatationVector(GaussPoint *gp, TimeStep *tStep) const
219//
220// returns a FloatArray(6) of initial strain vector
221// caused by unit temperature in direction of
222// gp (element) local axes
223//
224{
225 double alpha = this->give(tAlpha, gp);
226
227 //Option to add a eigendisplacement instead of strain
228 double length = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveLength();
229 alpha += this->cAlpha / length;
230
231 return {
232 alpha, 0., 0., 0., 0., 0.
233 };
234}
235
236
237double
238LatticeLinearElastic :: give(int aProperty, GaussPoint *gp) const
239{
240 this->giveStatus(gp);
241
242 double answer;
243 if ( RandomMaterialExtensionInterface :: give(aProperty, gp, answer) ) {
244 if ( answer < 0.1 ) { //Introduce cut off to avoid numerical problems
245 answer = 0.1;
246 } else if ( answer > 10 ) {
247 answer = 10;
248 }
249 return answer;
250 } else if ( aProperty == eNormal_ID ) {
251 return 1.;
252 } else if ( aProperty == 'E' ) {
253 return this->eNormalMean;
254 } else {
255 return LatticeStructuralMaterial :: give(aProperty, gp);
256 }
257}
258}
double length(const Vector &a)
Definition CSG.h:88
#define REGISTER_Material(class)
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Definition femcmpnn.h:79
void resize(Index s)
Definition floatarray.C:94
double & at(Index i)
Definition floatarray.h:202
Index giveSize() const
Returns the size of receiver.
Definition floatarray.h:261
void zero()
Zeroes all coefficients of receiver.
Definition floatarray.C:683
bool hasMaterialStatus(IntegrationPointStatusIDType key=IPSID_Default) const
Definition gausspoint.h:206
IntegrationPointStatus * setMaterialStatus(std::unique_ptr< IntegrationPointStatus > ptr, IntegrationPointStatusIDType key=IPSID_Default)
Definition gausspoint.h:213
IntegrationPointStatus * giveMaterialStatus(IntegrationPointStatusIDType key=IPSID_Default)
Definition gausspoint.h:204
Element * giveElement()
Returns corresponding element to receiver.
Definition gausspoint.h:187
std::unique_ptr< MaterialStatus > CreateStatus(GaussPoint *gp) const override
double alphaOne
Ratio of shear and normal modulus.
double alphaTwo
Ratio of torsion and normal modulus.
double cAlpha
parameter which allows to prescribed thermal displacement
double eNormalMean
Normal modulus.
double coefficientOfVariation
coefficient variation of the Gaussian distribution
double give(int aProperty, GaussPoint *gp) const override
double localRandomType
flag which chooses between no distribution (0) and Gaussian distribution (1)
MaterialStatus * giveStatus(GaussPoint *gp) const override
virtual void givePressures(FloatArray &pressures)
virtual void initTempStatus(GaussPoint *gp) const
Definition material.C:221
void _generateStatusVariables(GaussPoint *) const
virtual FloatArray computeStressIndependentStrainVector(GaussPoint *gp, TimeStep *tStep, ValueModeType mode) const
#define OOFEM_ERROR(...)
Definition error.h:79
#define IR_GIVE_OPTIONAL_FIELD(__ir, __value, __id)
Definition inputrecord.h:75
#define IR_GIVE_FIELD(__ir, __value, __id)
Definition inputrecord.h:67
#define _IFT_LatticeLinearElastic_e
#define _IFT_LatticeLinearElastic_calpha
#define _IFT_LatticeLinearElastic_a1
#define _IFT_LatticeLinearElastic_a2
#define _IFT_LatticeLinearElastic_cov
#define _IFT_LatticeLinearElastic_localrandomtype
#define eNormal_ID
Definition matconst.h:100
#define tAlpha
Definition matconst.h:67
FloatMatrixF< N, N > diag(const FloatArrayF< N > &v)
double dot(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