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 : #include "ComputeBoundaryInitialConditionThread.h" 11 : 12 : // MOOSE includes 13 : #include "Assembly.h" 14 : #include "InitialCondition.h" 15 : #include "MooseVariableFE.h" 16 : #include "SystemBase.h" 17 : 18 57573 : ComputeBoundaryInitialConditionThread::ComputeBoundaryInitialConditionThread( 19 57573 : FEProblemBase & fe_problem) 20 57573 : : ThreadedNodeLoop<ConstBndNodeRange, ConstBndNodeRange::const_iterator>(fe_problem) 21 : { 22 57573 : } 23 : 24 5333 : ComputeBoundaryInitialConditionThread::ComputeBoundaryInitialConditionThread( 25 5333 : ComputeBoundaryInitialConditionThread & x, Threads::split split) 26 5333 : : ThreadedNodeLoop<ConstBndNodeRange, ConstBndNodeRange::const_iterator>(x, split) 27 : { 28 5333 : } 29 : 30 2191 : ComputeBoundaryInitialConditionThread::ComputeBoundaryInitialConditionThread( 31 2191 : FEProblemBase & fe_problem, const std::set<VariableName> * target_vars) 32 : : ThreadedNodeLoop<ConstBndNodeRange, ConstBndNodeRange::const_iterator>(fe_problem), 33 2191 : _target_vars(target_vars) 34 : { 35 2191 : } 36 : 37 : void 38 4202881 : ComputeBoundaryInitialConditionThread::onNode(ConstBndNodeRange::const_iterator & nd) 39 : { 40 4202881 : const BndNode * bnode = *nd; 41 : 42 4202881 : Node * node = bnode->_node; 43 4202881 : BoundaryID boundary_id = bnode->_bnd_id; 44 : 45 8359785 : for (const auto nl_sys_num : make_range(_fe_problem.numNonlinearSystems())) 46 4156904 : _fe_problem.assembly(_tid, nl_sys_num).reinit(node); 47 : 48 4202881 : const InitialConditionWarehouse & warehouse = _fe_problem.getInitialConditionWarehouse(); 49 : 50 4202881 : if (warehouse.hasActiveBoundaryObjects(boundary_id, _tid)) 51 : { 52 110 : const auto & ics = warehouse.getActiveBoundaryObjects(boundary_id, _tid); 53 220 : for (const auto & ic : ics) 54 : { 55 : // Skip or include initial conditions based on target variable usage 56 110 : const auto & var_name = ic->variable().name(); 57 110 : if (_target_vars && !_target_vars->count(var_name)) 58 0 : continue; 59 : 60 110 : if (node->processor_id() == _fe_problem.processor_id()) 61 90 : ic->computeNodal(*node); 62 : } 63 : } 64 4202881 : } 65 : 66 : void 67 5333 : ComputeBoundaryInitialConditionThread::join(const ComputeBoundaryInitialConditionThread & /*y*/) 68 : { 69 5333 : }