Line data Source code
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 : #pragma once 11 : 12 : #include "InputParameters.h" 13 : 14 : #include "libmesh/periodic_boundaries.h" 15 : 16 : class Action; 17 : class FEProblemBase; 18 : class InputParameters; 19 : class MooseMesh; 20 : 21 : namespace Moose 22 : { 23 : /** 24 : * Helper class for setting up periodic boundary conditions via an Action. 25 : * 26 : * Determines the PeriodicBoundaries given the parameters and sets up 27 : * geometric ghosting. Does not handle algebraic ghosting. 28 : */ 29 : class PeriodicBCHelper 30 : { 31 : public: 32 : static InputParameters validParams(); 33 : 34 : PeriodicBCHelper(const Action & action); 35 : 36 : protected: 37 : /** 38 : * Checks the validity of the periodic boundary condition parameters. 39 : */ 40 : void checkPeriodicParams() const; 41 : 42 : /** 43 : * Sets up the periodic boundaries. 44 : * 45 : * Should be called by the owning Action. Once called, the PeriodicBoundaries 46 : * object will be available via getPeriodicBoundaries(). 47 : * 48 : * onSetupPeriodicBoundary() will be called on each periodic boundary 49 : * added to enable the derived class to extend. 50 : */ 51 : void setupPeriodicBoundaries(FEProblemBase & problem); 52 : 53 : /** 54 : * Entry-point for derived actions to extend the addition of a periodic boundary. 55 : */ 56 0 : virtual void onSetupPeriodicBoundary(libMesh::PeriodicBoundaryBase & /* p */) {}; 57 : 58 : /** 59 : * Get the PeriodicBoundaries map produced in setupPeriodicBoundaries(). 60 : */ 61 1359 : const libMesh::PeriodicBoundaries & getPeriodicBoundaries() const { return _periodic_boundaries; } 62 : 63 : private: 64 : /** 65 : * Internal helper for adding a periodic boundary. 66 : */ 67 : void addPeriodicBoundary(std::unique_ptr<libMesh::PeriodicBoundaryBase> /* p */); 68 : 69 : /** 70 : * Internal method for setting up periodic boundaries via the "auto_direction" param. 71 : */ 72 : void setupAutoPeriodicBoundaries(MooseMesh & mesh); 73 : /** 74 : * Internal method for setting up manual periodic boundaries via the 75 : * "translation" and "transform_func" params. 76 : */ 77 : void setupManualPeriodicBoundaries(FEProblemBase & problem); 78 : 79 : /** 80 : * Internal method for getting the parameters by the owned action. 81 : * 82 : * Enables the use of the MOOSE object parameters if the owner is a 83 : * MooseObjectAction. 84 : */ 85 : const InputParameters & getParams() const; 86 : 87 : /// The owning Action 88 : const Action & _action; 89 : /// The parameters used to create the periodic boundary 90 : const InputParameters & _params; 91 : /// The PeriodicBoundaries map, filled in setupPeriodicBoundaries() 92 : libMesh::PeriodicBoundaries _periodic_boundaries; 93 : }; 94 : }