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
Installation
Installation guide
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// Copyright (C) 2006-2024 Matthias Heil and Andrew Hazel
7
// LIC//
8
// LIC// This library is free software; you can redistribute it and/or
9
// LIC// modify it under the terms of the GNU Lesser General Public
10
// LIC// License as published by the Free Software Foundation; either
11
// LIC// version 2.1 of the License, or (at your option) any later version.
12
// LIC//
13
// LIC// This library is distributed in the hope that it will be useful,
14
// LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
// LIC// Lesser General Public License for more details.
17
// LIC//
18
// LIC// You should have received a copy of the GNU Lesser General Public
19
// LIC// License along with this library; if not, write to the Free Software
20
// LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21
// LIC// 02110-1301 USA.
22
// LIC//
23
// LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24
// LIC//
25
// LIC//====================================================================
26
#include "
supg_advection_diffusion_elements.h
"
27
28
29
namespace
oomph
30
{
31
//======================================================================
32
/// QSUPGAdvectionDiffusionElement<DIM,NNODE_1D> elements are
33
/// SUPG-stabilised Advection Diffusion elements with
34
/// NNODE_1D nodal points in each coordinate direction. Inherits
35
/// from QAdvectionDiffusionElement and overwrites their
36
/// test functions
37
///
38
//======================================================================
39
40
//======================================================================
41
/// Define the shape functions and test functions and derivatives
42
/// w.r.t. global coordinates and return Jacobian of mapping.
43
///
44
/// SUPG stabilisation: Petrov-Galerkin, i.e. test functions \f$ \ne \f$
45
/// shape functions
46
//======================================================================
47
template
<
unsigned
DIM,
unsigned
NNODE_1D>
48
double
QSUPGAdvectionDiffusionElement<DIM, NNODE_1D>::
49
dshape_and_dtest_eulerian_adv_diff
(
const
Vector<double>
&
s
,
50
Shape
& psi,
51
DShape
& dpsidx,
52
Shape
& test,
53
DShape
& dtestdx)
const
54
{
55
// Call the geometrical shape functions and derivatives
56
double
J =
QElement<DIM, NNODE_1D>::dshape_eulerian
(
s
, psi, dpsidx);
57
58
// Find out how many nodes there are
59
unsigned
n_node = this->nnode();
60
61
// Calculate Eulerian coordinates
62
Vector<double>
interpolated_x(DIM, 0.0);
63
64
// Loop over nodes
65
for
(
unsigned
l = 0; l < n_node; l++)
66
{
67
// Loop over directions
68
for
(
unsigned
j = 0; j < DIM; j++)
69
{
70
interpolated_x[j] += this->nodal_position(l, j) * psi[l];
71
}
72
}
73
74
// Get wind
75
Vector<double>
wind(DIM);
76
// Dummy ipt argument
77
unsigned
ipt = 0;
78
this->get_wind_adv_diff(ipt,
s
, interpolated_x, wind);
79
80
// Loop over the test functions and derivatives and set them equal to the
81
// shape functions + add stabilisation
82
for
(
unsigned
j = 0; j < n_node; j++)
83
{
84
test[j] = psi[j];
85
86
for
(
unsigned
i
= 0;
i
< DIM;
i
++)
87
{
88
dtestdx(j,
i
) = dpsidx(j,
i
);
89
test[j] += Tau_SUPG * wind[
i
] * dpsidx(j,
i
);
90
}
91
}
92
93
// Return the jacobian
94
return
J;
95
}
96
97
98
//======================================================================
99
/// Define the shape functions and test functions and derivatives
100
/// w.r.t. global coordinates and return Jacobian of mapping.
101
///
102
/// SUPG stabilisation: Petrov-Galerkin, i.e. test functions \f$ \ne \f$
103
/// shape functions
104
//======================================================================
105
template
<
unsigned
DIM,
unsigned
NNODE_1D>
106
double
QSUPGAdvectionDiffusionElement<DIM, NNODE_1D>::
107
dshape_and_dtest_eulerian_at_knot_adv_diff
(
const
unsigned
& ipt,
108
Shape
& psi,
109
DShape
& dpsidx,
110
Shape
& test,
111
DShape
& dtestdx)
const
112
{
113
// Call the geometrical shape functions and derivatives
114
double
J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
115
116
// Find out how many nodes there are
117
unsigned
n_node = this->nnode();
118
119
// Calculate Eulerian coordinates
120
Vector<double>
interpolated_x(DIM, 0.0);
121
122
// Loop over nodes
123
for
(
unsigned
l = 0; l < n_node; l++)
124
{
125
// Loop over directions
126
for
(
unsigned
j = 0; j < DIM; j++)
127
{
128
interpolated_x[j] += this->nodal_position(l, j) * psi(l);
129
}
130
}
131
132
// Find the dimension of the element
133
unsigned
Dim
= this->dim();
134
// Storage for the local coordinates of the integration point
135
Vector<double>
s
(
Dim
);
136
// Set the local coordinate
137
for
(
unsigned
i
= 0;
i
<
Dim
;
i
++)
138
{
139
s
[
i
] = this->integral_pt()->knot(ipt,
i
);
140
}
141
142
// Get wind
143
Vector<double>
wind(DIM);
144
this->get_wind_adv_diff(ipt,
s
, interpolated_x, wind);
145
146
// Loop over the test functions and derivatives and set them equal to the
147
// shape functions + add stabilisation
148
for
(
unsigned
j = 0; j < n_node; j++)
149
{
150
test(j) = psi(j);
151
for
(
unsigned
i
= 0;
i
< DIM;
i
++)
152
{
153
dtestdx(j,
i
) = dpsidx(j,
i
);
154
test(j) += Tau_SUPG * wind[
i
] * dpsidx(j,
i
);
155
}
156
}
157
158
159
// Return the jacobian
160
return
J;
161
}
162
163
164
// Force template instantiation.
165
template
class
QSUPGAdvectionDiffusionElement<2, 2>
;
166
template
class
QSUPGAdvectionDiffusionElement<2, 3>
;
167
template
class
QSUPGAdvectionDiffusionElement<2, 4>
;
168
169
170
template
class
QSUPGAdvectionDiffusionElement<3, 2>
;
171
template
class
QSUPGAdvectionDiffusionElement<3, 3>
;
172
template
class
QSUPGAdvectionDiffusionElement<3, 4>
;
173
174
175
// Force template instantiation.
176
template
class
RefineableQSUPGAdvectionDiffusionElement<2, 2>
;
177
template
class
RefineableQSUPGAdvectionDiffusionElement<2, 3>
;
178
template
class
RefineableQSUPGAdvectionDiffusionElement<2, 4>
;
179
180
181
template
class
RefineableQSUPGAdvectionDiffusionElement<3, 2>
;
182
template
class
RefineableQSUPGAdvectionDiffusionElement<3, 3>
;
183
template
class
RefineableQSUPGAdvectionDiffusionElement<3, 4>
;
184
185
186
}
// namespace oomph
s
static char t char * s
Definition:
cfortran.h:568
i
cstr elem_len * i
Definition:
cfortran.h:603
oomph::DShape
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
Definition:
shape.h:278
oomph::QElement
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
Definition:
Qelements.h:459
oomph::QSUPGAdvectionDiffusionElement
QSUPGAdvectionDiffusionElement<DIM,NNODE_1D> elements are SUPG-stabilised Advection Diffusion element...
Definition:
supg_advection_diffusion_elements.h:44
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:49
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:107
oomph::RefineableQSUPGAdvectionDiffusionElement
////////////////////////////////////////////////////////////////////// //////////////////////////////...
Definition:
supg_advection_diffusion_elements.h:269
oomph::Shape
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
Definition:
shape.h:76
oomph::Vector< double >
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:60
oomph
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
Definition:
advection_diffusion_elements.cc:30
supg_advection_diffusion_elements.h