LCOV - code coverage report
Current view: top level - include/tensor_computes - LBMBoundaryCondition.h (source / functions) Hit Total Coverage
Test: idaholab/swift: #92 (25e020) with base b3cd84 Lines: 0 1 0.0 %
Date: 2025-09-10 17:10:32 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /**********************************************************************/
       2             : /*                    DO NOT MODIFY THIS HEADER                       */
       3             : /*             Swift, a Fourier spectral solver for MOOSE             */
       4             : /*                                                                    */
       5             : /*            Copyright 2024 Battelle Energy Alliance, LLC            */
       6             : /*                        ALL RIGHTS RESERVED                         */
       7             : /**********************************************************************/
       8             : 
       9             : #pragma once
      10             : 
      11             : #include "LatticeBoltzmannOperator.h"
      12             : #include "MooseEnum.h"
      13             : 
      14             : /**
      15             :  * LBMBoundaryCondition object
      16             :  */
      17             : class LBMBoundaryCondition : public LatticeBoltzmannOperator
      18             : {
      19             : public:
      20             :   static InputParameters validParams();
      21             : 
      22             :   LBMBoundaryCondition(const InputParameters & parameters);
      23             : 
      24             :   /**
      25             :    * Conventions:
      26             :    * Left boundary is at x = 0
      27             :    * Right is at x = Nx - 1
      28             :    * Bottom is at y = 0
      29             :    * Top is at y = Ny - 1
      30             :    * Front is at z = 0
      31             :    * Back is at z = Nz - 1
      32             :    *
      33             :    * Wall boundary refers to any obstacles in the domain
      34             :    * It is entirely possible to put an obstacle at left, right, front, back, top or
      35             :    * bottom boundary and use wall boundary to replace any of them.
      36             :    */
      37             : 
      38             :   virtual void topBoundary() = 0;
      39             :   virtual void bottomBoundary() = 0;
      40             :   virtual void leftBoundary() = 0;
      41             :   virtual void rightBoundary() = 0;
      42             :   virtual void frontBoundary() = 0;
      43             :   virtual void backBoundary() = 0;
      44           0 :   virtual void wallBoundary() {};
      45             : 
      46             : #if 0
      47             :   virtual int64_t countNumberofBoundaries();
      48             :   virtual void determineBoundaryTypes();
      49             :   virtual void buildBoundaryIndices();
      50             : #endif
      51             : 
      52             :   virtual void computeBuffer() override;
      53             : 
      54             : protected:
      55             :   const std::array<int64_t, 3> _grid_size;
      56             : 
      57             :   enum class Boundary
      58             :   {
      59             :     top,
      60             :     bottom,
      61             :     left,
      62             :     right,
      63             :     front,
      64             :     back,
      65             :     wall
      66             :   } _boundary;
      67             : 
      68             :   torch::Tensor _boundary_indices;
      69             :   torch::Tensor _boundary_types;
      70             : 
      71             :   // Pre-calculated table for complex LBM boundary conditions
      72             :   const torch::Tensor _if_stream = torch::tensor(
      73             :       {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
      74             :        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
      75             :        1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1,
      76             :        1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0,
      77             :        0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
      78             :        1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      79             :        0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
      80             :        1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1,
      81             :        0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0,
      82             :        1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0,
      83             :        0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0,
      84             :        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,
      85             :        1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      86             :        1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0,
      87             :        0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0,
      88             :        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1},
      89             :       MooseTensor::intTensorOptions());
      90             : 
      91             :   const torch::Tensor _icsr = torch::tensor(
      92             :       {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
      93             :        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3,
      94             :        2, 3, 2, 2, 7, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 5, 2, 2, 8, 2, 3, 3, 2, 3, 3, 2,
      95             :        2, 5, 5, 2, 5, 5, 2, 2, 4, 4, 2, 4, 4, 2, 3, 2, 3, 3, 3, 2, 3, 3, 3, 3, 3, 9, 3, 3, 3, 2,
      96             :        2, 3, 3, 3, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 8, 4, 4, 5, 5,
      97             :        3, 3, 3, 3, 3, 3, 3, 5, 2, 3, 3, 5, 2, 4, 4, 4, 4, 4, 4, 4, 3, 5, 5, 2, 3, 3, 5, 5, 6, 9,
      98             :        2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 5,
      99             :        5, 2, 2, 5, 5, 4, 3, 4, 3, 5, 5, 5, 2, 5, 5, 5, 2, 2, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5,
     100             :        4, 4, 3, 4, 4, 7, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
     101             :        6, 2, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 6, 6, 8, 8, 9, 9, 4, 6, 6, 6, 6, 6, 6, 2, 6, 8,
     102             :        8, 5, 8, 8, 9, 9, 7, 7, 6, 7, 7, 8, 7, 9, 6, 7, 7, 9, 6, 7, 7, 7, 7, 5, 7, 7, 7, 9, 9, 6,
     103             :        7, 7, 9, 9, 3, 2, 6, 4, 7, 7, 8, 8, 3, 9, 7, 7, 7, 7, 7, 7, 7, 7, 7, 4, 7, 7, 8, 8, 7, 7,
     104             :        7, 7, 7, 7, 6, 8, 9, 6, 6, 8, 9, 8, 7, 8, 7, 4, 5, 6, 6, 8, 8, 9, 6, 6, 8, 8, 2, 5, 9, 3,
     105             :        8, 8, 8, 8, 8, 8, 8, 8, 7, 8, 8, 4, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9,
     106             :        9, 9, 9, 7, 6, 7, 6, 9, 4, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 9, 9, 2, 9, 9, 9, 9, 5, 9, 7, 7,
     107             :        6, 7, 7, 3, 6, 9, 9, 2, 9, 9, 9, 9, 8, 8, 7, 8, 8, 9},
     108             :       MooseTensor::intTensorOptions());
     109             : 
     110             :   const torch::Tensor _all_boundary_types = torch::tensor(
     111             :       {31,  55,  63,  91,  95,  119, 127, 217, 219, 221, 223, 247, 253, 255, 287, 310, 311, 319,
     112             :        347, 351, 374, 375, 79,  382, 383, 415, 436, 437, 438, 439, 445, 447, 472, 473, 475, 476,
     113             :        477, 478, 479, 496, 497, 499, 500, 501, 502, 503, 504, 505, 507, 508, 509, 510},
     114             :       MooseTensor::intTensorOptions());
     115             : 
     116             :   const torch::Tensor _x_norms = torch::tensor({0.707106781186547,
     117             :                                                 0.707106781186547,
     118             :                                                 1.0,
     119             :                                                 0.707106781186547,
     120             :                                                 0.707106781186547,
     121             :                                                 0.707106781186547,
     122             :                                                 1.0,
     123             :                                                 -0.707106781186547,
     124             :                                                 0.0,
     125             :                                                 -0.707106781186547,
     126             :                                                 0.0,
     127             :                                                 0.447213595499958,
     128             :                                                 -0.894427190999916,
     129             :                                                 0.707106781186547,
     130             :                                                 0.707106781186547,
     131             :                                                 0.707106781186547,
     132             :                                                 0.707106781186547,
     133             :                                                 1.0,
     134             :                                                 0.707106781186547,
     135             :                                                 0.707106781186547,
     136             :                                                 0.707106781186547,
     137             :                                                 0.707106781186547,
     138             :                                                 0.894427190999916,
     139             :                                                 0.894427190999916,
     140             :                                                 1.0,
     141             :                                                 0.447213595499958,
     142             :                                                 -0.707106781186547,
     143             :                                                 -0.707106781186547,
     144             :                                                 0.0,
     145             :                                                 0.0,
     146             :                                                 -0.894427190999916,
     147             :                                                 0.707106781186547,
     148             :                                                 -0.707106781186547,
     149             :                                                 -0.707106781186547,
     150             :                                                 0.0,
     151             :                                                 -0.707106781186547,
     152             :                                                 -0.707106781186547,
     153             :                                                 -0.447213595499958,
     154             :                                                 0.0,
     155             :                                                 -0.707106781186547,
     156             :                                                 -0.707106781186547,
     157             :                                                 -0.447213595499958,
     158             :                                                 -0.707106781186547,
     159             :                                                 -0.707106781186547,
     160             :                                                 0.0,
     161             :                                                 0.0,
     162             :                                                 -1.0,
     163             :                                                 -1.0,
     164             :                                                 -0.707106781186547,
     165             :                                                 -1.0,
     166             :                                                 -1.0,
     167             :                                                 -0.707106781186547},
     168             :                                                MooseTensor::floatTensorOptions());
     169             : 
     170             :   const torch::Tensor _y_norms = torch::tensor({0.707106781186547,
     171             :                                                 -0.707106781186547,
     172             :                                                 0.0,
     173             :                                                 0.707106781186547,
     174             :                                                 0.707106781186547,
     175             :                                                 -0.707106781186547,
     176             :                                                 0.0,
     177             :                                                 0.707106781186547,
     178             :                                                 1.0,
     179             :                                                 0.707106781186547,
     180             :                                                 1.0,
     181             :                                                 -0.894427190999916,
     182             :                                                 0.447213595499958,
     183             :                                                 0.707106781186547,
     184             :                                                 0.707106781186547,
     185             :                                                 -0.707106781186547,
     186             :                                                 -0.707106781186547,
     187             :                                                 0.0,
     188             :                                                 0.707106781186547,
     189             :                                                 0.707106781186547,
     190             :                                                 -0.707106781186547,
     191             :                                                 -0.707106781186547,
     192             :                                                 0.447213595499958,
     193             :                                                 -0.447213595499958,
     194             :                                                 0.0,
     195             :                                                 0.894427190999916,
     196             :                                                 -0.707106781186547,
     197             :                                                 -0.707106781186547,
     198             :                                                 -1.0,
     199             :                                                 -1.0,
     200             :                                                 -0.447213595499958,
     201             :                                                 -0.707106781186547,
     202             :                                                 0.707106781186547,
     203             :                                                 0.707106781186547,
     204             :                                                 1.0,
     205             :                                                 0.707106781186547,
     206             :                                                 0.707106781186547,
     207             :                                                 0.894427190999916,
     208             :                                                 1.0,
     209             :                                                 -0.707106781186547,
     210             :                                                 -0.707106781186547,
     211             :                                                 -0.894427190999916,
     212             :                                                 -0.707106781186547,
     213             :                                                 -0.707106781186547,
     214             :                                                 -1.0,
     215             :                                                 -1.0,
     216             :                                                 0.0,
     217             :                                                 0.0,
     218             :                                                 0.707106781186547,
     219             :                                                 0.0,
     220             :                                                 0.0,
     221             :                                                 -0.707106781186547},
     222             :                                                MooseTensor::floatTensorOptions());
     223             : };

Generated by: LCOV version 1.14