Toggle navigation
Documentation
Big picture
The finite element method
The data structure
Not-so-quick guide
Optimisation
Order of action functions
Example codes and tutorials
List of example codes and tutorials
Meshing
Solvers
MPI parallel processing
Post-processing/visualisation
Other
Change log
Creating documentation
Coding conventions
Index
FAQ
Get it
Installation guide
Get code from subversion repository
Get code as tar file
Copyright
About
People
Contact/Get involved
Publications
Acknowledgements
Picture show
Go
src
advection_diffusion
supg_advection_diffusion_elements.cc
Go to the documentation of this file.
1
//LIC// ====================================================================
2
//LIC// This file forms part of oomph-lib, the object-oriented,
3
//LIC// multi-physics finite-element library, available
4
//LIC// at http://www.oomph-lib.org.
5
//LIC//
6
//LIC// Version 1.0; svn revision $LastChangedRevision$
7
//LIC//
8
//LIC// $LastChangedDate$
9
//LIC//
10
//LIC// Copyright (C) 2006-2016 Matthias Heil and Andrew Hazel
11
//LIC//
12
//LIC// This library is free software; you can redistribute it and/or
13
//LIC// modify it under the terms of the GNU Lesser General Public
14
//LIC// License as published by the Free Software Foundation; either
15
//LIC// version 2.1 of the License, or (at your option) any later version.
16
//LIC//
17
//LIC// This library is distributed in the hope that it will be useful,
18
//LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
19
//LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
//LIC// Lesser General Public License for more details.
21
//LIC//
22
//LIC// You should have received a copy of the GNU Lesser General Public
23
//LIC// License along with this library; if not, write to the Free Software
24
//LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25
//LIC// 02110-1301 USA.
26
//LIC//
27
//LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
28
//LIC//
29
//LIC//====================================================================
30
#include "
supg_advection_diffusion_elements.h
"
31
32
33
namespace
oomph
34
{
35
36
//======================================================================
37
/// \short QSUPGAdvectionDiffusionElement<DIM,NNODE_1D> elements are
38
/// SUPG-stabilised Advection Diffusion elements with
39
/// NNODE_1D nodal points in each coordinate direction. Inherits
40
/// from QAdvectionDiffusionElement and overwrites their
41
/// test functions
42
///
43
//======================================================================
44
45
//======================================================================
46
/// \short Define the shape functions and test functions and derivatives
47
/// w.r.t. global coordinates and return Jacobian of mapping.
48
///
49
/// SUPG stabilisation: Petrov-Galerkin, i.e. test functions \f$ \ne \f$
50
/// shape functions
51
//======================================================================
52
template
<
unsigned
DIM,
unsigned
NNODE_1D>
53
double
QSUPGAdvectionDiffusionElement<DIM,NNODE_1D>::
54
dshape_and_dtest_eulerian_adv_diff
(
const
Vector<double>
&
s
,
55
Shape
&psi,
56
DShape
&dpsidx,
57
Shape
&test,
58
DShape
&dtestdx)
const
59
{
60
61
//Call the geometrical shape functions and derivatives
62
double
J =
QElement<DIM,NNODE_1D>::dshape_eulerian
(s,psi,dpsidx);
63
64
//Find out how many nodes there are
65
unsigned
n_node = this->nnode();
66
67
//Calculate Eulerian coordinates
68
Vector<double>
interpolated_x(DIM,0.0);
69
70
// Loop over nodes
71
for
(
unsigned
l=0;l<n_node;l++)
72
{
73
// Loop over directions
74
for
(
unsigned
j=0;j<DIM;j++)
75
{
76
interpolated_x[j]+=this->nodal_position(l,j)*psi[l];
77
}
78
}
79
80
//Get wind
81
Vector<double>
wind(DIM);
82
//Dummy ipt argument
83
unsigned
ipt=0;
84
this->get_wind_adv_diff(ipt,s,interpolated_x,wind);
85
86
//Loop over the test functions and derivatives and set them equal to the
87
//shape functions + add stabilisation
88
for
(
unsigned
j=0;j<n_node;j++)
89
{
90
test[j] = psi[j];
91
92
for
(
unsigned
i
=0;
i
<DIM;
i
++)
93
{
94
dtestdx(j,
i
) = dpsidx(j,
i
);
95
test[j]+=Tau_SUPG*wind[
i
]*dpsidx(j,
i
);
96
}
97
}
98
99
//Return the jacobian
100
return
J;
101
}
102
103
104
//======================================================================
105
/// \short Define the shape functions and test functions and derivatives
106
/// w.r.t. global coordinates and return Jacobian of mapping.
107
///
108
/// SUPG stabilisation: Petrov-Galerkin, i.e. test functions \f$ \ne \f$
109
/// shape functions
110
//======================================================================
111
template
<
unsigned
DIM,
unsigned
NNODE_1D>
112
double
QSUPGAdvectionDiffusionElement<DIM,NNODE_1D>::
113
dshape_and_dtest_eulerian_at_knot_adv_diff
(
114
const
unsigned
&ipt,
115
Shape
&psi,
116
DShape
&dpsidx,
117
Shape
&test,
118
DShape
&dtestdx)
const
119
{
120
//Call the geometrical shape functions and derivatives
121
double
J = this->dshape_eulerian_at_knot(ipt,psi,dpsidx);
122
123
//Find out how many nodes there are
124
unsigned
n_node = this->nnode();
125
126
//Calculate Eulerian coordinates
127
Vector<double>
interpolated_x(DIM,0.0);
128
129
// Loop over nodes
130
for
(
unsigned
l=0;l<n_node;l++)
131
{
132
// Loop over directions
133
for
(
unsigned
j=0;j<DIM;j++)
134
{
135
interpolated_x[j]+=this->nodal_position(l,j)*psi(l);
136
}
137
}
138
139
//Find the dimension of the element
140
unsigned
Dim
= this->dim();
141
//Storage for the local coordinates of the integration point
142
Vector<double>
s
(Dim);
143
//Set the local coordinate
144
for
(
unsigned
i
=0;
i
<
Dim
;
i
++) {s[
i
] = this->integral_pt()->knot(ipt,
i
);}
145
146
//Get wind
147
Vector<double>
wind(DIM);
148
this->get_wind_adv_diff(ipt,s,interpolated_x,wind);
149
150
//Loop over the test functions and derivatives and set them equal to the
151
//shape functions + add stabilisation
152
for
(
unsigned
j=0;j<n_node;j++)
153
{
154
test(j) = psi(j);
155
for
(
unsigned
i
=0;
i
<DIM;
i
++)
156
{
157
dtestdx(j,
i
) = dpsidx(j,
i
);
158
test(j) += Tau_SUPG*wind[
i
]*dpsidx(j,
i
);
159
}
160
}
161
162
163
//Return the jacobian
164
return
J;
165
}
166
167
168
169
// Force template instantiation.
170
template
class
QSUPGAdvectionDiffusionElement<2,2>
;
171
template
class
QSUPGAdvectionDiffusionElement<2,3>
;
172
template
class
QSUPGAdvectionDiffusionElement<2,4>
;
173
174
175
template
class
QSUPGAdvectionDiffusionElement<3,2>
;
176
template
class
QSUPGAdvectionDiffusionElement<3,3>
;
177
template
class
QSUPGAdvectionDiffusionElement<3,4>
;
178
179
180
181
// Force template instantiation.
182
template
class
RefineableQSUPGAdvectionDiffusionElement<2,2>
;
183
template
class
RefineableQSUPGAdvectionDiffusionElement<2,3>
;
184
template
class
RefineableQSUPGAdvectionDiffusionElement<2,4>
;
185
186
187
template
class
RefineableQSUPGAdvectionDiffusionElement<3,2>
;
188
template
class
RefineableQSUPGAdvectionDiffusionElement<3,3>
;
189
template
class
RefineableQSUPGAdvectionDiffusionElement<3,4>
;
190
191
192
}
oomph::RefineableQSUPGAdvectionDiffusionElement
Refineable version of QSUPGAdvectionDiffusionElement. Inherit from the standard QSUPGAdvectionDiffusi...
Definition:
supg_advection_diffusion_elements.h:269
i
cstr elem_len * i
Definition:
cfortran.h:607
oomph::QSUPGAdvectionDiffusionElement::dshape_and_dtest_eulerian_at_knot_adv_diff
double dshape_and_dtest_eulerian_at_knot_adv_diff(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Shape, test functions & derivs. w.r.t. to global coords. Return Jacobian.
Definition:
supg_advection_diffusion_elements.cc:113
oomph::DShape
Definition:
shape.h:275
oomph::Multi_domain_functions::Dim
unsigned Dim
Dimension of zeta tuples (set by get_dim_helper) – needed because we store the scalar coordinates in...
Definition:
multi_domain.cc:66
oomph::QSUPGAdvectionDiffusionElement
QSUPGAdvectionDiffusionElement<DIM,NNODE_1D> elements are SUPG-stabilised Advection Diffusion element...
Definition:
supg_advection_diffusion_elements.h:47
oomph
Definition:
advection_diffusion_elements.cc:33
oomph::Vector< double >
oomph::Shape
Definition:
shape.h:81
s
static char t char * s
Definition:
cfortran.h:572
oomph::QSUPGAdvectionDiffusionElement::dshape_and_dtest_eulerian_adv_diff
double dshape_and_dtest_eulerian_adv_diff(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Shape, test functions & derivs. w.r.t. to global coords. Return Jacobian.
Definition:
supg_advection_diffusion_elements.cc:54
supg_advection_diffusion_elements.h
oomph::QElement
Definition:
Qelements.h:485