Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://www.mooseframework.org 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 "KokkosResidualObject.h" 11 : 12 : #include "FEProblemBase.h" 13 : 14 : namespace Moose::Kokkos 15 : { 16 : 17 : InputParameters 18 125302 : ResidualObject::validParams() 19 : { 20 125302 : auto params = ::ResidualObject::validParams(); 21 : 22 383764 : params.addParam<bool>("use_displaced_mesh", 23 234888 : false, 24 : "Whether or not this object should use the " 25 : "displaced mesh for computation. Note that in " 26 : "the case this is true but no displacements " 27 : "are provided in the Mesh block the " 28 : "undisplaced mesh will still be used."); 29 : 30 501208 : params.addParamNamesToGroup("use_displaced_mesh", "Advanced"); 31 375906 : params.addCoupledVar("displacements", "The displacements"); 32 : 33 125302 : params.addPrivateParam<bool>(MooseBase::kokkos_object_param, true); 34 : 35 125302 : return params; 36 0 : } 37 : 38 8410 : ResidualObject::ResidualObject(const InputParameters & parameters, 39 : Moose::VarFieldType field_type, 40 16144 : bool nodal) 41 : : ::ResidualObject(parameters, nodal), 42 4543 : MeshHolder(*_fe_problem.mesh().getKokkosMesh()), 43 4543 : AssemblyHolder(_fe_problem.kokkosAssembly()), 44 4543 : FESystemHolder(_fe_problem.getKokkosFESystems()), 45 13629 : _var(_subproblem.getVariable(_tid, 46 4543 : getParam<NonlinearVariableName>("variable"), 47 : Moose::VarKindType::VAR_SOLVER, 48 : field_type)), 49 4543 : _dimension(_fe_problem.mesh().dimension()), 50 4543 : _t(TransientInterface::_t), 51 4543 : _t_old(TransientInterface::_t_old), 52 4543 : _t_step(TransientInterface::_t_step), 53 4543 : _dt(TransientInterface::_dt), 54 18172 : _dt_old(TransientInterface::_dt_old) 55 : { 56 8410 : if (_var.isVector() && field_type != Moose::VarFieldType::VAR_FIELD_VECTOR) 57 0 : paramError("variable", "Vector variable specified to a scalar Kokkos residual object."); 58 : 59 8410 : _kokkos_var.init(_var); 60 8410 : } 61 : 62 414551 : ResidualObject::ResidualObject(const ResidualObject & object) 63 : : ::ResidualObject(object, {}), 64 : MeshHolder(object), 65 : AssemblyHolder(object), 66 : FESystemHolder(object), 67 233919 : _var(object._var), 68 233919 : _kokkos_var(object._kokkos_var), 69 233919 : _thread(object._thread), 70 233919 : _dimension(object._dimension), 71 233919 : _t(object._t), 72 233919 : _t_old(object._t_old), 73 233919 : _t_step(object._t_step), 74 233919 : _dt(object._dt), 75 233919 : _dt_old(object._dt_old), 76 233919 : _vector_tags(object._vector_tags), 77 467838 : _matrix_tags(object._matrix_tags) 78 : { 79 : // Tags may be added to the governing tag sets held by the TaggingInterface later than the time 80 : // that the primary constructor is run. So it's more robust to build our tag set, immediately 81 : // before being dispatched to device, from the governing TaggingInterface set instead of relying 82 : // on copying the tag set from object's \p _vector_tags and \p _matrix_tags arrays 83 414551 : _vector_tags = object.getVectorTags({}); 84 414551 : _matrix_tags = object.getMatrixTags({}); 85 414551 : } 86 : 87 : } // namespace Moose::Kokkos