OOFEM 3.0
Loading...
Searching...
No Matches
fluiddynamicmaterial.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 "gausspoint.h"
37#include "floatarray.h"
38#include "contextioerr.h"
39
40namespace oofem {
41
42std::pair<FloatArrayF<6>, double>
43FluidDynamicMaterial :: computeDeviatoricStress3D(const FloatArrayF<6> &eps, double pressure, GaussPoint *gp, TimeStep *tStep) const
44{
45 double epsp_vol = -( eps[0] + eps[1] + eps[2] );
46 auto stress_dev = this->computeDeviatoricStress3D(eps, gp, tStep);
47 return {stress_dev, epsp_vol};
48}
49
50
51std::pair<FloatArrayF<3>, double>
52FluidDynamicMaterial :: computeDeviatoricStress2D(const FloatArrayF<3> &eps, double pressure, GaussPoint *gp, TimeStep *tStep) const
53{
54 //auto [stress, epsv] = this->computeDeviatoricStress3D(assemble<6>(eps, {0, 1, 5}), pressure, gp, tStep);
55 auto val = this->computeDeviatoricStress3D(assemble<6>(eps, {0, 1, 5}), pressure, gp, tStep);
56 auto stress3 = val.first;
57 auto epsv = val.second;
58 return {stress3[{0, 1, 5}], epsv};
59}
60
61
63FluidDynamicMaterial :: computeDeviatoricStress2D(const FloatArrayF<3> &eps, GaussPoint *gp, TimeStep *tStep) const
64{
65 auto stress3 = this->computeDeviatoricStress3D(assemble<6>(eps, {0, 1, 5}), gp, tStep);
66 return stress3[{0, 1, 5}];
67}
68
69
71FluidDynamicMaterial :: computeDeviatoricStressAxi(const FloatArrayF<4> &eps, GaussPoint *gp, TimeStep *tStep) const
72{
73 auto stress3 = this->computeDeviatoricStress3D(assemble<6>(eps, {0, 1, 2, 5}), gp, tStep);
74 return stress3[{0, 1, 2, 5}];
75}
76
77
79FluidDynamicMaterial :: computeTangent2D(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const
80{
81 auto dsdd3 = this->computeTangent3D(mode, gp, tStep);
82 return dsdd3({0, 1, 5}, {0, 1, 5});
83}
84
85
87FluidDynamicMaterial :: computeTangentAxi(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const
88{
89 auto dsdd3 = this->computeTangent3D(mode, gp, tStep);
90 return dsdd3({0, 1, 2, 5}, {0, 1, 2, 5});
91}
92
93
95FluidDynamicMaterial :: computeTangents3D(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const
96{
97 return {
98 this->computeTangent3D(mode, gp, tStep),
99 zeros<6>(),
100 zeros<6>(),
101 0.
102 };
103}
104
105
107FluidDynamicMaterial :: computeTangents2D(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const
108{
109 Tangents<6> t = this->computeTangents3D(mode, gp, tStep);
110
111 FloatMatrixF<3,3> dsdd = t.dsdd({0, 1, 5}, {0, 1, 5});
112 FloatArrayF<3> dsdp = t.dsdp[{0, 1, 5}];
113 FloatArrayF<3> dedd = t.dedd[{0, 1, 5}];
114 return {dsdd, dsdp, dedd, t.dedp};
115}
116
117
118FluidDynamicMaterialStatus :: FluidDynamicMaterialStatus(GaussPoint *g) :
120{ }
121
122void
123FluidDynamicMaterialStatus :: printOutputAt(FILE *file, TimeStep *tStep) const
124{
125 fprintf(file, "\n deviatoric stresses");
126 for ( double e: deviatoricStressVector ) {
127 fprintf(file, " %.4e", e );
128 }
129
130 fprintf(file, "\n");
131}
132
133int
134FluidDynamicMaterial :: giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
135{
136 auto status = static_cast< FluidDynamicMaterialStatus * >( this->giveStatus(gp) );
137 if ( type == IST_DeviatoricStress ) {
138 answer = status->giveDeviatoricStressVector();
139 return 1;
140 } else if ( type == IST_DeviatoricStrain ) {
141 answer = status->giveDeviatoricStrainRateVector();
142 return 1;
143 } else if ( type == IST_Viscosity ) {
144 answer.resize(1);
145 answer.at(1) = this->giveEffectiveViscosity(gp, tStep);
146 return 1;
147 } else if ( type == IST_Density ) {
148 answer.resize(1);
149 answer.at(1) = this->give('d', gp);
150 return 1;
151 } else {
152 return Material :: giveIPValue(answer, gp, type, tStep);
153 }
154}
155
156
157void
158FluidDynamicMaterialStatus :: saveContext(DataStream &stream, ContextMode mode)
159{
160 MaterialStatus :: saveContext(stream, mode);
161
163 if ( ( iores = deviatoricStressVector.storeYourself(stream) ) != CIO_OK ) {
164 THROW_CIOERR(iores);
165 }
166
167 if ( ( iores = deviatoricStrainRateVector.storeYourself(stream) ) != CIO_OK ) {
168 THROW_CIOERR(iores);
169 }
170}
171
172
173void
174FluidDynamicMaterialStatus :: restoreContext(DataStream &stream, ContextMode mode)
175{
176 MaterialStatus :: restoreContext(stream, mode);
177
179 if ( ( iores = deviatoricStressVector.restoreYourself(stream) ) != CIO_OK ) {
180 THROW_CIOERR(iores);
181 }
182
183 if ( ( iores = deviatoricStrainRateVector.restoreYourself(stream) ) != CIO_OK ) {
184 THROW_CIOERR(iores);
185 }
186}
187} // end namespace oofem
void resize(Index s)
Definition floatarray.C:94
double & at(Index i)
Definition floatarray.h:202
FloatArrayF< 6 > deviatoricStrainRateVector
Strain vector in reduced form.
FloatArrayF< 6 > deviatoricStressVector
Stress vector in reduced form.
virtual Tangents< 6 > computeTangents3D(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const
virtual FloatMatrixF< 6, 6 > computeTangent3D(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const =0
virtual double giveEffectiveViscosity(GaussPoint *gp, TimeStep *tStep) const =0
virtual std::pair< FloatArrayF< 6 >, double > computeDeviatoricStress3D(const FloatArrayF< 6 > &eps, double pressure, GaussPoint *gp, TimeStep *tStep) const
MaterialStatus(GaussPoint *g)
Definition matstatus.h:91
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
Definition material.C:206
virtual double give(int aProperty, GaussPoint *gp) const
Definition material.C:51
#define THROW_CIOERR(e)
long ContextMode
Definition contextmode.h:43
FloatArrayF< N > assemble(const FloatArrayF< M > &x, int const (&c)[M])
Assemble components into zero matrix.
FloatArrayF< N > zeros()
For more readable code.

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