Line data Source code
1 : //* This file is part of SALAMANDER: Software for Advanced Large-scale Analysis of MAgnetic confinement for Numerical Design, Engineering & Research, 2 : //* A multiphysics application for modeling plasma facing components 3 : //* https://github.com/idaholab/salamander 4 : //* https://mooseframework.inl.gov/salamander 5 : //* 6 : //* SALAMANDER is powered by the MOOSE Framework 7 : //* https://www.mooseframework.inl.gov 8 : //* 9 : //* Licensed under LGPL 2.1, please see LICENSE for details 10 : //* https://www.gnu.org/licenses/lgpl-2.1.html 11 : //* 12 : //* Copyright 2025, Battelle Energy Alliance, LLC 13 : //* ALL RIGHTS RESERVED 14 : //* 15 : 16 : #include "ParticleQuantityResidualAccumulatorBase.h" 17 : #include "PICStudyBase.h" 18 : 19 : InputParameters 20 714 : ParticleQuantityResidualAccumulatorBase::validParams() 21 : { 22 714 : auto params = GeneralUserObject::validParams(); 23 714 : params.addClassDescription("Accumulator used to evaluate the inner product of the particle " 24 : "number density and the test function."); 25 1428 : params.addRequiredParam<UserObjectName>("study", "The PICStudy that owns the charged particles"); 26 : // These parameters are necessary when using ResidualAccumulator 27 714 : params += TaggingInterface::validParams(); 28 : // This exec flag is necessary for the ParticleQuantityResidualAccumulatorBase to contribute to 29 : // residuals 30 714 : ExecFlagEnum & exec_enum = params.set<ExecFlagEnum>("execute_on", true); 31 714 : exec_enum.addAvailableFlags(EXEC_PRE_KERNELS); 32 714 : params.set<ExecFlagEnum>("execute_on") = EXEC_PRE_KERNELS; 33 : // making this input parameter private so the user cannot use the object incorrectly 34 714 : params.suppressParameter<ExecFlagEnum>("execute_on"); 35 1428 : params.addRequiredParam<NonlinearVariableName>("variable", 36 : "The variable to contribute to the residual of"); 37 714 : return params; 38 0 : } 39 : 40 356 : ParticleQuantityResidualAccumulatorBase::ParticleQuantityResidualAccumulatorBase( 41 356 : const InputParameters & params) 42 : : GeneralUserObject(params), 43 712 : _var_name(getParam<NonlinearVariableName>("variable")), 44 356 : _study(getUserObject<PICStudyBase>("study")), 45 356 : _v_x_index(_study.getRayDataIndex("v_x")), 46 356 : _v_y_index(_study.getRayDataIndex("v_y")), 47 356 : _v_z_index(_study.getRayDataIndex("v_z")), 48 356 : _weight_index(_study.getRayDataIndex("weight")), 49 356 : _charge_index(_study.getRayDataIndex("charge")), 50 356 : _mass_index(_study.getRayDataIndex("mass")), 51 712 : _species_index(_study.getRayDataIndex("species")) 52 : { 53 356 : }