OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
nonlinearmassmat.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 - 2013 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 #include "nonlinearmassmat.h"
36 #include "floatmatrix.h"
37 #include "gausspoint.h"
38 #include "mathfem.h"
39 #include "classfactory.h"
40 
41 namespace oofem {
42 REGISTER_Material(NonlinearMassTransferMaterial);
43 
46 {
47  IRResultType result; // Required by IR_GIVE_FIELD macro
48 
51 
52  return Material :: initializeFrom(ir);
53 }
54 
55 void
57  MatResponseMode mode,
58  GaussPoint *gp,
59  TimeStep *tStep)
60 {
61  MaterialMode mMode = gp->giveMaterialMode();
62  TransportMaterialStatus *status = static_cast< TransportMaterialStatus * >( this->giveStatus(gp) );
63  const FloatArray &eps = status->giveTempGradient();
64  double gradPNorm;
65  FloatMatrix t1, t2;
66 
67  gradPNorm = eps.computeNorm();
68 
69  t1.beDyadicProductOf(eps, eps);
70  if ( gradPNorm != 0.0 ) {
71  t1.times( C * alpha * pow(gradPNorm, alpha - 2) );
72  }
73 
74  switch ( mMode ) {
75  case _1dHeat:
76  t2.resize(1, 1);
77  break;
78  case _2dHeat:
79  t2.resize(2, 2);
80  break;
81  case _3dHeat:
82  t2.resize(3, 3);
83  break;
84  default:
85  OOFEM_ERROR("unknown mode (%s)", __MaterialModeToString(mMode));
86  }
87  t2.beUnitMatrix();
88 
89  answer.clear();
90  answer.add(t1);
91  answer.add(1 + C * pow(gradPNorm, alpha), t2);
92 }
93 
94 double
96  GaussPoint *gp,
97  TimeStep *tStep)
98 {
99  return 0.;
100 }
101 
102 void
104 {
105  TransportMaterialStatus *ms = static_cast< TransportMaterialStatus * >( this->giveStatus(gp) );
106 
107  double gradPNorm = grad.computeNorm();
108  answer.beScaled(-( 1. + C * pow(gradPNorm, alpha) ), grad);
109 
110  ms->setTempGradient(grad);
111  ms->setTempField(field);
112  ms->setTempFlux(answer);
113 }
114 
115 int
117 {
118  TransportMaterialStatus *ms = static_cast< TransportMaterialStatus * >( this->giveStatus(gp) );
119 
120  switch ( type ) {
121  case IST_Velocity:
122  answer = ms->giveFlux();
123  break;
124  case IST_PressureGradient:
125  answer = ms->giveGradient();
126  break;
127  default:
128  return TransportMaterial :: giveIPValue(answer, gp, type, tStep);
129  }
130  return 1;
131 }
132 } // end namespace oofem
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in Reduced form.
virtual double giveCharacteristicValue(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)
Computes the characteristic value of receiver in given integration point, respecting its history...
InternalStateType
Type representing the physical meaning of element or constitutive model internal variable.
MaterialMode giveMaterialMode()
Returns corresponding material mode of receiver.
Definition: gausspoint.h:191
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
Returns material status of receiver in given integration point.
Definition: material.C:244
virtual void giveFluxVector(FloatArray &answer, GaussPoint *gp, const FloatArray &grad, const FloatArray &field, TimeStep *tStep)
Returns the flux for the field and its gradient.
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in Reduced form.
double C
Indicates the level of nonlinearity in the model.
#define _IFT_NonlinearMassTransferMaterial_c
This class implements a transport material status information.
MaterialMode
Type representing material mode of integration point.
Definition: materialmode.h:89
MatResponseMode
Describes the character of characteristic material matrix.
const FloatArray & giveTempGradient()
Return last gradient.
void beScaled(double s, const FloatArray &b)
Sets receiver to be .
Definition: floatarray.C:146
const char * __MaterialModeToString(MaterialMode _value)
Definition: cltypes.C:314
const FloatArray & giveFlux()
Returns last flux.
#define OOFEM_ERROR(...)
Definition: error.h:61
void times(double f)
Multiplies receiver by factor f.
Definition: floatmatrix.C:1594
void setTempField(FloatArray newField)
Set field.
void setTempGradient(FloatArray grad)
Set gradient.
Class representing vector of real numbers.
Definition: floatarray.h:82
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
#define _IFT_NonlinearMassTransferMaterial_alpha
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
void setTempFlux(FloatArray w)
Set flux.
double computeNorm() const
Computes the norm (or length) of the vector.
Definition: floatarray.C:840
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
Definition: floatmatrix.C:1358
Class representing the general Input Record.
Definition: inputrecord.h:101
void add(const FloatMatrix &a)
Adds matrix to the receiver.
Definition: floatmatrix.C:1023
void beDyadicProductOf(const FloatArray &vec1, const FloatArray &vec2)
Assigns to the receiver the dyadic product .
Definition: floatmatrix.C:492
void beUnitMatrix()
Sets receiver to unity matrix.
Definition: floatmatrix.C:1332
REGISTER_Material(DummyMaterial)
the oofem namespace is to define a context or scope in which all oofem names are defined.
void clear()
Sets size of receiver to be an empty matrix. It will have zero rows and zero columns size...
Definition: floatmatrix.h:516
#define IR_GIVE_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:69
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
Definition: material.C:89
double alpha
Indicates the level of nonlinearity in the model.
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80
const FloatArray & giveGradient()
Return last gradient.
virtual void giveCharacteristicMatrix(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep)
Computes characteristic matrix of receiver in given integration point.

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:30 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011