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 : #pragma once 17 : 18 : #include "GeneralUserObject.h" 19 : 20 : class Distribution; 21 : 22 39506 : struct InitialParticleData 23 : { 24 : /// the location where the particle will be placed 25 : Point position; 26 : /// the velocity that the particle will be given 27 : Point velocity; 28 : /// the type of physical particle this particle represents 29 : std::string species; 30 : /// the number of physical particles that this particle represents 31 : Real weight; 32 : /// the charge of the physical particle this computational particle represents 33 : Real charge; 34 : /// the mass of the physical particle this computational particle represents 35 : Real mass; 36 : /// the element that this particle will be placed into 37 : const Elem * elem; 38 : }; 39 : 40 : class ParticleInitializerBase : public GeneralUserObject 41 : { 42 : public: 43 : ParticleInitializerBase(const InputParameters & parameters); 44 : 45 : static InputParameters validParams(); 46 : 47 : /** 48 : * This method will be called by PIC studies to give them all of the data needed to create and 49 : * place particles on the finite element mesh 50 : * */ 51 : virtual std::vector<InitialParticleData> getParticleData() const = 0; 52 : 53 : /** 54 : * overridden to be able to pull the distribution objects into this class 55 : */ 56 : virtual void initialSetup() override; 57 : 58 : /** 59 : * Unused methods 60 : */ 61 : ///@{ 62 0 : virtual void initialize() override final {} 63 0 : virtual void finalize() override final {} 64 0 : virtual void execute() override final {} 65 : 66 : protected: 67 : /// the mass of the particles being created 68 : const Real _mass; 69 : /// the charge of the particles being created 70 : const Real _charge; 71 : /// the type of particle being created 72 : const std::string & _species; 73 : /// a user specified seed for changing random number generator seeds 74 : const unsigned int _seed; 75 : /// the dimension of the finite element mesh 76 : const Real _mesh_dimension; 77 : /// the distributions that will be used for set the initial particle velocities 78 : std::vector<Distribution const *> _velocity_distributions; 79 : /// Velocity distribution names 80 : const std::vector<DistributionName> & _distribution_names; 81 : };