LCOV - code coverage report
Current view: top level - src/raybcs - ReflectParticleBC.C (source / functions) Hit Total Coverage
Test: idaholab/salamander: 762d38 Lines: 15 16 93.8 %
Date: 2025-07-22 20:51:44 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of SALAMANDER: Software for Advanced Large-scale Analysis of MAgnetic
       2             : // confinement for Numerical Design, Engineering & Research,
       3             : //* A multiphysics application for modeling plasma facing components
       4             : //* https://github.com/idaholab/salamander
       5             : //* https://mooseframework.inl.gov/salamander
       6             : //*
       7             : //* SALAMANDER is powered by the MOOSE Framework
       8             : //* https://www.mooseframework.inl.gov
       9             : //*
      10             : //* Licensed under LGPL 2.1, please see LICENSE for details
      11             : //* https://www.gnu.org/licenses/lgpl-2.1.html
      12             : //*
      13             : //* Copyright 2025, Battelle Energy Alliance, LLC
      14             : //* ALL RIGHTS RESERVED
      15             : //*
      16             : 
      17             : #include "ReflectParticleBC.h"
      18             : #include "PICStudyBase.h"
      19             : registerMooseObject("SalamanderApp", ReflectParticleBC);
      20             : 
      21             : InputParameters
      22         144 : ReflectParticleBC::validParams()
      23             : {
      24         144 :   auto params = ReflectRayBC::validParams();
      25         144 :   params.addClassDescription(
      26             :       "Reflective boundary condition for particles that ensures velocity data is consistent with "
      27             :       "its direction after reflection.");
      28         144 :   return params;
      29           0 : }
      30             : 
      31          81 : ReflectParticleBC::ReflectParticleBC(const InputParameters & params)
      32          81 :   : ReflectRayBC(params), _velocity_indicies(getStudy<PICStudyBase>().getVelocityIndicies(false))
      33             : {
      34          81 : }
      35             : 
      36             : void
      37         176 : ReflectParticleBC::onBoundary(const unsigned int num_applying)
      38             : {
      39             :   // reflect the particle normally and then update velocity data
      40         176 :   ReflectRayBC::onBoundary(num_applying);
      41             :   // collect the components of the velocity that need to be consistent with the direction
      42         608 :   for (const auto i : index_range(_velocity_indicies))
      43         432 :     _temporary_velocity(i) = currentRay()->data(_velocity_indicies[i]);
      44             :   // compute what the velocity data should be to be consistent with direction
      45         176 :   _temporary_velocity = _temporary_velocity.norm() * currentRay()->direction();
      46             : 
      47         608 :   for (const auto i : index_range(_velocity_indicies))
      48         432 :     currentRay()->data(_velocity_indicies[i]) = _temporary_velocity(i);
      49         176 : }

Generated by: LCOV version 1.14