https://mooseframework.inl.gov
SubChannelMesh.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 "SubChannelMesh.h"
11 
14 {
16  params.addClassDescription("Base class for all mesh containers");
17  return params;
18 }
19 
20 SubChannelMesh::SubChannelMesh(const InputParameters & params) : MooseMesh(params), _kij(0.0) {}
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  _spacer_z(other_mesh._spacer_z),
30  _spacer_k(other_mesh._spacer_k),
31  _kij(other_mesh._kij),
32  _pitch(other_mesh._pitch),
33  _pin_diameter(other_mesh._pin_diameter),
34  _n_cells(other_mesh._n_cells)
35 {
36 }
37 
38 void
39 SubChannelMesh::generateZGrid(Real unheated_length_entry,
40  Real heated_length,
41  Real unheated_length_exit,
42  unsigned int n_cells,
43  std::vector<Real> & z_grid)
44 {
45  Real L = unheated_length_entry + heated_length + unheated_length_exit;
46  Real dz = L / n_cells;
47  for (unsigned int i = 0; i < n_cells + 1; i++)
48  z_grid.push_back(dz * i);
49 }
50 
51 unsigned int
52 SubChannelMesh::getZIndex(const Point & point) const
53 {
54  if (_z_grid.size() == 0)
55  mooseError("_z_grid is empty.");
56 
57  if (point(2) <= _z_grid[0])
58  return 0;
59  if (point(2) >= _z_grid[_z_grid.size() - 1])
60  return _z_grid.size() - 1;
61 
62  unsigned int lo = 0;
63  unsigned int hi = _z_grid.size();
64  while (lo < hi)
65  {
66  unsigned int mid = (lo + hi) / 2;
67  if (std::abs(_z_grid[mid] - point(2)) < 1e-5)
68  return mid;
69  else if (_z_grid[mid] < point(2))
70  lo = mid;
71  else
72  hi = mid;
73  }
74  return lo;
75 }
static InputParameters validParams()
static InputParameters validParams()
std::vector< Real > _z_grid
axial location of nodes
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 unteaded lengths.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
Base class for subchannel meshes.
dof_id_type n_cells
virtual unsigned int getZIndex(const Point &point) const
Get axial index of point.
SubChannelMesh(const InputParameters &parameters)