12 #include "libmesh/face_quad4.h" 13 #include "libmesh/face_tri3.h" 14 #include "libmesh/mesh_modification.h" 26 "How many points to discretize the range q = (0.5, k) into.");
28 "How many 'extra' points should be inserted in the final element" 29 " *in addition to* the equispaced q points.");
30 params.
addRequiredParam<
int>(
"num_k_pts",
"How many points in the range k=(kmin, kmax).");
33 "inner_wall_bid", 2,
"The boundary id to use for the inner wall");
36 "outer_wall_bid", 4,
"The boundary id to use for the outer wall");
38 "triangles",
false,
"If true, all the quadrilateral elements will be split into triangles");
46 _gamma(getParam<
Real>(
"gamma")),
47 _kmax(getParam<
Real>(
"kmax")),
48 _kmin(getParam<
Real>(
"kmin")),
49 _num_q_pts(getParam<
int>(
"num_q_pts")),
50 _n_extra_q_pts(getParam<
int>(
"n_extra_q_pts")),
51 _num_k_pts(getParam<
int>(
"num_k_pts")),
56 _triangles(getParam<bool>(
"triangles"))
61 mooseError(
"RinglebMesh: kmax must be greater than kmin");
64 std::unique_ptr<MooseMesh>
67 return std::make_unique<RinglebMesh>(*this);
73 std::vector<Real> values(4);
76 Real p = (1. / gamma) *
std::pow(a, 2 * gamma / (gamma - 1));
79 values = {a, rho, p, J};
87 const std::vector<Real> & ks,
88 const std::vector<Real> & q)
90 std::vector<Real> xy(2);
93 xy[0] = 0.5 / values[1] * (2. / ks[i] / ks[i] - 1. / q[index] / q[index]) - 0.5 * values[3];
97 Real sqrt_term = 1. - q[index] * q[index] / ks[i] / ks[i];
101 xy[1] = 1. / (ks[i] * values[1] * q[index]) *
std::sqrt(sqrt_term);
110 BoundaryInfo & boundary_info =
mesh.get_boundary_info();
113 std::vector<std::vector<Node *>> stream_nodes(
_num_k_pts);
116 int current_node_id = 0;
122 ks[i] =
_kmin + i * diff;
132 q[j] = 0.5 + j * diffq;
137 std::vector<Real>::iterator it = q.end();
138 q.insert(--it, 0.3 * q[j - 2] + 0.7 * q[j - 1]);
141 std::vector<Real> vals(4);
142 std::vector<Real> xy(2);
154 stream_nodes[i][j] =
mesh.add_point(Point(xy[0], xy[1]), current_node_id++);
168 stream_nodes[i][j] =
mesh.add_point(Point(xy[0], -xy[1]), current_node_id++);
180 Elem *
elem =
mesh.add_elem(
new Quad4);
181 elem->set_node(0) = stream_nodes[i][j];
182 elem->set_node(1) = stream_nodes[i][j + 1];
183 elem->set_node(2) = stream_nodes[i + 1][j + 1];
184 elem->set_node(3) = stream_nodes[i + 1][j];
197 Elem *
elem =
mesh.add_elem(
new Quad4);
198 elem->set_node(0) = stream_nodes[i][j];
199 elem->set_node(1) = stream_nodes[i][j + 2];
200 elem->set_node(2) = stream_nodes[i + 1][j + 2];
201 elem->set_node(3) = stream_nodes[i + 1][j];
212 mesh.prepare_for_use();
216 MeshTools::Modification::all_tri(
mesh);
219 boundary_info.sideset_name(
_inflow_bid) =
"inflow";
static InputParameters validParams()
Typical "Moose-style" constructor and copy constructor.
const int & _num_q_pts
How many points to discretize the range q = (0.5, k) into.
const boundary_id_type _outer_wall_bid
const Real & _kmax
k is a streamline parameter, i.e.
Mesh generated from parameters.
const bool & _triangles
This parameter, if true, allows to split the quadrilateral elements into triangular elements...
ADRealEigenVector< T, D, asd > sqrt(const ADRealEigenVector< T, D, asd > &)
std::vector< Real > arhopj(const Real &gamma, const std::vector< Real > &q, const int &index)
auto max(const L &left, const R &right)
const boundary_id_type _outflow_bid
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
std::vector< Real > computexy(const std::vector< Real > values, const int &i, const int &index, const std::vector< Real > &ks, const std::vector< Real > &q)
const Real & _kmin
kmin corresponds to the outer wall
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
registerMooseObject("MooseApp", RinglebMesh)
const int & _n_extra_q_pts
how many "extra" points should be inserted in the nearest element from the horizontal in additi /// o...
static InputParameters validParams()
const boundary_id_type _inner_wall_bid
virtual void buildMesh() override
Must be overridden by child classes.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real & _gamma
Gamma.
RinglebMesh(const InputParameters ¶meters)
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
const int & _num_k_pts
how many points in the range k=(kmin, kmax).
virtual Elem * elem(const dof_id_type i)
Various accessors (pointers/references) for Elem "i".
virtual std::unique_ptr< MooseMesh > safeClone() const override
A safer version of the clone() method that hands back an allocated object wrapped in a smart pointer...
const boundary_id_type _inflow_bid
The boundary ids to use for the ringleb mesh.
MooseUnits pow(const MooseUnits &, int)
void ErrorVector unsigned int