https://mooseframework.inl.gov
SetupPeriodicRayBCAction.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 
11 
12 #include "AddRayBCAction.h"
13 #include "PeriodicRayBC.h"
14 
15 registerMooseAction("RayTracingApp", SetupPeriodicRayBCAction, "add_geometric_rm");
16 registerMooseAction("RayTracingApp", SetupPeriodicRayBCAction, "add_periodic_bc");
17 
20 {
21  auto params = Action::validParams();
22  params.addClassDescription("Sets up the periodic boundaries for a PeriodicRayBC if applicable.");
23  return params;
24 }
25 
27  : Action(params),
28  Moose::PeriodicBCHelper(getAddRayBCAction()),
29  _is_periodic_ray_bc(PeriodicRayBC::isPeriodicRayBC(getAddRayBCAction().getObjectParams()))
30 {
33 }
34 
35 void
37 {
39  return;
40 
41  // Tell the mesh to hold off on deleting remote elements because we need to wait for our
42  // periodic boundaries to be added
43  if (_current_task == "add_geometric_rm")
44  _mesh->allowRemoteElementRemoval(false);
45  else if (_current_task == "add_periodic_bc")
47 }
48 
49 void
51 {
52  mooseAssert(_is_periodic_ray_bc, "Not a PeriodicRayBC");
53 
54  const auto & periodic_boundaries = getPeriodicBoundaries();
55 
56  // Form boundaries for hidden "boundary" param
57  std::vector<BoundaryName> boundary;
58  for (const auto & it : periodic_boundaries)
59  boundary.push_back(std::to_string(it.first));
60  params.set<std::vector<BoundaryName>>("boundary") = boundary;
61 
62  // Allow BC to access the PeriodicBoundaries object
64  &periodic_boundaries;
65 }
66 
67 const AddRayBCAction &
69 {
71 }
void setupPeriodicBoundaries(FEProblemBase &problem)
const T & getAction(const std::string &name) const
static const std::string periodic_boundaries_param
Name of the parameter that stores the PeriodicBoundaries pointer.
Definition: PeriodicRayBC.h:30
RayBC that enforces periodic boundaries.
Definition: PeriodicRayBC.h:17
Action that sets up the periodic boundary conditions for a PeriodicRayBC.
MooseApp & _app
T & set(const std::string &name, bool quiet_mode=false)
const AddRayBCAction & getAddRayBCAction() const
Helper for getting the AddRayBCAction that is responsible for building the RayBC this action is assoc...
const libMesh::PeriodicBoundaries & getPeriodicBoundaries() const
const std::string & name() const
static InputParameters validParams()
void checkPeriodicParams() const
const std::string & _current_task
ActionWarehouse & actionWarehouse()
static InputParameters validParams()
const bool _is_periodic_ray_bc
Whether or not we are acting on a PeriodicRayBC.
Action for creating a RayBC and associating it with the necessary RayTracingStudy objects...
std::shared_ptr< MooseMesh > & _mesh
SetupPeriodicRayBCAction(const InputParameters &params)
registerMooseAction("RayTracingApp", SetupPeriodicRayBCAction, "add_geometric_rm")
void setupPeriodicRayBC(InputParameters &params) const
Method to be called from the AddRayBCAction that is associated with the same RayBC this Action is ass...
std::shared_ptr< FEProblemBase > & _problem