1 #include <deal.II/base/function.h> 2 #include "exact_solution.h" 3 #include <deal.II/base/utilities.h> 4 #include <deal.II/base/mpi.h> 11 template <
int dim,
int nstate,
typename real>
19 template <
int dim,
int nstate,
typename real>
21 ::value(
const dealii::Point<dim,real> &,
const unsigned int )
const 30 template <
int dim,
int nstate,
typename real>
38 template <
int dim,
int nstate,
typename real>
40 ::value(
const dealii::Point<dim,real> &point,
const unsigned int )
const 42 double x_adv_speed = 1.0;
45 real pi = dealii::numbers::PI;
46 if(point[0] >= 0.0 && point[0] <= 2.0){
47 value = sin(2*pi*(point[0] - x_adv_speed * t)/2.0);
55 template <
int dim,
int nstate,
typename real>
63 template <
int dim,
int nstate,
typename real>
65 ::value(
const dealii::Point<dim,real> &point,
const unsigned int )
const 68 real pi = dealii::numbers::PI;
69 if(point[0] >= 0.0 && point[0] <= 2.0){
70 value = cos(pi*(point[0] - t));
78 template <
int dim,
int nstate,
typename real>
87 template <
int dim,
int nstate,
typename real>
89 ::value(
const dealii::Point<dim,real> &point,
const unsigned int istate)
const 92 const double L = 10.0;
93 const double pi = dealii::numbers::PI;
94 const double gam = 1.4;
95 const double M_infty = sqrt(2/gam);
97 const double sigma = 1;
98 const double beta = M_infty * 5 * sqrt(2.0)/4.0/pi * exp(1.0/2.0);
99 const double alpha = pi/4;
102 const double x_travel = M_infty * t * cos(alpha);
103 const double x0 = 0.0 + x_travel;
104 const double y_travel = M_infty * t * sin(alpha);
105 const double y0 = 0.0 + y_travel;
106 const double x = std::fmod(point[0] - x0-L, 2*L)+L;
107 const double y = std::fmod(point[1] - y0-L, 2*L)+L;
109 const double Omega = beta * exp(-0.5/sigma/sigma* (x/R * x/R + y/R * y/R));
110 const double delta_Ux = -y/R * Omega;
111 const double delta_Uy = x/R * Omega;
112 const double delta_T = -(gam-1.0)/2.0 * Omega * Omega;
115 const double rho = pow((1 + delta_T), 1.0/(gam-1.0));
116 const double Ux = M_infty * cos(alpha) + delta_Ux;
117 const double Uy = M_infty * sin(alpha) + delta_Uy;
119 const double p = 1.0/gam*pow(1+delta_T, gam/(gam-1.0));
122 if (istate == 0)
return rho;
123 else if (istate == nstate-1)
return p/(gam-1.0) + 0.5 * rho * (Ux*Ux + Uy*Uy + Uz*Uz);
124 else if (istate == 1)
return rho * Ux;
125 else if (istate == 2)
return rho * Uy;
126 else if (istate == 3)
return rho * Uz;
134 template <
int dim,
int nstate,
typename real>
137 : dealii::Function<dim,real>(nstate)
142 template <
int dim,
int nstate,
typename real>
143 std::shared_ptr<ExactSolutionFunction<dim, nstate, real>>
146 const double time_compare)
150 if (flow_type == FlowCaseEnum::periodic_1D_unsteady){
151 if constexpr (dim==1 && nstate==dim)
return std::make_shared<ExactSolutionFunction_1DSine<dim,nstate,real> > (time_compare);
152 }
else if (flow_type == FlowCaseEnum::isentropic_vortex){
153 if constexpr (dim>1 && nstate==dim+2)
return std::make_shared<ExactSolutionFunction_IsentropicVortex<dim,nstate,real> > (time_compare);
154 }
else if (flow_type == FlowCaseEnum::burgers_inviscid){
155 if constexpr (dim==1 && nstate==dim)
return std::make_shared<ExactSolutionFunction_BurgersInviscidManufactured<dim,nstate,real> > (time_compare);
158 dealii::ConditionalOStream pcout(std::cout, dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD)==0);
159 pcout <<
"Warning: Returning zero for the exact solution." << std::endl
160 <<
"This may be unintentional!" << std::endl;
161 return std::make_shared<ExactSolutionFunction_Zero<dim,nstate,real>> (time_compare);
FlowCaseType
Selects the flow case to be simulated.
FlowCaseType flow_case_type
Selected FlowCaseType from the input file.
Files for the baseline physics.
static std::shared_ptr< ExactSolutionFunction< dim, nstate, real > > create_ExactSolutionFunction(const Parameters::FlowSolverParam &flow_solver_parameters, const double time_compare)
Construct ExactSolutionFunction object from global parameter file.
real value(const dealii::Point< dim, real > &point, const unsigned int istate=0) const override
Value of the exact solution at a point.
Exact Solution Function: Zero Function; used as a placeholder when there is no exact solution...
ExactSolutionFunction()
< dealii::Function we are templating on
ExactSolutionFunction_BurgersInviscidManufactured(double time_compare)
< dealii::Function we are templating on
Parameters related to the flow solver.
real value(const dealii::Point< dim, real > &point, const unsigned int istate=0) const override
Value of the exact solution at a point.
Exact solution function factory.
ExactSolutionFunction_IsentropicVortex(double time_compare)
< dealii::Function we are templating on
ExactSolutionFunction_Zero(double time_compare)
< dealii::Function we are templating on
Exact solution function used for a particular flow setup/case.
ExactSolutionFunction_1DSine(double time_compare)
< dealii::Function we are templating on
real value(const dealii::Point< dim, real > &point, const unsigned int istate=0) const override
Value of the exact solution at a point.
Exact Solution Function: Isentropic vortex.
real value(const dealii::Point< dim, real > &point, const unsigned int istate=0) const override
Value of the exact solution at a point.