ExaDG
Loading...
Searching...
No Matches
curl_compute.h
1/* ______________________________________________________________________
2 *
3 * ExaDG - High-Order Discontinuous Galerkin for the Exa-Scale
4 *
5 * Copyright (C) 2021 by the ExaDG authors
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 * ______________________________________________________________________
20 */
21
22#ifndef EXADG_INCOMPRESSIBLE_NAVIER_STOKES_SPATIAL_DISCRETIZATION_CURL_COMPUTE_H_
23#define EXADG_INCOMPRESSIBLE_NAVIER_STOKES_SPATIAL_DISCRETIZATION_CURL_COMPUTE_H_
24
25// deal.II
26#include <deal.II/base/tensor.h>
27#include <deal.II/base/vectorization.h>
28
29namespace ExaDG
30{
31namespace IncNS
32{
33template<int dim, typename FEEval>
35{
36 static typename FEEval::value_type
37 compute(FEEval const & fe_eval, unsigned int const q_point)
38 {
39 return fe_eval.get_curl(q_point);
40 }
41};
42
43// use partial specialization of templates to handle the 2-dimensional case
44template<typename FEEval>
45struct CurlCompute<2, FEEval>
46{
47 static typename FEEval::value_type
48 compute(FEEval const & fe_eval, unsigned int const q_point)
49 {
50 /*
51 * fe_eval = / phi \ _____\ grad(fe_eval) = / d(phi)/dx1 d(phi)/dx2 \
52 * \ 0 / / \ 0 0 /
53 */
54 typename FEEval::gradient_type temp = fe_eval.get_gradient(q_point);
55 /*
56 * __ / 0 \ / d(phi)/dx2 \
57 * curl = \/ X | 0 | = | - d(phi)/dx1 |
58 * \ phi / \ 0 /
59 */
60 typename FEEval::value_type curl;
61 curl[0] = temp[0][1]; // d(phi)/dx2
62 curl[1] = -temp[0][0]; // - d(phi)/dx1
63 return curl;
64 }
65};
66
67} // namespace IncNS
68} // namespace ExaDG
69
70#endif /* EXADG_INCOMPRESSIBLE_NAVIER_STOKES_SPATIAL_DISCRETIZATION_CURL_COMPUTE_H_ */
Definition driver.cpp:33
Definition curl_compute.h:35