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 : #include "VariableSampler.h" 21 : 22 : class Ray; 23 : 24 : class ParticleStepperBase : public GeneralUserObject 25 : { 26 : public: 27 : ParticleStepperBase(const InputParameters & parameters); 28 : 29 : static InputParameters validParams(); 30 : /** 31 : * Unused methods 32 : */ 33 : ///@{ 34 0 : virtual void initialize() override final {} 35 0 : virtual void finalize() override final {} 36 0 : virtual void execute() override final {} 37 : ///@} 38 : 39 : /** 40 : * Method available for override to define the rules by which particles' velocity 41 : * is updated. The particles' velocity data should be updated in this function. 42 : * @param ray the ray whose velocity we want to set 43 : * @param v the current velocity of the ray and where the updated ray velocity will be stored 44 : * @param distance the distance the ray traveled before using this method 45 : */ 46 : virtual void 47 : setupStep(Ray & ray, Point & v, const Real q_m_ratio, const Real distance = 0) const = 0; 48 : 49 : protected: 50 : /** 51 : * Method for a simple dimension-dependent update of the rays max distance and 52 : * direction based on the dimension of the problem 53 : * for a 1D problem only the x value of the velocity stored ray data will be used 54 : * for a 2D problem only the x and y values of the velocity store in ray data will be used 55 : * for a 3D problem all components of the velocity will be used 56 : * @param ray the ray whose velocity is being set 57 : * @param v the new ray velocity 58 : * @param dt the time step used to set the maximum distance 59 : */ 60 : virtual void setMaxDistanceAndDirection(Ray & ray, const Point & v, const Real dt) const final; 61 : 62 : /** 63 : * Used for sampling each component of a finite element field variable 64 : * The field will be sampled at the point of the ray passed to the method 65 : * @param field_samplers the sampler utilities set up to sample each component of the force field 66 : * @param ray the current ray 67 : * @return the value of the force field at the location of the ray 68 : */ 69 : Point sampleField(const std::vector<SALAMANDER::VariableSampler> & field_samplers, 70 : const Ray & ray) const; 71 : 72 : /** 73 : * Calculates the updated velocity of a particle subject to force F that applies acceleration 74 : * to the particle in a linear fashion i.e. v_new = v_current + q/m * F * dt 75 : * @param v the current velocity of the particle 76 : * @param F the value of the field at the point the particle exists 77 : * @param q_m_ratio the charge to mass ratio of the current particle 78 : * @param dt the time step 79 : */ 80 : Point linearImpulse(const Point & v, const Point & F, const Real q_m_ratio, const Real dt) const; 81 : /// the dimension of the mesh being using used for dimension-dependent velocity updates 82 : const Real _mesh_dimension; 83 : };