| 1 |
// ------------------------------------------------------------------------ |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 |
// Copyright (C) 2021 - 2023 by the deal.II authors |
| 5 |
// |
| 6 |
// This file is part of the deal.II library. |
| 7 |
// |
| 8 |
// Part of the source code is dual licensed under Apache-2.0 WITH |
| 9 |
// LLVM-exception OR LGPL-2.1-or-later. Detailed license information |
| 10 |
// governing the source code and code contributions can be found in |
| 11 |
// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II. |
| 12 |
// |
| 13 |
// ------------------------------------------------------------------------ |
| 14 |
|
| 15 |
|
| 16 |
#ifndef dealii_non_matching_fe_immersed_values_h |
| 17 |
#define dealii_non_matching_fe_immersed_values_h |
| 18 |
|
| 19 |
#include <deal.II/base/config.h> |
| 20 |
|
| 21 |
#include <deal.II/dofs/dof_accessor.h> |
| 22 |
|
| 23 |
#include <deal.II/fe/fe.h> |
| 24 |
#include <deal.II/fe/fe_update_flags.h> |
| 25 |
#include <deal.II/fe/fe_values.h> |
| 26 |
#include <deal.II/fe/mapping.h> |
| 27 |
|
| 28 |
#include <deal.II/grid/tria_iterator.h> |
| 29 |
|
| 30 |
#include <deal.II/non_matching/immersed_surface_quadrature.h> |
| 31 |
|
| 32 |
DEAL_II_NAMESPACE_OPEN |
| 33 |
namespace NonMatching |
| 34 |
{ |
| 35 |
/** |
| 36 |
* Finite element evaluated in the quadrature points of an |
| 37 |
* ImmersedSurfaceQuadrature of a cell. |
| 38 |
* |
| 39 |
* The shape functions values and their derivatives are the same as for an |
| 40 |
* FEValues-object, but the JxW-values are computed with the transformation |
| 41 |
* described in the documentation of ImmersedSurfaceQuadrature. Further, the |
| 42 |
* normal_vector-function returns the normal to the immersed surface. |
| 43 |
* |
| 44 |
* The reinit-function of this class exist mostly to be consistent with the |
| 45 |
* other FEValues-like classes. The immersed quadrature rule will typically |
| 46 |
* vary between each cell of the triangulation. Thus, an |
| 47 |
* FEImmersedSurfaceValues object can, typically, not be reused for different |
| 48 |
* cells. |
| 49 |
* |
| 50 |
* See also documentation in FEValuesBase. |
| 51 |
* |
| 52 |
* @ingroup feaccess |
| 53 |
*/ |
| 54 |
template <int dim> |
| 55 |
class FEImmersedSurfaceValues : public FEValuesBase<dim, dim> |
| 56 |
{ |
| 57 |
public: |
| 58 |
/** |
| 59 |
* Constructor. Gets cell-independent data from mapping and finite element |
| 60 |
* objects, matching the quadrature rule and update flags. |
| 61 |
* |
| 62 |
* @note Currently this class is only implemented for MappingCartesian, |
| 63 |
* MappingQ and MappingFEField. |
| 64 |
*/ |
| 65 |
FEImmersedSurfaceValues(const Mapping<dim> &mapping, |
| 66 |
const FiniteElement<dim> &element, |
| 67 |
const ImmersedSurfaceQuadrature<dim> &quadrature, |
| 68 |
const UpdateFlags update_flags); |
| 69 |
|
| 70 |
/** |
| 71 |
* Reinitialize quantities (normals, JxW-values, etc) for the given cell of |
| 72 |
* type "iterator into a Triangulation object". |
| 73 |
*/ |
| 74 |
void |
| 75 |
reinit(const typename Triangulation<dim>::cell_iterator &cell); |
| 76 |
|
| 77 |
/** |
| 78 |
* Reinitialize quantities (shape function values, gradients, etc) for the |
| 79 |
* given cell of type "iterator into a DoFHandler object", and the finite |
| 80 |
* element associated with this object. |
| 81 |
*/ |
| 82 |
template <bool level_dof_access> |
| 83 |
void |
| 84 |
reinit( |
| 85 |
const TriaIterator<DoFCellAccessor<dim, dim, level_dof_access>> &cell); |
| 86 |
|
| 87 |
/** |
| 88 |
* Returns the surface gradient of the shape function with index |
| 89 |
* @p function_no at the quadrature point with index @p quadrature_point. |
| 90 |
* |
| 91 |
* The surface gradient is defined as the projection of the gradient to the |
| 92 |
* tangent plane of the surface: |
| 93 |
* $ \nabla u - (n \cdot \nabla u) n $, |
| 94 |
* where $n$ is the unit normal to the surface. |
| 95 |
* |
| 96 |
* @dealiiRequiresUpdateFlags{update_gradients | update_normal_vectors} |
| 97 |
*/ |
| 98 |
Tensor<1, dim> |
| 99 |
shape_surface_grad(const unsigned int function_no, |
| 100 |
const unsigned int quadrature_point) const; |
| 101 |
|
| 102 |
/** |
| 103 |
* Return one vector component of the surface gradient of the shape function |
| 104 |
* at a quadrature point. See the definition of the surface gradient in the |
| 105 |
* shape_surface_grad function. |
| 106 |
* |
| 107 |
* @p function_no Index of the shape function to be evaluated. |
| 108 |
* |
| 109 |
* @p point_no Index of the quadrature point at which the function is to be |
| 110 |
* evaluated. |
| 111 |
* |
| 112 |
* @p component Vector component to be evaluated. |
| 113 |
* |
| 114 |
* @dealiiRequiresUpdateFlags{update_gradients | update_normal_vectors} |
| 115 |
*/ |
| 116 |
Tensor<1, dim> |
| 117 |
shape_surface_grad_component(const unsigned int function_no, |
| 118 |
const unsigned int quadrature_point, |
| 119 |
const unsigned int component) const; |
| 120 |
|
| 121 |
/** |
| 122 |
* Return a reference to the copy of the quadrature formula stored by this |
| 123 |
* object. |
| 124 |
*/ |
| 125 |
const NonMatching::ImmersedSurfaceQuadrature<dim> & |
| 126 |
get_quadrature() const; |
| 127 |
|
| 128 |
protected: |
| 129 |
/** |
| 130 |
* Do work common to the constructors. |
| 131 |
*/ |
| 132 |
void |
| 133 |
initialize(const UpdateFlags update_flags); |
| 134 |
|
| 135 |
/** |
| 136 |
* The reinit() functions do only that part of the work that requires |
| 137 |
* knowledge of the type of iterator. After setting present_cell(), they |
| 138 |
* pass on to this function, which does the real work, and which is |
| 139 |
* independent of the actual type of the cell iterator. |
| 140 |
*/ |
| 141 |
void |
| 142 |
do_reinit(); |
| 143 |
|
| 144 |
/** |
| 145 |
* Copy of the quadrature formula that was passed to the constructor. |
| 146 |
*/ |
| 147 |
const ImmersedSurfaceQuadrature<dim> quadrature; |
| 148 |
}; |
| 149 |
|
| 150 |
} // namespace NonMatching |
| 151 |
DEAL_II_NAMESPACE_CLOSE |
| 152 |
|
| 153 |
#endif /* dealii_non_matching_fe_immersed_values_h */ |