1 #include <deal.II/base/function.h> 2 #include "exact_solution.h" 9 template <
int dim,
int nstate,
typename real>
17 template <
int dim,
int nstate,
typename real>
19 ::value(
const dealii::Point<dim,real> &,
const unsigned int )
const 28 template <
int dim,
int nstate,
typename real>
36 template <
int dim,
int nstate,
typename real>
38 ::value(
const dealii::Point<dim,real> &point,
const unsigned int )
const 40 double x_adv_speed = 1.0;
43 real pi = dealii::numbers::PI;
44 if(point[0] >= 0.0 && point[0] <= 2.0){
45 value = sin(2*pi*(point[0] - x_adv_speed * t)/2.0);
53 template <
int dim,
int nstate,
typename real>
62 template <
int dim,
int nstate,
typename real>
64 ::value(
const dealii::Point<dim,real> &point,
const unsigned int istate)
const 67 const double L = 10.0;
68 const double pi = dealii::numbers::PI;
69 const double gam = 1.4;
70 const double M_infty = sqrt(2/gam);
72 const double sigma = 1;
73 const double beta = M_infty * 5 * sqrt(2.0)/4.0/pi * exp(1.0/2.0);
74 const double alpha = pi/4;
77 const double x_travel = M_infty * t * cos(alpha);
78 const double x0 = 0.0 + x_travel;
79 const double y_travel = M_infty * t * sin(alpha);
80 const double y0 = 0.0 + y_travel;
81 const double x = std::fmod(point[0] - x0-L, 2*L)+L;
82 const double y = std::fmod(point[1] - y0-L, 2*L)+L;
84 const double Omega = beta * exp(-0.5/sigma/sigma* (x/R * x/R + y/R * y/R));
85 const double delta_Ux = -y/R * Omega;
86 const double delta_Uy = x/R * Omega;
87 const double delta_T = -(gam-1.0)/2.0 * Omega * Omega;
90 const double rho = pow((1 + delta_T), 1.0/(gam-1.0));
91 const double Ux = M_infty * cos(alpha) + delta_Ux;
92 const double Uy = M_infty * sin(alpha) + delta_Uy;
94 const double p = 1.0/gam*pow(1+delta_T, gam/(gam-1.0));
97 if (istate == 0)
return rho;
98 else if (istate == nstate-1)
return p/(gam-1.0) + 0.5 * rho * (Ux*Ux + Uy*Uy + Uz*Uz);
99 else if (istate == 1)
return rho * Ux;
100 else if (istate == 2)
return rho * Uy;
101 else if (istate == 3)
return rho * Uz;
109 template <
int dim,
int nstate,
typename real>
112 : dealii::Function<dim,real>(nstate)
117 template <
int dim,
int nstate,
typename real>
118 std::shared_ptr<ExactSolutionFunction<dim, nstate, real>>
121 const double time_compare)
125 if (flow_type == FlowCaseEnum::periodic_1D_unsteady){
126 if constexpr (dim==1 && nstate==dim)
return std::make_shared<ExactSolutionFunction_1DSine<dim,nstate,real> > (time_compare);
127 }
else if (flow_type == FlowCaseEnum::isentropic_vortex){
128 if constexpr (dim>1 && nstate==dim+2)
return std::make_shared<ExactSolutionFunction_IsentropicVortex<dim,nstate,real> > (time_compare);
131 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.
Exact Solution Function: Zero Function; used as a placeholder when there is no exact solution...
ExactSolutionFunction()
< 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.