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 INCLUDE_EXADG_INCOMPRESSIBLE_NAVIER_STOKES_SPATIAL_DISCRETIZATION_CURL_COMPUTE_H_
23#define INCLUDE_EXADG_INCOMPRESSIBLE_NAVIER_STOKES_SPATIAL_DISCRETIZATION_CURL_COMPUTE_H_
24
25#include <deal.II/base/tensor.h>
26#include <deal.II/base/vectorization.h>
27
28namespace ExaDG
29{
30namespace IncNS
31{
32template<int dim, typename FEEval>
34{
35 static dealii::Tensor<1, dim, dealii::VectorizedArray<typename FEEval::number_type>>
36 compute(FEEval & fe_eval, unsigned int const q_point)
37 {
38 return fe_eval.get_curl(q_point);
39 }
40};
41
42// use partial specialization of templates to handle the 2-dimensional case
43template<typename FEEval>
44struct CurlCompute<2, FEEval>
45{
46 static dealii::Tensor<1, 2, dealii::VectorizedArray<typename FEEval::number_type>>
47 compute(FEEval & fe_eval, unsigned int const q_point)
48 {
49 dealii::Tensor<1, 2, dealii::VectorizedArray<typename FEEval::number_type>> curl;
50 /*
51 * fe_eval = / phi \ _____\ grad(fe_eval) = / d(phi)/dx1 d(phi)/dx2 \
52 * \ 0 / / \ 0 0 /
53 */
54 dealii::Tensor<2, 2, dealii::VectorizedArray<typename FEEval::number_type>> temp =
55 fe_eval.get_gradient(q_point);
56 /*
57 * __ / 0 \ / d(phi)/dx2 \
58 * curl = \/ X | 0 | = | - d(phi)/dx1 |
59 * \ phi / \ 0 /
60 */
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
71#endif /* INCLUDE_EXADG_INCOMPRESSIBLE_NAVIER_STOKES_SPATIAL_DISCRETIZATION_CURL_COMPUTE_H_ */
Definition driver.cpp:33
Definition curl_compute.h:34