https://mooseframework.inl.gov
InterWrapperMesh.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "InterWrapperMesh.h"
11 
14 {
16  params.addClassDescription("Creates an inter-wrappper mesh container");
17  return params;
18 }
19 
21 
23  : MooseMesh(other_mesh),
24  _unheated_length_entry(other_mesh._unheated_length_entry),
25  _heated_length(other_mesh._heated_length),
26  _unheated_length_exit(other_mesh._unheated_length_exit),
27  _z_grid(other_mesh._z_grid),
28  _k_grid(other_mesh._k_grid),
29  _kij(other_mesh._kij),
30  _assembly_pitch(other_mesh._assembly_pitch),
31  _assembly_side_x(other_mesh._assembly_side_x),
32  _assembly_side_y(other_mesh._assembly_side_y),
33  _n_cells(other_mesh._n_cells)
34 {
35 }
36 
37 void
38 InterWrapperMesh::generateZGrid(Real unheated_length_entry,
39  Real heated_length,
40  Real unheated_length_exit,
41  unsigned int n_cells,
42  std::vector<Real> & z_grid)
43 {
44  Real L = unheated_length_entry + heated_length + unheated_length_exit;
45  Real dz = L / n_cells;
46  for (unsigned int i = 0; i < n_cells + 1; i++)
47  z_grid.push_back(dz * i);
48 }
49 
50 unsigned int
51 InterWrapperMesh::getZIndex(const Point & point) const
52 {
53  if (_z_grid.size() == 0)
54  mooseError("_z_grid is empty.");
55 
56  if (point(2) <= _z_grid[0])
57  return 0;
58  if (point(2) >= _z_grid[_z_grid.size() - 1])
59  return _z_grid.size() - 1;
60 
61  unsigned int lo = 0;
62  unsigned int hi = _z_grid.size();
63  while (lo < hi)
64  {
65  unsigned int mid = (lo + hi) / 2;
66  if (std::abs(_z_grid[mid] - point(2)) < 1e-5)
67  return mid;
68  else if (_z_grid[mid] < point(2))
69  lo = mid;
70  else
71  hi = mid;
72  }
73  return lo;
74 }
static InputParameters validParams()
std::vector< Real > _z_grid
axial location of nodes
static InputParameters validParams()
Base class for inter-wrapper meshes.
InterWrapperMesh(const InputParameters &parameters)
virtual unsigned int getZIndex(const Point &point) const
Get axial index of point.
static void generateZGrid(Real unheated_length_entry, Real heated_length, Real unheated_length_exit, unsigned int n_cells, std::vector< Real > &z_grid)
Generate the spacing in z-direction using heated and unheated lengths.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
dof_id_type n_cells