3 #include <boost/preprocessor/seq/for_each.hpp> 15 template <
int dim,
int nspecies,
int nstate,
typename real>
18 manufactured_solution_function(manufactured_solution_function_input)
19 , mpi_communicator(MPI_COMM_WORLD)
20 , pcout(
std::cout, dealii::Utilities::MPI::this_mpi_process(mpi_communicator)==0)
23 template <
int dim,
int nspecies,
int nstate,
typename real>
26 const dealii::Point<dim,real> &,
27 const std::array<real,nstate> &,
28 const std::array<dealii::Tensor<1,dim,real>,nstate> &,
29 const dealii::types::global_dof_index )
const 31 std::array<real,nstate> physical_source;
32 physical_source.fill(0.0);
33 return physical_source;
36 template <
int dim,
int nspecies,
int nstate,
typename real>
40 for(
int s=0; s<nstate; ++s){
45 template <
int dim,
int nspecies,
int nstate,
typename real>
48 const dealii::Point<dim, real> &,
49 const dealii::Tensor<1,dim,real> &,
50 const std::array<real,nstate> &,
51 const std::array<dealii::Tensor<1,dim,real>,nstate> &,
52 std::array<real,nstate> &,
53 std::array<dealii::Tensor<1,dim,real>,nstate> &)
const 56 if constexpr(nstate>(dim+2)) {
57 pcout <<
"Error: boundary_manufactured_solution() not implemented in class derived from ModelBase with nstate>(dim+2)." << std::endl;
58 pcout <<
"Aborting..." << std::endl;
63 template <
int dim,
int nspecies,
int nstate,
typename real>
66 std::array<real,nstate> &,
67 std::array<dealii::Tensor<1,dim,real>,nstate> &)
const 70 if constexpr(nstate>(dim+2)) {
71 pcout <<
"Error: boundary_wall() not implemented in class derived from ModelBase with nstate>(dim+2)." << std::endl;
72 pcout <<
"Aborting..." << std::endl;
77 template <
int dim,
int nspecies,
int nstate,
typename real>
80 const std::array<real,nstate> &,
81 const std::array<dealii::Tensor<1,dim,real>,nstate> &,
82 std::array<real,nstate> &,
83 std::array<dealii::Tensor<1,dim,real>,nstate> &)
const 86 if constexpr(nstate>(dim+2)) {
87 pcout <<
"Error: boundary_outflow() not implemented in class derived from ModelBase with nstate>(dim+2)." << std::endl;
88 pcout <<
"Aborting..." << std::endl;
93 template <
int dim,
int nspecies,
int nstate,
typename real>
96 const std::array<real,nstate> &,
97 const std::array<dealii::Tensor<1,dim,real>,nstate> &,
98 std::array<real,nstate> &,
99 std::array<dealii::Tensor<1,dim,real>,nstate> &)
const 102 if constexpr(nstate>(dim+2)) {
103 pcout <<
"Error: boundary_inflow() not implemented in class derived from ModelBase with nstate>(dim+2)." << std::endl;
104 pcout <<
"Aborting..." << std::endl;
109 template <
int dim,
int nspecies,
int nstate,
typename real>
112 std::array<real,nstate> &)
const 115 if constexpr(nstate>(dim+2)) {
116 pcout <<
"Error: boundary_farfield() not implemented in class derived from ModelBase with nstate>(dim+2)." << std::endl;
117 pcout <<
"Aborting..." << std::endl;
122 template <
int dim,
int nspecies,
int nstate,
typename real>
125 const dealii::Tensor<1,dim,real> &,
126 const std::array<real,nstate> &,
127 const std::array<dealii::Tensor<1,dim,real>,nstate> &,
128 std::array<real,nstate> &,
129 std::array<dealii::Tensor<1,dim,real>,nstate> &)
const 132 if constexpr(nstate>(dim+2)) {
133 pcout <<
"Error: boundary_slip_wall() not implemented in class derived from ModelBase with nstate>(dim+2)." << std::endl;
134 pcout <<
"Aborting..." << std::endl;
139 template <
int dim,
int nspecies,
int nstate,
typename real>
142 const dealii::Tensor<1,dim,real> &,
143 const std::array<real,nstate> &,
144 std::array<real,nstate> &)
const 147 if constexpr(nstate>(dim+2)) {
148 pcout <<
"Error: boundary_riemann() not implemented in class derived from ModelBase with nstate>(dim+2)." << std::endl;
149 pcout <<
"Aborting..." << std::endl;
154 template <
int dim,
int nspecies,
int nstate,
typename real>
157 const int boundary_type,
158 const dealii::Point<dim, real> &pos,
159 const dealii::Tensor<1,dim,real> &normal_int,
160 const std::array<real,nstate> &soln_int,
161 const std::array<dealii::Tensor<1,dim,real>,nstate> &soln_grad_int,
162 std::array<real,nstate> &soln_bc,
163 std::array<dealii::Tensor<1,dim,real>,nstate> &soln_grad_bc)
const 165 if (boundary_type == 1000) {
169 else if (boundary_type == 1001) {
173 else if (boundary_type == 1002) {
177 else if (boundary_type == 1003) {
181 else if (boundary_type == 1004) {
185 else if (boundary_type == 1005) {
189 else if (boundary_type == 1006) {
194 pcout <<
"Invalid boundary_type: " << boundary_type <<
" in ModelBase.cpp" << std::endl;
200 template <
int dim,
int nspecies,
int nstate,
typename real>
203 const dealii::Vector<double> &uh,
204 const std::vector<dealii::Tensor<1,dim> > &,
205 const std::vector<dealii::Tensor<2,dim> > &,
206 const dealii::Tensor<1,dim> &,
207 const dealii::Point<dim> &)
const 209 dealii::Vector<double> computed_quantities(nstate-(dim+2));
210 for (
unsigned int s=dim+2; s<nstate; ++s) {
211 computed_quantities(s-(dim+2)) = uh(s);
213 return computed_quantities;
216 template <
int dim,
int nspecies,
int nstate,
typename real>
220 std::vector<std::string> names;
221 for (
unsigned int s=dim+2; s<nstate; ++s) {
222 std::string varname =
"state" + dealii::Utilities::int_to_string(s,1);
223 names.push_back(varname);
228 template <
int dim,
int nspecies,
int nstate,
typename real>
232 namespace DCI = dealii::DataComponentInterpretation;
233 std::vector<DCI::DataComponentInterpretation> interpretation;
234 for (
unsigned int s=dim+2; s<nstate; ++s) {
235 interpretation.push_back (DCI::component_is_scalar);
237 return interpretation;
244 #if PHILIP_SPECIES==1 246 #define POSSIBLE_NSTATE (1)(2)(3)(4)(5)(6)(8) 249 #define INSTANTIATE_FOR_NSTATE(r, data, nstate) \ 250 template class ModelBase<PHILIP_DIM, PHILIP_SPECIES, nstate, double>; \ 251 template class ModelBase<PHILIP_DIM, PHILIP_SPECIES, nstate, FadType>; \ 252 template class ModelBase<PHILIP_DIM, PHILIP_SPECIES, nstate, RadType>; \ 253 template class ModelBase<PHILIP_DIM, PHILIP_SPECIES, nstate, FadFadType>; \ 254 template class ModelBase<PHILIP_DIM, PHILIP_SPECIES, nstate, RadFadType>; 255 BOOST_PP_SEQ_FOR_EACH(INSTANTIATE_FOR_NSTATE, _, POSSIBLE_NSTATE)
257 #define POSSIBLE_TYPE (double)(FadType)(RadType)(FadFadType)(RadFadType) 258 #define INSTANTIATE_TYPES(r, data, type) \ 259 template class ModelBase<PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+PHILIP_SPECIES+1, type>; 260 BOOST_PP_SEQ_FOR_EACH(INSTANTIATE_TYPES, _, POSSIBLE_TYPE)
virtual void set_unfiltered_conservative_solution(const std::array< real, nstate > &unfiltered_conservative_solution_)
Setter for the unfiltered conservative solution.
Manufactured solution used for grid studies to check convergence orders.
virtual std::vector< std::string > post_get_names() const
Returns names of the solution to be used by PhysicsPostprocessor to output current solution...
virtual void boundary_riemann(const dealii::Tensor< 1, dim, real > &normal_int, const std::array< real, nstate > &soln_int, std::array< real, nstate > &soln_bc) const
Riemann-based farfield boundary conditions based on freestream values.
Files for the baseline physics.
virtual std::array< real, nstate > physical_source_term(const dealii::Point< dim, real > &pos, const std::array< real, nstate > &solution, const std::array< dealii::Tensor< 1, dim, real >, nstate > &solution_gradient, const dealii::types::global_dof_index cell_index) const
Physical source terms additional to the baseline physics (including physical source terms in addition...
virtual void boundary_wall(std::array< real, nstate > &soln_bc, std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_bc) const
Wall boundary condition.
virtual void boundary_inflow(const std::array< real, nstate > &soln_int, const std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_int, std::array< real, nstate > &soln_bc, std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_bc) const
Inflow boundary conditions.
dealii::ConditionalOStream pcout
Parallel std::cout that only outputs on mpi_rank==0.
void boundary_face_values(const int boundary_type, const dealii::Point< dim, real > &pos, const dealii::Tensor< 1, dim, real > &normal, const std::array< real, nstate > &soln_int, const std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_int, std::array< real, nstate > &soln_bc, std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_bc) const
Boundary condition handler.
virtual void boundary_slip_wall(const dealii::Tensor< 1, dim, real > &normal_int, const std::array< real, nstate > &soln_int, const std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_int, std::array< real, nstate > &soln_bc, std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_bc) const
Slip wall boundary condition.
virtual void boundary_outflow(const std::array< real, nstate > &soln_int, const std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_int, std::array< real, nstate > &soln_bc, std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_bc) const
Outflow Boundary Condition.
ModelBase(std::shared_ptr< ManufacturedSolutionFunction< dim, nspecies, real > > manufactured_solution_function_input=nullptr)
Constructor.
virtual dealii::Vector< double > post_compute_derived_quantities_vector(const dealii::Vector< double > &uh, const std::vector< dealii::Tensor< 1, dim > > &, const std::vector< dealii::Tensor< 2, dim > > &, const dealii::Tensor< 1, dim > &, const dealii::Point< dim > &) const
Returns current vector solution to be used by PhysicsPostprocessor to output current solution...
virtual void boundary_manufactured_solution(const dealii::Point< dim, real > &pos, const dealii::Tensor< 1, dim, real > &normal_int, const std::array< real, nstate > &soln_int, const std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_int, std::array< real, nstate > &soln_bc, std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_bc) const
Evaluate the manufactured solution boundary conditions.
virtual void boundary_farfield(std::array< real, nstate > &soln_bc) const
Farfield boundary conditions based on freestream values.
virtual std::vector< dealii::DataComponentInterpretation::DataComponentInterpretation > post_get_data_component_interpretation() const
Returns DataComponentInterpretation of the solution to be used by PhysicsPostprocessor to output curr...
std::array< real, nstate > unfiltered_conservative_solution
The unfiltered conservative solution.