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 "ChargeDensityAccumulator.h" 17 : #include "ResidualAccumulator.h" 18 : #include "PICStudyBase.h" 19 : #include "MooseMesh.h" 20 : 21 : registerMooseObject("SalamanderApp", ChargeDensityAccumulator); 22 : 23 : InputParameters 24 630 : ChargeDensityAccumulator::validParams() 25 : { 26 630 : auto params = ParticleQuantityResidualAccumulatorBase::validParams(); 27 630 : params.addClassDescription("Accumulator used to evaluate the inner product of the particle " 28 : "charge density and the test function " 29 : "required for solving electromagnetic equations."); 30 630 : return params; 31 0 : } 32 : 33 314 : ChargeDensityAccumulator::ChargeDensityAccumulator(const InputParameters & params) 34 314 : : ParticleQuantityResidualAccumulatorBase(params) 35 : { 36 314 : } 37 : 38 : void 39 1356 : ChargeDensityAccumulator::execute() 40 : { 41 1356 : if (_fe_problem.currentlyComputingResidual()) 42 : { 43 : std::unique_ptr<SALAMANDER::AccumulatorBase> accumulator = 44 744 : std::make_unique<SALAMANDER::ResidualAccumulator>(_fe_problem, this, _var_name, 0); 45 : 46 744 : auto particles = _study.getBankedRays(); 47 : 48 178400 : for (auto & p : particles) 49 : { 50 355312 : accumulator->add( 51 177656 : *p->currentElem(), p->currentPoint(), p->data(_charge_index) * p->data(_weight_index)); 52 : } 53 : 54 744 : accumulator->finalize(); 55 744 : } 56 1356 : }