/home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/discretization/FV/assembler/reconstruction_cache.hh Source File#
|
DiFfRG
Discretization Framework for functional Renormalization Group flows
|
reconstruction_cache.hh
Go to the documentation of this file.
7#include <DiFfRG/discretization/FV/reconstructor/diffusion/corrected_weighted_least_squares_reconstructor.hh>
126 template <int dim, typename NumberType, size_t n_components> struct SolutionReconstructionCache {
144 std::array<NumberType, n_components> reconstruct_u(const std::array<NumberType, n_components> &u_center,
185 const CellStencilData<dim, NumberType, n_components> &plus_stencil, const dealii::Point<dim> &x_q)
213 result.x = {boundary_stencil.x[BoundaryIndex::lower_outer], boundary_stencil.x[BoundaryIndex::lower_inner],
216 result.u = {boundary_stencil.u[BoundaryIndex::lower_outer], boundary_stencil.u[BoundaryIndex::lower_inner],
222 boundary_stencil.x[BoundaryIndex::upper_inner], boundary_stencil.x[BoundaryIndex::upper_outer]};
262 template <def::HasReconstructor Reconstructor, int dim, typename NumberType, size_t n_components,
265 FaceReconstructionState<dim, NumberType, n_components> compute_interior_face_reconstruction_state(
267 const CellStencilData<dim, NumberType, n_components> &plus_stencil, const dealii::Point<dim> &x_q)
271 minus_stencil.cell.x, minus_stencil.cell.u, minus_stencil.neighbors.x, minus_stencil.neighbors.u);
275 minus_stencil.cell.x, x_q, minus_stencil.cell.u, minus_stencil.neighbors.x, minus_stencil.neighbors.u);
277 plus_stencil.cell.x, x_q, plus_stencil.cell.u, plus_stencil.neighbors.x, plus_stencil.neighbors.u);
278 state.u_minus = reconstruct_u(minus_stencil.cell.u, minus_stencil.cell.x, x_q, state.center_grad_minus);
279 state.u_plus = reconstruct_u(plus_stencil.cell.u, plus_stencil.cell.x, x_q, state.center_grad_plus);
299 template <def::HasReconstructor Reconstructor, int dim, typename NumberType, size_t n_components>
329 std::array<std::array<dealii::types::global_dof_index, n_components>, stencil_size> dof_indices{};
341 std::array<std::array<dealii::types::global_dof_index, n_components>, stencil_size> dof_indices{};
350 template <int dim, typename NumberType, size_t n_components> struct BoundaryReconstructionStencilData {
353 std::array<BoundaryStencilData<dim, NumberType, n_components>, n_faces> tangential_ghost_neighbors{};
363 std::array<BoundaryStencilTopologyData<dim, n_components>, n_faces> tangential_ghost_neighbors{};
372 const BoundaryStencilTopologyData<dim, n_components> &topology, const VectorType &solution_global)
424 make_boundary_side_stencil(const BoundaryStencilData<dim, NumberType, n_components> &boundary_stencil,
447 make_physical_boundary_side_stencil(const BoundaryStencilData<dim, NumberType, n_components> &boundary_stencil)
449 static_assert(dim == 1, "Paper-style physical boundary side stencils currently support only dim=1.");
451 return make_boundary_side_stencil<dim>(boundary_stencil, BoundaryStencilIndex<dim>::physical_cell,
458 make_ghost_boundary_side_stencil(const BoundaryStencilData<dim, NumberType, n_components> &boundary_stencil)
482 const size_t ghost_center = boundary_stencil.lower_boundary ? def::BoundaryStencilIndex::lower_inner :
484 const size_t ghost_outer = boundary_stencil.lower_boundary ? def::BoundaryStencilIndex::lower_outer :
504 void apply_boundary_reconstruction_stencil(BoundaryStencilData<dim, NumberType, n_components> &boundary_stencil,
508 prepare_boundary_reconstruction_stencil(boundary_stencil, cell_stencil, boundary_stencil.face_center);
510 model.apply_boundary_stencil(boundary_stencil.u, boundary_stencil.x, boundary_stencil.face_center);
517 const BoundaryReconstructionStencilData<2, NumberType, n_components> &boundary_reconstruction_stencil,
518 const unsigned int result_face, const CellStencilData<2, NumberType, n_components> &physical_stencil,
540 normal_stencil.x[physical_cell] = tangential_stencils[0].x[tangential_stencils[0].ghost_center];
610 const BoundaryReconstructionStencilData<2, NumberType, n_components> &boundary_reconstruction_stencil,
656 neighbor_stencil = make_composed_corner_boundary_stencil(boundary_reconstruction_stencil, result_face,
677 const bool boundary_supported = model.apply_boundary_stencil(boundary_stencil.u, boundary_stencil.x, x_q);
697 const bool boundary_supported = model.apply_boundary_stencil(boundary_stencil.u, boundary_stencil.x, x_q);
709 std::pair<CellStencilData<1, NumberType, n_components>, CellStencilData<1, NumberType, n_components>>
726 std::pair<CellStencilData<1, NumberType, n_components>, CellStencilData<1, NumberType, n_components>>
732 return make_model_boundary_reconstruction_side_stencils(boundary_reconstruction_stencil.primary,
737 std::pair<CellStencilData<2, NumberType, n_components>, CellStencilData<2, NumberType, n_components>>
754 std::pair<CellStencilData<2, NumberType, n_components>, CellStencilData<2, NumberType, n_components>>
761 apply_boundary_reconstruction_stencil(boundary_reconstruction_stencil.primary, physical_cell_stencil, model);
763 return {make_physical_boundary_side_stencil(boundary_reconstruction_stencil.primary, physical_cell_stencil),
764 make_ghost_boundary_side_stencil(boundary_reconstruction_stencil, physical_cell_stencil, model)};
767 template <def::HasReconstructor Reconstructor, typename Model, typename NumberType, size_t n_components>
768 FaceReconstructionState<1, NumberType, n_components> compute_boundary_face_reconstruction_state(
774 make_model_boundary_reconstruction_side_stencils(boundary_stencil, physical_cell_stencil, x_q, model);
775 return compute_interior_face_reconstruction_state<Reconstructor>(physical_stencil, ghost_stencil, x_q);
778 template <def::HasReconstructor Reconstructor, typename Model, typename NumberType, size_t n_components>
788 template <def::HasReconstructor Reconstructor, typename Model, typename NumberType, size_t n_components>
789 FaceReconstructionState<2, NumberType, n_components> compute_boundary_face_reconstruction_state(
795 make_model_boundary_reconstruction_side_stencils(boundary_stencil, physical_cell_stencil, x_q, model);
796 return compute_interior_face_reconstruction_state<Reconstructor>(physical_stencil, ghost_stencil, x_q);
799 template <def::HasReconstructor Reconstructor, typename Model, typename NumberType, size_t n_components>
800 FaceReconstructionState<2, NumberType, n_components> compute_boundary_face_reconstruction_state(
806 make_model_boundary_reconstruction_side_stencils(boundary_reconstruction_stencil, physical_cell_stencil,
808 return compute_interior_face_reconstruction_state<Reconstructor>(physical_stencil, ghost_stencil, x_q);
813 tag_cell_dofs(const CellData<dim, NumberType, n_components> &cell_data, dealii::types::global_dof_index dof_j)
859 tag_boundary_stencil_dofs(const BoundaryStencilData<dim, NumberType, n_components> &boundary_stencil,
884 const BoundaryReconstructionStencilData<dim, NumberType, n_components> &boundary_reconstruction_stencil,
889 tag_boundary_stencil_dofs<dim, NumberType, n_components>(boundary_reconstruction_stencil.primary, dof_j);
890 result.tangential_ghost_neighbor_valid = boundary_reconstruction_stencil.tangential_ghost_neighbor_valid;
891 result.corner_tangential_stencil_valid = boundary_reconstruction_stencil.corner_tangential_stencil_valid;
894 result.tangential_ghost_neighbors[face] = tag_boundary_stencil_dofs<dim, NumberType, n_components>(
Definition corrected_weighted_least_squares_reconstructor.hh:25
Concept that any gradient-reconstruction strategy must satisfy.
Definition abstract_reconstructor.hh:22
FaceReconstructionState< 1, NumberType, n_components > compute_boundary_face_reconstruction_state(BoundaryStencilData< 1, NumberType, n_components > boundary_stencil, const CellStencilData< 1, NumberType, n_components > &physical_cell_stencil, const dealii::Point< 1 > &x_q, const Model &model)
Definition reconstruction_cache.hh:768
def::GradientType< dim, NumberType, n_components > GradientType
Definition reconstruction_cache.hh:31
CellStencilData< dim, NumberType, n_components > make_ghost_boundary_side_stencil(const BoundaryStencilData< dim, NumberType, n_components > &boundary_stencil)
Definition reconstruction_cache.hh:458
BoundaryStencilData< dim, autodiff::Real< 1, NumberType >, n_components > tag_boundary_stencil_dofs(const BoundaryStencilData< dim, NumberType, n_components > &boundary_stencil, dealii::types::global_dof_index dof_j)
Definition reconstruction_cache.hh:859
std::pair< CellStencilData< 1, NumberType, n_components >, CellStencilData< 1, NumberType, n_components > > make_model_boundary_reconstruction_side_stencils(BoundaryStencilData< 1, NumberType, n_components > boundary_stencil, const CellStencilData< 1, NumberType, n_components > &physical_cell_stencil, const dealii::Point< 1 > &x_q, const Model &model)
Definition reconstruction_cache.hh:710
void sort_four_point_stencil(FourPointStencil< dim, NumberType, n_components > &stencil)
Definition reconstruction_cache.hh:164
CellData< dim, autodiff::Real< 1, NumberType >, n_components > tag_cell_dofs(const CellData< dim, NumberType, n_components > &cell_data, dealii::types::global_dof_index dof_j)
Definition reconstruction_cache.hh:813
bool is_lower_boundary_stencil(const std::array< dealii::Point< dim >, 2 *dim+3 > &x_stencil, const dealii::Point< dim > &x_face)
Definition reconstruction_cache.hh:317
std::array< ReconstructionDerivativeData< dim, NumberType, n_components >, 2 > extract_diffusion_face_derivatives(const DiffusionFaceState< dim, autodiff::Real< 1, NumberType >, n_components > &state)
Definition reconstruction_cache.hh:243
FaceReconstructionState< dim, NumberType, n_components > compute_interior_face_reconstruction_state(const CellStencilData< dim, NumberType, n_components > &minus_stencil, const CellStencilData< dim, NumberType, n_components > &plus_stencil, const dealii::Point< dim > &x_q)
Definition reconstruction_cache.hh:265
BoundaryReconstructionStencilData< dim, autodiff::Real< 1, NumberType >, n_components > tag_boundary_reconstruction_stencil_dofs(const BoundaryReconstructionStencilData< dim, NumberType, n_components > &boundary_reconstruction_stencil, dealii::types::global_dof_index dof_j)
Definition reconstruction_cache.hh:883
void apply_boundary_reconstruction_stencil(BoundaryStencilData< dim, NumberType, n_components > &boundary_stencil, const CellStencilData< dim, NumberType, n_components > &cell_stencil, const Model &model)
Definition reconstruction_cache.hh:504
BoundaryStencilData< dim, BoundaryNumberType, n_components > fill_boundary_stencil_from_topology(const BoundaryStencilTopologyData< dim, n_components > &topology, const VectorType &solution_global)
Definition reconstruction_cache.hh:371
CellStencilData< dim, autodiff::Real< 1, NumberType >, n_components > tag_cell_stencil_dofs(const CellStencilData< dim, NumberType, n_components > &cell_stencil, dealii::types::global_dof_index dof_j)
Definition reconstruction_cache.hh:846
CellStencilData< dim, NumberType, n_components > make_physical_boundary_side_stencil(const BoundaryStencilData< dim, NumberType, n_components > &boundary_stencil)
Definition reconstruction_cache.hh:447
FourPointStencil< dim, NumberType, n_components > make_boundary_third_derivative_stencil(const BoundaryStencilData< dim, NumberType, n_components > &boundary_stencil)
Definition reconstruction_cache.hh:205
void populate_boundary_neighbor_from_model_stencil(BoundaryStencilData< 1, NumberType, n_components > &boundary_stencil, CellStencilData< 1, NumberType, n_components > &cell_stencil, const unsigned int face_index, const dealii::Point< 1 > &x_q, const Model &model)
Definition reconstruction_cache.hh:672
def::ThirdDerivativeType< dim, NumberType, n_components > ThirdDerivativeType
Definition reconstruction_cache.hh:34
NeighborData< dim, autodiff::Real< 1, NumberType >, n_components > make_tagged_neighbors(const NeighborData< dim, NumberType, n_components > &neighbor_data, dealii::types::global_dof_index dof_j)
Definition reconstruction_cache.hh:828
FaceReconstructionState< dim, NumberType, n_components > reverse_face_reconstruction(const FaceReconstructionState< dim, NumberType, n_components > &state)
Definition reconstruction_cache.hh:74
FourPointStencil< dim, NumberType, n_components > make_interior_third_derivative_stencil(const CellStencilData< dim, NumberType, n_components > &minus_stencil, const CellStencilData< dim, NumberType, n_components > &plus_stencil, const dealii::Point< dim > &x_q)
Definition reconstruction_cache.hh:183
DiffusionFaceState< dim, NumberType, n_components > compute_diffusion_face_state(const CellStencilData< dim, NumberType, n_components > &minus_stencil, const CellStencilData< dim, NumberType, n_components > &plus_stencil)
Definition reconstruction_cache.hh:232
std::array< NumberType, n_components > reconstruct_u(const std::array< NumberType, n_components > &u_center, const dealii::Point< dim > ¢er, const dealii::Point< dim > &x, const GradientType< dim, NumberType, n_components > &u_grad)
Definition reconstruction_cache.hh:144
BoundaryStencilData< 2, NumberType, n_components > make_composed_corner_boundary_stencil(const BoundaryReconstructionStencilData< 2, NumberType, n_components > &boundary_reconstruction_stencil, const unsigned int result_face, const CellStencilData< 2, NumberType, n_components > &physical_stencil, const Model &model)
Definition reconstruction_cache.hh:516
void fill_cell_data_from_topology(const CellGeometryDofs< dim, n_components > &topology, const VectorType &solution_global, CellData< dim, NumberType, n_components > &data)
Definition reconstruction_cache.hh:252
BoundaryReconstructionStencilData< dim, BoundaryNumberType, n_components > fill_boundary_reconstruction_stencil_from_topology(const BoundaryReconstructionStencilTopologyData< dim, n_components > &topology, const VectorType &solution_global)
Definition reconstruction_cache.hh:396
void prepare_boundary_reconstruction_stencil(BoundaryStencilData< dim, NumberType, n_components > &, const CellStencilData< dim, NumberType, n_components > &, const dealii::Point< dim > &)
Definition reconstruction_cache.hh:467
std::array< NumberType, n_components > reconstruct_u_derivative(const std::array< autodiff::Real< 1, NumberType >, n_components > &u_center, const dealii::Point< dim > ¢er, const dealii::Point< dim > &x, const std::array< dealii::Point< dim >, 2 *dim > &x_n, const std::array< std::array< autodiff::Real< 1, NumberType >, n_components >, 2 *dim > &u_n)
Definition reconstruction_cache.hh:300
CellStencilData< dim, NumberType, n_components > make_boundary_side_stencil(const BoundaryStencilData< dim, NumberType, n_components > &boundary_stencil, const size_t center_index, const size_t left_index, const size_t right_index)
Definition reconstruction_cache.hh:424
constexpr size_t upper_outer
Definition fv_boundaries.hh:29
constexpr size_t lower_outer
Definition fv_boundaries.hh:25
constexpr size_t upper_inner
Definition fv_boundaries.hh:28
constexpr size_t lower_inner
Definition fv_boundaries.hh:26
constexpr size_t physical_cell
Definition fv_boundaries.hh:27
std::array< dealii::Tensor< 1, dim, NumberType >, n_components > GradientType
Per-component gradient type: one Tensor<1,dim> per solution component.
Definition types.hh:17
std::array< dealii::Tensor< 3, dim, NumberType >, n_components > ThirdDerivativeType
Per-component third spatial derivative type.
Definition types.hh:23
Definition complex_math.hh:10
Definition reconstruction_cache.hh:350
BoundaryStencilData< dim, NumberType, n_components > primary
Definition reconstruction_cache.hh:352
std::array< bool, n_faces > corner_tangential_stencil_valid
Definition reconstruction_cache.hh:357
std::array< bool, n_faces > tangential_ghost_neighbor_valid
Definition reconstruction_cache.hh:354
std::array< std::array< BoundaryStencilData< dim, NumberType, n_components >, 3 >, n_faces > corner_tangential_stencils
Definition reconstruction_cache.hh:356
static constexpr size_t n_faces
Definition reconstruction_cache.hh:351
std::array< BoundaryStencilData< dim, NumberType, n_components >, n_faces > tangential_ghost_neighbors
Definition reconstruction_cache.hh:353
Definition reconstruction_cache.hh:360
std::array< BoundaryStencilTopologyData< dim, n_components >, n_faces > tangential_ghost_neighbors
Definition reconstruction_cache.hh:363
BoundaryStencilTopologyData< dim, n_components > primary
Definition reconstruction_cache.hh:362
std::array< bool, n_faces > corner_tangential_stencil_valid
Definition reconstruction_cache.hh:367
static constexpr size_t n_faces
Definition reconstruction_cache.hh:361
std::array< bool, n_faces > tangential_ghost_neighbor_valid
Definition reconstruction_cache.hh:364
std::array< std::array< BoundaryStencilTopologyData< dim, n_components >, 3 >, n_faces > corner_tangential_stencils
Definition reconstruction_cache.hh:366
Definition reconstruction_cache.hh:325
unsigned int cell_face
Definition reconstruction_cache.hh:331
std::array< dealii::Point< dim >, stencil_size > x
Definition reconstruction_cache.hh:327
static constexpr size_t stencil_size
Definition reconstruction_cache.hh:326
bool lower_boundary
Definition reconstruction_cache.hh:330
size_t ghost_center
Definition reconstruction_cache.hh:333
size_t ghost_right
Definition reconstruction_cache.hh:335
dealii::Point< dim > face_center
Definition reconstruction_cache.hh:332
std::array< std::array< dealii::types::global_dof_index, n_components >, stencil_size > dof_indices
Definition reconstruction_cache.hh:329
size_t ghost_left
Definition reconstruction_cache.hh:334
std::array< std::array< NumberType, n_components >, stencil_size > u
Definition reconstruction_cache.hh:328
Definition reconstruction_cache.hh:43
Definition reconstruction_cache.hh:338
bool lower_boundary
Definition reconstruction_cache.hh:342
std::array< std::array< dealii::types::global_dof_index, n_components >, stencil_size > dof_indices
Definition reconstruction_cache.hh:341
std::array< dealii::Point< dim >, stencil_size > x
Definition reconstruction_cache.hh:340
static constexpr size_t stencil_size
Definition reconstruction_cache.hh:339
size_t ghost_center
Definition reconstruction_cache.hh:345
unsigned int cell_face
Definition reconstruction_cache.hh:343
size_t ghost_left
Definition reconstruction_cache.hh:346
dealii::Point< dim > face_center
Definition reconstruction_cache.hh:344
size_t ghost_right
Definition reconstruction_cache.hh:347
Definition reconstruction_cache.hh:94
std::array< NumberType, n_components > u
Definition reconstruction_cache.hh:96
std::array< dealii::types::global_dof_index, n_components > dof_indices
Definition reconstruction_cache.hh:97
dealii::Point< dim > x
Definition reconstruction_cache.hh:95
Definition reconstruction_cache.hh:100
dealii::Point< dim > x
Definition reconstruction_cache.hh:101
std::array< dealii::types::global_dof_index, n_components > dof_indices
Definition reconstruction_cache.hh:102
Definition reconstruction_cache.hh:118
static constexpr size_t n_faces
Definition reconstruction_cache.hh:119
NeighborData< dim, NumberType, n_components > neighbors
Definition reconstruction_cache.hh:121
CellData< dim, NumberType, n_components > cell
Definition reconstruction_cache.hh:120
std::array< dealii::types::boundary_id, n_faces > boundary_ids
Definition reconstruction_cache.hh:122
std::array< dealii::Point< dim >, n_faces > face_centers
Definition reconstruction_cache.hh:123
Definition reconstruction_cache.hh:135
static constexpr size_t n_faces
Definition reconstruction_cache.hh:136
std::array< dealii::types::boundary_id, n_faces > boundary_ids
Definition reconstruction_cache.hh:139
NeighborTopologyData< dim, n_components > neighbors
Definition reconstruction_cache.hh:138
CellGeometryDofs< dim, n_components > cell
Definition reconstruction_cache.hh:137
std::array< dealii::Point< dim >, n_faces > face_centers
Definition reconstruction_cache.hh:140
Definition reconstruction_cache.hh:55
ThirdDerivativeType< dim, NumberType, n_components > third_derivatives_minus
Definition reconstruction_cache.hh:68
GradientType< dim, NumberType, n_components > face_grad_plus
Definition reconstruction_cache.hh:61
std::array< NumberType, n_components > u_minus
Definition reconstruction_cache.hh:56
GradientType< dim, NumberType, n_components > center_grad_minus
Definition reconstruction_cache.hh:58
GradientType< dim, NumberType, n_components > diffusion_grad_plus
Definition reconstruction_cache.hh:65
std::array< NumberType, n_components > diffusion_u_plus
Definition reconstruction_cache.hh:63
GradientType< dim, NumberType, n_components > diffusion_grad_minus
Definition reconstruction_cache.hh:64
std::array< NumberType, n_components > diffusion_u
Definition reconstruction_cache.hh:66
GradientType< dim, NumberType, n_components > face_grad_minus
Definition reconstruction_cache.hh:60
std::array< NumberType, n_components > diffusion_u_minus
Definition reconstruction_cache.hh:62
GradientType< dim, NumberType, n_components > center_grad_plus
Definition reconstruction_cache.hh:59
std::array< NumberType, n_components > u_plus
Definition reconstruction_cache.hh:57
ThirdDerivativeType< dim, NumberType, n_components > third_derivatives_plus
Definition reconstruction_cache.hh:69
GradientType< dim, NumberType, n_components > diffusion_grad
Definition reconstruction_cache.hh:67
Definition reconstruction_cache.hh:158
std::array< dealii::Point< dim >, 4 > x
Definition reconstruction_cache.hh:159
std::array< std::array< NumberType, n_components >, 4 > u
Definition reconstruction_cache.hh:160
Definition reconstruction_cache.hh:105
static constexpr size_t n_faces
Definition reconstruction_cache.hh:106
std::array< dealii::Point< dim >, n_faces > x
Definition reconstruction_cache.hh:107
std::array< std::array< NumberType, n_components >, n_faces > u
Definition reconstruction_cache.hh:108
std::array< std::array< dealii::types::global_dof_index, n_components >, n_faces > dof_indices
Definition reconstruction_cache.hh:109
Definition reconstruction_cache.hh:112
std::array< std::array< dealii::types::global_dof_index, n_components >, n_faces > dof_indices
Definition reconstruction_cache.hh:115
static constexpr size_t n_faces
Definition reconstruction_cache.hh:113
std::array< dealii::Point< dim >, n_faces > x
Definition reconstruction_cache.hh:114
Definition reconstruction_cache.hh:126
std::vector< std::array< bool, n_faces > > face_reconstruction_valid
Definition reconstruction_cache.hh:131
std::vector< CellStencilData< dim, NumberType, n_components > > cell_stencils
Definition reconstruction_cache.hh:128
bool topology_initialized
Definition reconstruction_cache.hh:132
static constexpr size_t n_faces
Definition reconstruction_cache.hh:127
std::vector< std::array< FaceReconstructionState< dim, NumberType, n_components >, n_faces > > face_reconstructions
Definition reconstruction_cache.hh:130
Definition corrected_weighted_least_squares_reconstructor.hh:15
Definition types.hh:25
Generated by