libMesh
examples
fem_system
fem_system_ex3
elasticity_system.h
Go to the documentation of this file.
1
// The libMesh Finite Element Library.
2
// Copyright (C) 2002-2019 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3
4
// This library is free software; you can redistribute it and/or
5
// modify it under the terms of the GNU Lesser General Public
6
// License as published by the Free Software Foundation; either
7
// version 2.1 of the License, or (at your option) any later version.
8
9
// This library is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
// Lesser General Public License for more details.
13
14
// You should have received a copy of the GNU Lesser General Public
15
// License along with this library; if not, write to the Free Software
16
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18
// DiffSystem framework files
19
#include "libmesh/fem_system.h"
20
21
// boundary IDs
22
#define BOUNDARY_ID_MIN_Z 0
23
#define BOUNDARY_ID_MIN_Y 1
24
#define BOUNDARY_ID_MAX_X 2
25
#define BOUNDARY_ID_MAX_Y 3
26
#define BOUNDARY_ID_MIN_X 4
27
#define BOUNDARY_ID_MAX_Z 5
28
#define NODE_BOUNDARY_ID 10
29
#define EDGE_BOUNDARY_ID 20
30
31
using namespace
libMesh
;
32
33
// The Navier-Stokes system class.
34
// FEMSystem, TimeSolver and NewtonSolver will handle most tasks,
35
// but we must specify element residuals
36
class
ElasticitySystem
:
public
FEMSystem
37
{
38
public
:
39
// Constructor
40
ElasticitySystem
(
EquationSystems
& es,
41
const
std::string & name_in,
42
const
unsigned
int
number_in)
43
:
FEMSystem
(es, name_in, number_in),
44
_rho(1.0)
45
{}
46
47
#if LIBMESH_DIM > 2
48
// System initialization
49
virtual
void
init_data ();
50
51
// Context initialization
52
virtual
void
init_context(
DiffContext
& context);
53
54
// Element residual and jacobian calculations
55
// Time dependent parts
56
virtual
bool
element_time_derivative (
bool
request_jacobian,
57
DiffContext
& context);
58
59
virtual
bool
side_time_derivative (
bool
request_jacobian,
60
DiffContext
& context);
61
62
// Mass matrix part
63
virtual
bool
mass_residual (
bool
request_jacobian,
64
DiffContext
& context);
65
#endif // LIBMESH_DIM > 2
66
67
private
:
68
69
// Indices for each variable;
70
unsigned
int
_u_var, _v_var,
_w_var
;
71
72
Real
_rho
;
73
74
Real
kronecker_delta
(
unsigned
int
i,
unsigned
int
j)
75
{
76
return
i == j ? 1. : 0.;
77
}
78
79
Real
elasticity_tensor
(
unsigned
int
i,
unsigned
int
j,
unsigned
int
k,
unsigned
int
l);
80
};
elasticity_tensor
Real elasticity_tensor(unsigned int i, unsigned int j, unsigned int k, unsigned int l)
Definition:
assembly.C:40
ElasticitySystem::_rho
Real _rho
Definition:
elasticity_system.h:72
ElasticitySystem
Definition:
elasticity_system.h:36
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition:
factoryfunction.C:55
libMesh::FEMSystem
This class provides a specific system class.
Definition:
fem_system.h:53
ElasticitySystem::_w_var
unsigned int _w_var
Definition:
elasticity_system.h:70
libMesh::DiffContext
This class provides all data required for a physics package (e.g.
Definition:
diff_context.h:55
libMesh::EquationSystems
This is the EquationSystems class.
Definition:
equation_systems.h:74
ElasticitySystem::kronecker_delta
Real kronecker_delta(unsigned int i, unsigned int j)
Definition:
elasticity_system.h:74
ElasticitySystem::ElasticitySystem
ElasticitySystem(EquationSystems &es, const std::string &name_in, const unsigned int number_in)
Definition:
elasticity_system.h:40
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition:
libmesh_common.h:121
Generated on Sat Jan 25 2020 12:06:50 for libMesh by
1.8.16