22#ifndef EXADG_CONVECTION_DIFFUSION_SPATIAL_DISCRETIZATION_OPERATORS_WEAK_BOUNDARY_CONDITIONS_H_
23#define EXADG_CONVECTION_DIFFUSION_SPATIAL_DISCRETIZATION_OPERATORS_WEAK_BOUNDARY_CONDITIONS_H_
26#include <exadg/convection_diffusion/user_interface/boundary_descriptor.h>
27#include <exadg/functions_and_boundary_conditions/evaluate_functions.h>
28#include <exadg/matrix_free/integrators.h>
29#include <exadg/operators/operator_type.h>
50template<
int dim,
typename Number>
51inline DEAL_II_ALWAYS_INLINE
52 dealii::VectorizedArray<Number>
53 calculate_interior_value(
unsigned int const q,
54 FaceIntegrator<dim, 1, Number>
const & integrator,
55 OperatorType
const & operator_type)
57 dealii::VectorizedArray<Number> value_m = dealii::make_vectorized_array<Number>(0.0);
59 if(operator_type == OperatorType::full or operator_type == OperatorType::homogeneous)
61 value_m = integrator.get_value(q);
63 else if(operator_type == OperatorType::inhomogeneous)
69 AssertThrow(
false, dealii::ExcMessage(
"Specified OperatorType is not implemented!"));
75template<
int dim,
typename Number>
76inline DEAL_II_ALWAYS_INLINE
77 dealii::VectorizedArray<Number>
78 calculate_exterior_value(dealii::VectorizedArray<Number>
const & value_m,
80 FaceIntegrator<dim, 1, Number>
const & integrator,
81 OperatorType
const & operator_type,
82 BoundaryType
const & boundary_type,
83 dealii::types::boundary_id
const boundary_id,
87 dealii::VectorizedArray<Number> value_p = dealii::make_vectorized_array<Number>(0.0);
89 if(boundary_type == BoundaryType::Dirichlet)
91 if(operator_type == OperatorType::full or operator_type == OperatorType::inhomogeneous)
93 dealii::VectorizedArray<Number> g;
95 auto bc = boundary_descriptor->dirichlet_bc.find(boundary_id)->second;
96 auto q_points = integrator.quadrature_point(q);
98 g = FunctionEvaluator<0, dim, Number>::value(*bc, q_points, time);
100 value_p = -value_m + 2.0 * g;
102 else if(operator_type == OperatorType::homogeneous)
108 AssertThrow(
false, dealii::ExcMessage(
"Specified OperatorType is not implemented!"));
111 else if(boundary_type == BoundaryType::Neumann)
117 AssertThrow(
false, dealii::ExcMessage(
"Boundary type of face is invalid or not implemented."));
150template<
int dim,
typename Number>
151inline DEAL_II_ALWAYS_INLINE
152 dealii::VectorizedArray<Number>
153 calculate_interior_normal_gradient(
unsigned int const q,
154 FaceIntegrator<dim, 1, Number>
const & integrator,
155 OperatorType
const & operator_type)
157 dealii::VectorizedArray<Number> normal_gradient_m = dealii::make_vectorized_array<Number>(0.0);
159 if(operator_type == OperatorType::full or operator_type == OperatorType::homogeneous)
161 normal_gradient_m = integrator.get_normal_derivative(q);
163 else if(operator_type == OperatorType::inhomogeneous)
169 AssertThrow(
false, dealii::ExcMessage(
"Specified OperatorType is not implemented!"));
172 return normal_gradient_m;
175template<
int dim,
typename Number>
176inline DEAL_II_ALWAYS_INLINE
177 dealii::VectorizedArray<Number>
178 calculate_exterior_normal_gradient(
179 dealii::VectorizedArray<Number>
const & normal_gradient_m,
180 unsigned int const q,
181 FaceIntegrator<dim, 1, Number>
const & integrator,
182 OperatorType
const & operator_type,
183 BoundaryType
const & boundary_type,
184 dealii::types::boundary_id
const boundary_id,
188 dealii::VectorizedArray<Number> normal_gradient_p = dealii::make_vectorized_array<Number>(0.0);
190 if(boundary_type == BoundaryType::Dirichlet)
192 normal_gradient_p = normal_gradient_m;
194 else if(boundary_type == BoundaryType::Neumann)
196 if(operator_type == OperatorType::full or operator_type == OperatorType::inhomogeneous)
198 auto bc = boundary_descriptor->neumann_bc.find(boundary_id)->second;
199 auto q_points = integrator.quadrature_point(q);
201 auto h = FunctionEvaluator<0, dim, Number>::value(*bc, q_points, time);
203 normal_gradient_p = -normal_gradient_m + 2.0 * h;
205 else if(operator_type == OperatorType::homogeneous)
207 normal_gradient_p = -normal_gradient_m;
211 AssertThrow(
false, dealii::ExcMessage(
"Specified OperatorType is not implemented!"));
216 AssertThrow(
false, dealii::ExcMessage(
"Boundary type of face is invalid or not implemented."));
219 return normal_gradient_p;
Definition boundary_descriptor.h:46