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 103088 : ResidualObject::validParams() 19 : { 20 103088 : auto params = ::ResidualObject::validParams(); 21 : 22 316192 : params.addParam<bool>("use_displaced_mesh", 23 192320 : 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 412352 : params.addParamNamesToGroup("use_displaced_mesh", "Advanced"); 31 309264 : params.addCoupledVar("displacements", "The displacements"); 32 : 33 103088 : params.addPrivateParam<bool>(MooseBase::kokkos_object_param, true); 34 : 35 103088 : return params; 36 0 : } 37 : 38 7508 : ResidualObject::ResidualObject(const InputParameters & parameters, 39 : Moose::VarFieldType field_type, 40 14380 : bool nodal) 41 : : ::ResidualObject(parameters, nodal), 42 4072 : MeshHolder(*_fe_problem.mesh().getKokkosMesh()), 43 4072 : AssemblyHolder(_fe_problem.kokkosAssembly()), 44 4072 : SystemHolder(_fe_problem.getKokkosSystems()), 45 12216 : _var(_subproblem.getVariable(_tid, 46 4072 : getParam<NonlinearVariableName>("variable"), 47 : Moose::VarKindType::VAR_SOLVER, 48 : field_type)), 49 4072 : _t(TransientInterface::_t), 50 4072 : _t_old(TransientInterface::_t_old), 51 4072 : _t_step(TransientInterface::_t_step), 52 4072 : _dt(TransientInterface::_dt), 53 16288 : _dt_old(TransientInterface::_dt_old) 54 : { 55 7508 : if (_var.isVector()) 56 0 : paramError("variable", "Kokkos residual objects do not support vector variables yet."); 57 : 58 7508 : _kokkos_var.init(_var); 59 7508 : } 60 : 61 387613 : ResidualObject::ResidualObject(const ResidualObject & object) 62 : : ::ResidualObject(object, {}), 63 : MeshHolder(object), 64 : AssemblyHolder(object), 65 : SystemHolder(object), 66 219860 : _var(object._var), 67 219860 : _kokkos_var(object._kokkos_var), 68 219860 : _thread(object._thread), 69 219860 : _t(object._t), 70 219860 : _t_old(object._t_old), 71 219860 : _t_step(object._t_step), 72 219860 : _dt(object._dt), 73 439720 : _dt_old(object._dt_old) 74 : { 75 387613 : _vector_tags = object.getVectorTags({}); 76 387613 : _matrix_tags = object.getMatrixTags({}); 77 387613 : } 78 : 79 : } // namespace Moose::Kokkos