14 #include "libmesh/face_quad4.h" 15 #include "libmesh/face_tri3.h" 16 #include "libmesh/mesh_modification.h" 28 "How many points to discretize the range q = (0.5, k) into.");
30 "How many 'extra' points should be inserted in the final element" 31 " *in addition to* the equispaced q points.");
32 params.
addRequiredParam<
int>(
"num_k_pts",
"How many points in the range k=(kmin, kmax).");
35 "inner_wall_bid", 2,
"The boundary id to use for the inner wall");
38 "outer_wall_bid", 4,
"The boundary id to use for the outer wall");
40 "triangles",
false,
"If true, all the quadrilateral elements will be split into triangles");
48 _gamma(getParam<
Real>(
"gamma")),
49 _kmax(getParam<
Real>(
"kmax")),
50 _kmin(getParam<
Real>(
"kmin")),
51 _num_q_pts(getParam<
int>(
"num_q_pts")),
52 _n_extra_q_pts(getParam<
int>(
"n_extra_q_pts")),
53 _num_k_pts(getParam<
int>(
"num_k_pts")),
58 _triangles(getParam<bool>(
"triangles"))
63 mooseError(
"RinglebMesh: kmax must be greater than kmin");
66 std::unique_ptr<MooseMesh>
75 std::vector<Real> values(4);
78 Real p = (1. / gamma) *
std::pow(a, 2 * gamma / (gamma - 1));
81 values = {a, rho, p, J};
89 const std::vector<Real> & ks,
90 const std::vector<Real> & q)
92 std::vector<Real> xy(2);
95 xy[0] = 0.5 / values[1] * (2. / ks[i] / ks[i] - 1. / q[index] / q[index]) - 0.5 * values[3];
99 Real sqrt_term = 1. - q[index] * q[index] / ks[i] / ks[i];
100 sqrt_term =
std::max(sqrt_term, 0.);
103 xy[1] = 1. / (ks[i] * values[1] * q[index]) *
std::sqrt(sqrt_term);
112 BoundaryInfo & boundary_info =
mesh.get_boundary_info();
115 std::vector<std::vector<Node *>> stream_nodes(
_num_k_pts);
118 int current_node_id = 0;
124 ks[i] =
_kmin + i * diff;
134 q[j] = 0.5 + j * diffq;
139 std::vector<Real>::iterator it = q.end();
140 q.insert(--it, 0.3 * q[j - 2] + 0.7 * q[j - 1]);
143 std::vector<Real> vals(4);
144 std::vector<Real> xy(2);
156 stream_nodes[i][j] =
mesh.add_point(Point(xy[0], xy[1]), current_node_id++);
170 stream_nodes[i][j] =
mesh.add_point(Point(xy[0], -xy[1]), current_node_id++);
182 Elem *
elem =
mesh.add_elem(
new Quad4);
183 elem->set_node(0, stream_nodes[i][j]);
184 elem->set_node(1, stream_nodes[i][j + 1]);
185 elem->set_node(2, stream_nodes[i + 1][j + 1]);
186 elem->set_node(3, stream_nodes[i + 1][j]);
199 Elem *
elem =
mesh.add_elem(
new Quad4);
200 elem->set_node(0, stream_nodes[i][j]);
201 elem->set_node(1, stream_nodes[i][j + 2]);
202 elem->set_node(2, stream_nodes[i + 1][j + 2]);
203 elem->set_node(3, stream_nodes[i + 1][j]);
214 mesh.prepare_for_use();
218 MeshTools::Modification::all_tri(
mesh);
221 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...
std::vector< Real > arhopj(const Real &gamma, const std::vector< Real > &q, const int &index)
std::unique_ptr< T > copyConstruct(const T &object)
Copy constructs the object object.
Factory & getFactory()
Retrieve a writable reference to the Factory associated with this App.
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...
MooseApp & _app
The MOOSE application this is associated with.
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.
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sqrt(_arg)) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tanh
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