[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 nstate>
16  : CubeFlow_UniformGrid<dim, 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 { }
22 
23 template <int dim, int nstate>
24 std::shared_ptr<Triangulation> PeriodicCubeFlow<dim,nstate>::generate_grid() const
25 {
27  if constexpr(dim == 3) {
28  const std::string mesh_filename = this->all_param.flow_solver_param.input_mesh_filename + std::string(".msh");
29  this->pcout << "- Generating grid using input mesh: " << mesh_filename << std::endl;
30 
31  std::shared_ptr <HighOrderGrid<dim, double>> cube_mesh = read_gmsh<dim, dim>(
32  mesh_filename,
44 
45  return cube_mesh->triangulation;
46  }
47  else {
48  this->pcout << "ERROR: read_gmsh() has not been tested with periodic_cube_flow() for 1D and 2D. Aborting..." << std::endl;
49  std::abort();
50  }
51  } else {
52  this->pcout << "- Generating grid using dealii GridGenerator" << std::endl;
53 
54  std::shared_ptr<Triangulation> grid = std::make_shared<Triangulation> (
55 #if PHILIP_DIM!=1
56  this->mpi_communicator
57 #endif
58  );
59 
60  Grids::straight_periodic_cube<dim, Triangulation>(grid, domain_left, domain_right,
62  return grid;
63  }
64 }
65 
66 template <int dim, int nstate>
68 {
69  const std::string grid_type_string = "straight_periodic_cube";
70  // Display the information about the grid
71  this->pcout << "- Grid type: " << grid_type_string << std::endl;
72  this->pcout << "- - Grid degree: " << this->all_param.flow_solver_param.grid_degree << std::endl;
73  this->pcout << "- - Domain dimensionality: " << dim << std::endl;
74  this->pcout << "- - Domain left: " << this->domain_left << std::endl;
75  this->pcout << "- - Domain right: " << this->domain_right << std::endl;
76  this->pcout << "- - Number of cells in each direction: " << this->number_of_cells_per_direction << std::endl;
77  if constexpr(dim==1) this->pcout << "- - Domain length: " << this->domain_size << std::endl;
78  if constexpr(dim==2) this->pcout << "- - Domain area: " << this->domain_size << std::endl;
79  if constexpr(dim==3) this->pcout << "- - Domain volume: " << this->domain_size << std::endl;
80 }
81 
82 template <int dim, int nstate>
84 {
86 }
87 
88 #if PHILIP_DIM==1
90 #else
92 #endif
93 
94 } // FlowSolver namespace
95 } // PHiLiP namespace
96 
const Parameters::AllParameters all_param
All parameters.
int y_periodic_id_face_2
Custom Boundary IDs for the second periodic face in the y-direction.
const MPI_Comm mpi_communicator
MPI communicator.
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.
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.
Files for the baseline physics.
Definition: ADTypes.hpp:10
const double domain_left
Domain left-boundary value for generating the grid.
const int number_of_cells_per_direction
Number of cells per direction for the grid.
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.
PeriodicCubeFlow(const Parameters::AllParameters *const parameters_input)
Constructor.
bool do_renumber_dofs
Flag for renumbering DOFs.
std::shared_ptr< Triangulation > generate_grid() const override
Function to generate the grid.
bool use_periodic_BC_in_y
Flag for using periodic boundary conditions in the y-direction.
bool use_gmsh_mesh
< Flag for using input mesh file
const double domain_size
Domain size (length in 1D, area in 2D, and volume in 3D)
const double domain_right
Domain right-boundary value for generating the grid.
int x_periodic_id_face_2
Custom Boundary IDs for the second periodic face in the x-direction.
virtual void display_additional_flow_case_specific_parameters() const override
Display additional more specific flow case parameters.
dealii::ConditionalOStream pcout
ConditionalOStream.
void display_grid_parameters() const
Display grid parameters.
bool use_periodic_BC_in_x
Flag for using periodic boundary conditions in the x-direction.