LCOV - code coverage report
Current view: top level - include/bcs - GaussianEnergyFluxBC.h (source / functions) Hit Total Coverage
Test: idaholab/moose heat_transfer: #31405 (292dce) with base fef103 Lines: 7 7 100.0 %
Date: 2025-09-04 07:53:51 Functions: 2 4 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #pragma once
      11             : 
      12             : #include "ADIntegratedBC.h"
      13             : 
      14             : /**
      15             :  * Describes an incoming heat flux beam with a Gaussian profile. Form is taken from
      16             :  * https://en.wikipedia.org/wiki/Gaussian_beam
      17             :  */
      18             : class GaussianEnergyFluxBC : public ADIntegratedBC
      19             : {
      20             : public:
      21             :   static InputParameters validParams();
      22             :   static InputParameters beamParams();
      23             : 
      24             :   GaussianEnergyFluxBC(const InputParameters & params);
      25             : 
      26             :   /**
      27             :    * Computes the beam flux given data from a flux object and the current integration point in the
      28             :    * domain, e.g. the location of a quadrature point in physical space for a finite element flux
      29             :    * object or the location of a face center for a finite volume flux object. The flux object should
      30             :    * have _x_beam_coord, _y_beam_coord, _z_beam_coord, _t, _P0, and _R data members
      31             :    */
      32             :   template <typename T, typename PointType>
      33             :   static ADReal beamFlux(const T & flux_obj, const PointType & flux_obj_location);
      34             : 
      35             : protected:
      36             :   virtual ADReal computeQpResidual() override;
      37             : 
      38             :   /// the total power of the beam
      39             :   const Real _P0;
      40             :   /// beam radius, specifically the radius at which the beam intensity falls to $1/e^2$ of its axial
      41             :   /// value
      42             :   const Real _R;
      43             :   /// the x-coordinate of the beam center
      44             :   const Function & _x_beam_coord;
      45             :   /// the y-coordinate of the beam center
      46             :   const Function & _y_beam_coord;
      47             :   /// the z-coordiinate of the beam center
      48             :   const Function & _z_beam_coord;
      49             : };
      50             : 
      51             : template <typename T, typename PointType>
      52             : ADReal
      53       15840 : GaussianEnergyFluxBC::beamFlux(const T & flux_obj, const PointType & flux_obj_location)
      54             : {
      55             :   const Point origin(0, 0, 0);
      56       15840 :   const RealVectorValue beam_coords{flux_obj._x_beam_coord.value(flux_obj._t, origin),
      57       15840 :                                     flux_obj._y_beam_coord.value(flux_obj._t, origin),
      58       15840 :                                     flux_obj._z_beam_coord.value(flux_obj._t, origin)};
      59       15840 :   const auto r = (flux_obj_location - beam_coords).norm();
      60       15840 :   const auto R2 = flux_obj._R * flux_obj._R;
      61       31680 :   return -2 * flux_obj._P0 / (libMesh::pi * R2) * std::exp(-2 * r * r / R2);
      62             : }

Generated by: LCOV version 1.14