[P]arallel [Hi]gh-order [Li]brary for [P]DEs  Latest
Parallel High-Order Library for PDEs through hp-adaptive Discontinuous Galerkin methods
periodic_cube_flow.cpp
1 #include "periodic_cube_flow.h"
2 
3 #include <stdlib.h>
4 #include <iostream>
5 #include "mesh/grids/straight_periodic_cube.hpp"
6 #include "mesh/gmsh_reader.hpp"
7 
8 namespace PHiLiP {
9 
10 namespace FlowSolver {
11 //=========================================================
12 // FLOW IN PERIODIC CUBE DOMAIN
13 //=========================================================
14 template <int dim, int nspecies, int nstate>
16  : CubeFlow_UniformGrid<dim, nspecies, nstate>(parameters_input)
17  , number_of_cells_per_direction(this->all_param.flow_solver_param.number_of_grid_elements_per_dimension)
18  , domain_left(this->all_param.flow_solver_param.grid_left_bound)
19  , domain_right(this->all_param.flow_solver_param.grid_right_bound)
20  , domain_size(pow(this->domain_right - this->domain_left, dim))
21  , domain_size_per_element(this->domain_size/pow(this->number_of_cells_per_direction,dim))
22 { }
23 
24 template <int dim, int nspecies, int nstate>
25 std::shared_ptr<Triangulation> PeriodicCubeFlow<dim,nspecies,nstate>::generate_grid() const
26 {
28  if constexpr(dim == 3) {
29  const std::string mesh_filename = this->all_param.flow_solver_param.input_mesh_filename + std::string(".msh");
30  this->pcout << "- Generating grid using input mesh: " << mesh_filename << std::endl;
31 
32  std::shared_ptr <HighOrderGrid<dim, double>> cube_mesh = read_gmsh<dim, dim>(
33  mesh_filename,
45 
46  return cube_mesh->triangulation;
47  }
48  else {
49  this->pcout << "ERROR: read_gmsh() has not been tested with periodic_cube_flow() for 1D and 2D. Aborting..." << std::endl;
50  std::abort();
51  }
52  } else {
53  this->pcout << "- Generating grid using dealii GridGenerator" << std::endl;
54 
55  std::shared_ptr<Triangulation> grid = std::make_shared<Triangulation> (
56 #if PHILIP_DIM!=1
57  this->mpi_communicator
58 #endif
59  );
60 
61  Grids::straight_periodic_cube<dim, Triangulation>(grid, domain_left, domain_right,
63  return grid;
64  }
65 }
66 
67 template <int dim, int nspecies, int nstate>
69 {
70  const std::string grid_type_string = "straight_periodic_cube";
71  // Display the information about the grid
72  this->pcout << "- Grid type: " << grid_type_string << std::endl;
73  this->pcout << "- - Grid degree: " << this->all_param.flow_solver_param.grid_degree << std::endl;
74  this->pcout << "- - Domain dimensionality: " << dim << std::endl;
75  this->pcout << "- - Domain left: " << this->domain_left << std::endl;
76  this->pcout << "- - Domain right: " << this->domain_right << std::endl;
77  this->pcout << "- - Number of cells in each direction: " << this->number_of_cells_per_direction << std::endl;
78  if constexpr(dim==1) this->pcout << "- - Domain length: " << this->domain_size << std::endl;
79  if constexpr(dim==2) this->pcout << "- - Domain area: " << this->domain_size << std::endl;
80  if constexpr(dim==3) this->pcout << "- - Domain volume: " << this->domain_size << std::endl;
81 }
82 
83 template <int dim, int nspecies, int nstate>
85 {
87 }
88 
89 #if PHILIP_SPECIES==1
92  #if PHILIP_DIM==2
94  #endif
95 #else
97 #endif
98 
99 } // FlowSolver namespace
100 } // PHiLiP namespace
101 
int y_periodic_id_face_2
Custom Boundary IDs for the second periodic face in the y-direction.
const double domain_size
Domain size (length in 1D, area in 2D, and volume in 3D)
int y_periodic_id_face_1
Custom Boundary IDs for the first periodic face in the y-direction.
int x_periodic_id_face_1
Custom Boundary IDs for the first periodic face in the x-direction.
const Parameters::AllParameters all_param
All parameters.
int z_periodic_id_face_2
Custom Boundary IDs for the first periodic face in the z-direction.
FlowSolverParam flow_solver_param
Contains the parameters for simulation cases (flow solver test)
int z_periodic_id_face_1
Custom Boundary IDs for the first periodic face in the z-direction.
unsigned int grid_degree
Parameters related to mesh generation.
bool use_periodic_BC_in_z
Flag for using periodic boundary conditions in the z-direction.
const double domain_left
Domain left-boundary value for generating the grid.
Files for the baseline physics.
Definition: ADTypes.hpp:10
bool mesh_reader_verbose_output
< Flag for verbose (true) or quiet (false) mesh reader output
Main parameter class that contains the various other sub-parameter classes.
bool do_renumber_dofs
Flag for renumbering DOFs.
virtual void display_additional_flow_case_specific_parameters() const override
Display additional more specific flow case parameters.
bool use_periodic_BC_in_y
Flag for using periodic boundary conditions in the y-direction.
PeriodicCubeFlow(const Parameters::AllParameters *const parameters_input)
Constructor.
bool use_gmsh_mesh
< Flag for using input mesh file
const int number_of_cells_per_direction
Number of cells per direction for the grid.
const MPI_Comm mpi_communicator
MPI communicator.
int x_periodic_id_face_2
Custom Boundary IDs for the second periodic face in the x-direction.
dealii::ConditionalOStream pcout
ConditionalOStream.
const double domain_right
Domain right-boundary value for generating the grid.
bool use_periodic_BC_in_x
Flag for using periodic boundary conditions in the x-direction.
virtual std::shared_ptr< Triangulation > generate_grid() const override
Function to generate the grid.
virtual void display_grid_parameters() const
Display grid parameters.