Skip to content

Commit

Permalink
Merge pull request #15304 from jh66637/change_function_names
Browse files Browse the repository at this point in the history
use FEPE::get_normal_vector() to be consistent with FEE
  • Loading branch information
kronbichler committed Jun 8, 2023
2 parents 44fb593 + 5902019 commit b617cbc
Show file tree
Hide file tree
Showing 25 changed files with 461 additions and 101 deletions.
2 changes: 1 addition & 1 deletion doc/doxygen/headers/matrixfree.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ digraph G
* information, respectively. Besides access to the function values with
* FEEvaluationAccess::get_value() or gradients with
* FEEvaluationAccess::get_gradient(), the face evaluator also enables the
* access to the normal vector by FEEvaluationAccess::get_normal_vector() and
* access to the normal vector by FEEvaluationAccess::normal_vector() and
* a specialized field FEEvaluationAccess::get_normal_derivative(), which
* returns the derivative of the solution field normal to the face. This
* quantity is computed as the gradient (in real space) multiplied by the
Expand Down
16 changes: 7 additions & 9 deletions examples/step-59/step-59.cc
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,9 @@ namespace Step59
// take the absolute value of these factors as the normal could point
// into either positive or negative direction.
const VectorizedArray<number> inverse_length_normal_to_face =
0.5 * (std::abs((phi_inner.get_normal_vector(0) *
0.5 * (std::abs((phi_inner.normal_vector(0) *
phi_inner.inverse_jacobian(0))[dim - 1]) +
std::abs((phi_outer.get_normal_vector(0) *
std::abs((phi_outer.normal_vector(0) *
phi_outer.inverse_jacobian(0))[dim - 1]));
const VectorizedArray<number> sigma =
inverse_length_normal_to_face * get_penalty_factor();
Expand Down Expand Up @@ -680,9 +680,8 @@ namespace Step59
EvaluationFlags::values |
EvaluationFlags::gradients);

const VectorizedArray<number> inverse_length_normal_to_face =
std::abs((phi_inner.get_normal_vector(0) *
phi_inner.inverse_jacobian(0))[dim - 1]);
const VectorizedArray<number> inverse_length_normal_to_face = std::abs((
phi_inner.normal_vector(0) * phi_inner.inverse_jacobian(0))[dim - 1]);
const VectorizedArray<number> sigma =
inverse_length_normal_to_face * get_penalty_factor();

Expand Down Expand Up @@ -1134,9 +1133,8 @@ namespace Step59
{
phi_face.reinit(face);

const VectorizedArray<double> inverse_length_normal_to_face =
std::abs((phi_face.get_normal_vector(0) *
phi_face.inverse_jacobian(0))[dim - 1]);
const VectorizedArray<double> inverse_length_normal_to_face = std::abs(
(phi_face.normal_vector(0) * phi_face.inverse_jacobian(0))[dim - 1]);
const VectorizedArray<double> sigma =
inverse_length_normal_to_face * system_matrix.get_penalty_factor();

Expand Down Expand Up @@ -1169,7 +1167,7 @@ namespace Step59
{
Tensor<1, dim> normal;
for (unsigned int d = 0; d < dim; ++d)
normal[d] = phi_face.get_normal_vector(q)[d][v];
normal[d] = phi_face.normal_vector(q)[d][v];
test_normal_derivative[v] =
-normal * exact_solution.gradient(single_point);
}
Expand Down
4 changes: 2 additions & 2 deletions examples/step-67/step-67.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ namespace Euler_DG
const auto numerical_flux =
euler_numerical_flux<dim>(phi_m.get_value(q),
phi_p.get_value(q),
phi_m.get_normal_vector(q));
phi_m.normal_vector(q));
phi_m.submit_value(-numerical_flux, q);
phi_p.submit_value(numerical_flux, q);
}
Expand Down Expand Up @@ -1205,7 +1205,7 @@ namespace Euler_DG
for (unsigned int q = 0; q < phi.n_q_points; ++q)
{
const auto w_m = phi.get_value(q);
const auto normal = phi.get_normal_vector(q);
const auto normal = phi.normal_vector(q);

auto rho_u_dot_n = w_m[1] * normal[0];
for (unsigned int d = 1; d < dim; ++d)
Expand Down
4 changes: 2 additions & 2 deletions examples/step-76/step-76.cc
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ namespace Euler_DG
const auto numerical_flux =
euler_numerical_flux<dim>(phi_m.get_value(q),
phi_p.get_value(q),
phi_m.get_normal_vector(q));
phi_m.normal_vector(q));
phi_m.submit_value(-numerical_flux, q);
}
}
Expand All @@ -825,7 +825,7 @@ namespace Euler_DG
for (unsigned int q = 0; q < phi_m.n_q_points; ++q)
{
const auto w_m = phi_m.get_value(q);
const auto normal = phi_m.get_normal_vector(q);
const auto normal = phi_m.normal_vector(q);

auto rho_u_dot_n = w_m[1] * normal[0];
for (unsigned int d = 1; d < dim; ++d)
Expand Down
4 changes: 2 additions & 2 deletions include/deal.II/matrix_free/face_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ namespace internal
/**
* Indices of the faces in the current face batch as compared to the
* numbers of the cells on the logical "interior" side of the face which
* is aligned to the direction of FEEvaluation::get_normal_vector().
* is aligned to the direction of FEEvaluation::normal_vector().
*/
std::array<unsigned int, vectorization_width> cells_interior;

/**
* Indices of the faces in the current face batch as compared to the
* numbers of the cells on the logical "exterior" side of the face which
* is aligned to the opposite direction of
* FEEvaluation::get_normal_vector(). Note that the distinction into
* FEEvaluation::normal_vector(). Note that the distinction into
* interior and exterior faces is purely logical and refers to the
* direction of the normal only. In the actual discretization of a
* problem, the discretization typically needs to make sure that interior
Expand Down
2 changes: 1 addition & 1 deletion include/deal.II/matrix_free/fe_evaluation.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ class FEEvaluationBase
* to the face: $\boldsymbol \nabla u(\mathbf x_q) \cdot \mathbf n(\mathbf
* x_q)$
*
* This call is equivalent to calling get_gradient() * get_normal_vector()
* This call is equivalent to calling get_gradient() * normal_vector()
* but will use a more efficient internal representation of data.
*
* @note The derived class FEEvaluationAccess overloads this operation
Expand Down
21 changes: 20 additions & 1 deletion include/deal.II/matrix_free/fe_evaluation_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ class FEEvaluationData
* @note Only implemented in case `is_face == true`.
*/
Tensor<1, dim, Number>
normal_vector(const unsigned int q_point) const;

/**
* Same as `normal_vector(const unsigned int q_point)`.
*
* @warning This function will be deprecated!
*/
Tensor<1, dim, Number>
get_normal_vector(const unsigned int q_point) const;

/** @} */
Expand Down Expand Up @@ -1260,7 +1268,7 @@ FEEvaluationData<dim, Number, is_face>::reinit_face(

template <int dim, typename Number, bool is_face>
inline DEAL_II_ALWAYS_INLINE Tensor<1, dim, Number>
FEEvaluationData<dim, Number, is_face>::get_normal_vector(
FEEvaluationData<dim, Number, is_face>::normal_vector(
const unsigned int q_point) const
{
AssertIndexRange(q_point, n_quadrature_points);
Expand All @@ -1275,6 +1283,17 @@ FEEvaluationData<dim, Number, is_face>::get_normal_vector(



// This function is deprecated.
template <int dim, typename Number, bool is_face>
inline DEAL_II_ALWAYS_INLINE Tensor<1, dim, Number>
FEEvaluationData<dim, Number, is_face>::get_normal_vector(
const unsigned int q_point) const
{
return normal_vector(q_point);
}



template <int dim, typename Number, bool is_face>
inline DEAL_II_ALWAYS_INLINE Number
FEEvaluationData<dim, Number, is_face>::JxW(const unsigned int q_point) const
Expand Down
4 changes: 2 additions & 2 deletions tests/matrix_free/advect_1d.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class MatrixFreeAdvectionBasic
value_type u_minus = phi_m.get_value(q),
u_plus = phi_p.get_value(q);
const VectorizedArray<number> normal_times_advection =
advection * phi_m.get_normal_vector(q);
advection * phi_m.normal_vector(q);
const value_type flux_times_normal =
make_vectorized_array<number>(0.5) *
((u_minus + u_plus) * normal_times_advection +
Expand Down Expand Up @@ -193,7 +193,7 @@ class MatrixFreeAdvectionBasic
value_type u_minus = fe_eval.get_value(q);
value_type u_plus = -u_minus;
const VectorizedArray<number> normal_times_advection =
advection * fe_eval.get_normal_vector(q);
advection * fe_eval.normal_vector(q);
const value_type flux_times_normal =
make_vectorized_array<number>(0.5) *
((u_minus + u_plus) * normal_times_advection +
Expand Down

0 comments on commit b617cbc

Please sign in to comment.