GEOS
SurfaceElementStencil.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 TotalEnergies
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_FINITEVOLUME_SURFACEELEMENTSTENCIL_HPP_
21 #define GEOS_FINITEVOLUME_SURFACEELEMENTSTENCIL_HPP_
22 
23 #include "StencilBase.hpp"
24 
25 namespace geos
26 {
27 
35 
39 class SurfaceElementStencilWrapper : public StencilWrapperBase< SurfaceElementStencilTraits >
40 {
41 public:
42 
44  static constexpr real64 MULTIPLIER_THRESHOLD = 1e-10;
45 
47  template< typename VIEWTYPE >
49 
59  SurfaceElementStencilWrapper( IndexContainerType const & elementRegionIndices,
60  IndexContainerType const & elementSubRegionIndices,
61  IndexContainerType const & elementIndices,
62  WeightContainerType const & weights,
63  ArrayOfArrays< R1Tensor > const & cellCenterToEdgeCenters,
64  real64 const meanPermCoefficient );
65 
72  localIndex size() const
73  { return m_elementRegionIndices.size(); }
74 
83  { return m_elementRegionIndices.sizeOfArray( index ); }
84 
85 
94  {
95  return stencilSize( index );
96  }
97 
107  void computeWeights( localIndex iconn,
108  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient,
109  CoefficientAccessor< arrayView3d< real64 const > > const & dCoeff_dVar,
110  real64 ( &weight )[maxNumConnections][2],
111  real64 ( &dWeight_dVar )[maxNumConnections][2] ) const;
112 
122  void computeWeights( localIndex iconn,
123  real64 ( &weight )[maxNumConnections][2],
124  real64 ( &dWeight_dVar )[maxNumConnections][2] ) const;
125 
126 
138  void computeWeights( localIndex iconn,
139  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient,
140  CoefficientAccessor< arrayView3d< real64 const > > const & dCoeff_dVar1,
141  CoefficientAccessor< arrayView4d< real64 const > > const & dCoeff_dVar2,
142  real64 ( &weight )[maxNumConnections][2],
143  real64 ( &dWeight_dVar1 )[maxNumConnections][2],
144  real64 ( &dWeight_dVar2 )[maxNumConnections][2][3] ) const;
145 
155  void computeWeights( localIndex iconn,
156  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient,
157  CoefficientAccessor< arrayView3d< real64 const > > const & coefficientMultiplier,
158  R1Tensor const & gravityVector,
159  real64 ( &weight )[maxNumConnections][2] ) const;
160 
173  void computeWeights( localIndex iconn,
174  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient1,
175  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient1Multiplier,
176  CoefficientAccessor< arrayView1d< real64 const > > const & coefficient2,
177  R1Tensor const & gravityVector,
178  real64 ( &weight1 )[maxNumPointsInFlux],
179  real64 ( &weight2 )[maxNumPointsInFlux],
180  real64 ( &geometricWeight )[maxNumPointsInFlux] ) const;
181 
189  real64 ( & stabilizationWeight )[maxNumConnections][2] ) const
190  { GEOS_UNUSED_VAR( iconn, stabilizationWeight ); }
191 
197  { return m_cellCenterToEdgeCenters.toViewConst(); }
198 
207 
216 
217 private:
218 
220  ArrayOfArraysView< R1Tensor > m_cellCenterToEdgeCenters;
221 
223  real64 m_meanPermCoefficient;
224 };
225 
229 class SurfaceElementStencil final : public StencilBase< SurfaceElementStencilTraits, SurfaceElementStencil >
230 {
231 public:
232 
233  virtual void move( LvArray::MemorySpace const space ) override;
234 
235  virtual void add( localIndex const numPts,
236  localIndex const * const elementRegionIndices,
237  localIndex const * const elementSubRegionIndices,
238  localIndex const * const elementIndices,
239  real64 const * const weights,
240  localIndex const connectorIndex ) override;
241 
248  void add( localIndex const numPts,
249  R1Tensor const * const cellCenterToEdgeCenter,
250  localIndex const connectorIndex );
251 
252 
255 
261 
266  virtual localIndex size() const override
267  { return m_elementRegionIndices.size(); }
268 
275  { return m_elementRegionIndices.sizeOfArray( index ); }
276 
282  { return m_cellCenterToEdgeCenters.toViewConst(); }
283 
288  void setMeanPermCoefficient( real64 const & meanPermCoefficient )
289  {
290  m_meanPermCoefficient = meanPermCoefficient;
291  }
292 
293 private:
294 
296  ArrayOfArrays< R1Tensor > m_cellCenterToEdgeCenters;
297 
299  real64 m_meanPermCoefficient = 1.0;
300 
301 };
302 
304 inline void
307  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient,
308  CoefficientAccessor< arrayView3d< real64 const > > const & dCoeff_dVar,
309  real64 ( & weight )[maxNumConnections][2],
310  real64 ( & dWeight_dVar )[maxNumConnections][2] ) const
311 {
312 
313  real64 sumOfTrans = 0.0;
314  for( localIndex k=0; k<numPointsInFlux( iconn ); ++k )
315  {
316  localIndex const er = m_elementRegionIndices[iconn][k];
317  localIndex const esr = m_elementSubRegionIndices[iconn][k];
318  localIndex const ei = m_elementIndices[iconn][k];
319 
320  sumOfTrans += coefficient[er][esr][ei][0][0] * m_weights[iconn][k];
321  }
322 
323  localIndex k[2];
324  localIndex connectionIndex = 0;
325  for( k[0]=0; k[0]<numPointsInFlux( iconn ); ++k[0] )
326  {
327  for( k[1]=k[0]+1; k[1]<numPointsInFlux( iconn ); ++k[1] )
328  {
329  localIndex const er0 = m_elementRegionIndices[iconn][k[0]];
330  localIndex const esr0 = m_elementSubRegionIndices[iconn][k[0]];
331  localIndex const ei0 = m_elementIndices[iconn][k[0]];
332 
333  localIndex const er1 = m_elementRegionIndices[iconn][k[1]];
334  localIndex const esr1 = m_elementSubRegionIndices[iconn][k[1]];
335  localIndex const ei1 = m_elementIndices[iconn][k[1]];
336 
337  real64 const t0 = m_weights[iconn][0] * coefficient[er0][esr0][ei0][0][0]; // this is a bit insane to access perm
338  real64 const t1 = m_weights[iconn][1] * coefficient[er1][esr1][ei1][0][0];
339 
340  real64 const harmonicWeight = t0*t1 / sumOfTrans;
341  real64 const arithmeticWeight = 0.25 * (t0+t1);
342 
343  real64 const value = m_meanPermCoefficient * harmonicWeight + (1 - m_meanPermCoefficient) * arithmeticWeight;
344 
345  weight[connectionIndex][0] = value;
346  weight[connectionIndex][1] = -value;
347 
348  real64 const dt0 = m_weights[iconn][0] * dCoeff_dVar[er0][esr0][ei0][0][0];
349  real64 const dt1 = m_weights[iconn][1] * dCoeff_dVar[er1][esr1][ei1][0][0];
350 
351  real64 dHarmonic[2];
352  dHarmonic[0] = ( dt0 * t1 * sumOfTrans - dt0 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
353  dHarmonic[1] = ( t0 * dt1 * sumOfTrans - dt1 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
354 
355  real64 dArithmetic[2];
356  dArithmetic[0] = 0.25 * dt0;
357  dArithmetic[1] = 0.25 * dt1;
358 
359  dWeight_dVar[connectionIndex][0] = m_meanPermCoefficient * dHarmonic[0] + (1 - m_meanPermCoefficient) * dArithmetic[0];
360  dWeight_dVar[connectionIndex][1] = -( m_meanPermCoefficient * dHarmonic[1] + (1 - m_meanPermCoefficient) * dArithmetic[1] );
361 
362  connectionIndex++;
363  }
364  }
365 }
366 
368 inline void
371  real64 ( & weight )[maxNumConnections][2],
372  real64 ( & dWeight_dVar )[maxNumConnections][2] ) const
373 {
374 
375  real64 sumOfTrans = 0.0;
376  for( localIndex k=0; k<numPointsInFlux( iconn ); ++k )
377  {
378  sumOfTrans += m_weights[iconn][k];
379  }
380 
381  localIndex k[2];
382  localIndex connectionIndex = 0;
383  for( k[0]=0; k[0]<numPointsInFlux( iconn ); ++k[0] )
384  {
385  for( k[1]=k[0]+1; k[1]<numPointsInFlux( iconn ); ++k[1] )
386  {
387  real64 const t0 = m_weights[iconn][0];
388  real64 const t1 = m_weights[iconn][1];
389 
390  real64 const harmonicWeight = t0*t1 / sumOfTrans;
391  real64 const arithmeticWeight = 0.25 * (t0+t1);
392 
393  real64 const value = m_meanPermCoefficient * harmonicWeight + (1 - m_meanPermCoefficient) * arithmeticWeight;
394 
395  weight[connectionIndex][0] = value;
396  weight[connectionIndex][1] = -value;
397 
398  real64 const dt0 = m_weights[iconn][0];
399  real64 const dt1 = m_weights[iconn][1];
400 
401  real64 dHarmonic[2];
402  dHarmonic[0] = ( dt0 * t1 * sumOfTrans - dt0 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
403  dHarmonic[1] = ( t0 * dt1 * sumOfTrans - dt1 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
404 
405  real64 dArithmetic[2];
406  dArithmetic[0] = 0.25 * dt0;
407  dArithmetic[1] = 0.25 * dt1;
408 
409  dWeight_dVar[connectionIndex][0] = m_meanPermCoefficient * dHarmonic[0] + (1 - m_meanPermCoefficient) * dArithmetic[0];
410  dWeight_dVar[connectionIndex][1] = -( m_meanPermCoefficient * dHarmonic[1] + (1 - m_meanPermCoefficient) * dArithmetic[1] );
411 
412  connectionIndex++;
413  }
414  }
415 }
416 
417 
418 
420 inline void
423  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient,
424  CoefficientAccessor< arrayView3d< real64 const > > const & dCoeff_dVar1,
425  CoefficientAccessor< arrayView4d< real64 const > > const & dCoeff_dVar2,
426  real64 (& weight)[maxNumConnections][2],
427  real64 (& dWeight_dVar1 )[maxNumConnections][2],
428  real64 (& dWeight_dVar2 )[maxNumConnections][2][3] ) const
429 {
430  real64 sumOfTrans = 0.0;
431  for( localIndex k=0; k<numPointsInFlux( iconn ); ++k )
432  {
433  localIndex const er = m_elementRegionIndices[iconn][k];
434  localIndex const esr = m_elementSubRegionIndices[iconn][k];
435  localIndex const ei = m_elementIndices[iconn][k];
436 
437  sumOfTrans += coefficient[er][esr][ei][0][0] * m_weights[iconn][k];
438  }
439 
440  localIndex k[2];
441  localIndex connectionIndex = 0;
442  for( k[0]=0; k[0]<numPointsInFlux( iconn ); ++k[0] )
443  {
444  for( k[1]=k[0]+1; k[1]<numPointsInFlux( iconn ); ++k[1] )
445  {
446  localIndex const er0 = m_elementRegionIndices[iconn][k[0]];
447  localIndex const esr0 = m_elementSubRegionIndices[iconn][k[0]];
448  localIndex const ei0 = m_elementIndices[iconn][k[0]];
449 
450  localIndex const er1 = m_elementRegionIndices[iconn][k[1]];
451  localIndex const esr1 = m_elementSubRegionIndices[iconn][k[1]];
452  localIndex const ei1 = m_elementIndices[iconn][k[1]];
453 
454  real64 const t0 = m_weights[iconn][0] * coefficient[er0][esr0][ei0][0][0]; // this is a bit insane to access perm
455  real64 const t1 = m_weights[iconn][1] * coefficient[er1][esr1][ei1][0][0];
456 
457  real64 const harmonicWeight = t0*t1 / sumOfTrans;
458  real64 const arithmeticWeight = 0.25 * (t0+t1);
459 
460  real64 const value = m_meanPermCoefficient * harmonicWeight + (1 - m_meanPermCoefficient) * arithmeticWeight;
461 
462  weight[connectionIndex][0] = value;
463  weight[connectionIndex][1] = -value;
464 
465  real64 const dt0_dvar1 = m_weights[iconn][0] * dCoeff_dVar1[er0][esr0][ei0][0][0];
466  real64 const dt1_dvar1 = m_weights[iconn][1] * dCoeff_dVar1[er1][esr1][ei1][0][0];
467 
468  real64 dHarmonic_dvar1[2];
469  dHarmonic_dvar1[0] = ( dt0_dvar1 * t1 * sumOfTrans - dt0_dvar1 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
470  dHarmonic_dvar1[1] = ( dt0_dvar1 * t1 * sumOfTrans - dt0_dvar1 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
471 
472  real64 dArithmetic_dvar1[2];
473  dArithmetic_dvar1[0] = 0.25 * dt0_dvar1;
474  dArithmetic_dvar1[1] = 0.25 * dt1_dvar1;
475 
476  dWeight_dVar1[connectionIndex][0] = m_meanPermCoefficient * dHarmonic_dvar1[0] + (1 - m_meanPermCoefficient) * dArithmetic_dvar1[0];
477  dWeight_dVar1[connectionIndex][1] = -( m_meanPermCoefficient * dHarmonic_dvar1[1] + (1 - m_meanPermCoefficient) * dArithmetic_dvar1[1] );
478 
479  real64 const dt0_dvar2 = m_weights[iconn][0] * dCoeff_dVar2[er0][esr0][ei0][0][0][0];
480  real64 const dt1_dvar2 = m_weights[iconn][1] * dCoeff_dVar2[er1][esr1][ei1][0][0][0];
481 
482  real64 dHarmonic_dvar2[2];
483  dHarmonic_dvar2[0] = ( dt0_dvar2 * t1 * sumOfTrans - dt0_dvar2 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
484  dHarmonic_dvar2[1] = ( t0 * dt1_dvar2 * sumOfTrans - dt1_dvar2 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
485 
486  real64 dArithmetic_dvar2[2];
487  dArithmetic_dvar2[0] = 0.25 * dt0_dvar2;
488  dArithmetic_dvar2[1] = 0.25 * dt1_dvar2;
489 
490  dWeight_dVar2[connectionIndex][0][0] = ( m_meanPermCoefficient * dHarmonic_dvar2[0] + (1 - m_meanPermCoefficient) * dArithmetic_dvar2[0] );
491  dWeight_dVar2[connectionIndex][1][0] = -( m_meanPermCoefficient * dHarmonic_dvar2[1] + (1 - m_meanPermCoefficient) * dArithmetic_dvar2[1] );
492 
493  connectionIndex++;
494  }
495  }
496 }
497 
499 inline void
502  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient,
503  CoefficientAccessor< arrayView3d< real64 const > > const & coefficientMultiplier,
504  R1Tensor const & gravityVector,
505  real64 (& weight)[maxNumConnections][2] ) const
506 {
507  // TODO: this should become star-delta method
508  real64 sumOfTrans = 0.0;
509  for( localIndex k=0; k<numPointsInFlux( iconn ); ++k )
510  {
511  localIndex const er = m_elementRegionIndices[iconn][k];
512  localIndex const esr = m_elementSubRegionIndices[iconn][k];
513  localIndex const ei = m_elementIndices[iconn][k];
514 
515  real64 const mult = ( LvArray::math::abs( LvArray::tensorOps::AiBi< 3 >( m_cellCenterToEdgeCenters[iconn][k], gravityVector ) ) > MULTIPLIER_THRESHOLD )
516  ? coefficientMultiplier[er][esr][ei][0][1] : coefficientMultiplier[er][esr][ei][0][0];
517 
518  sumOfTrans += mult * coefficient[er][esr][ei][0][0] * m_weights[iconn][k];
519  }
520 
521 
522  localIndex k[2];
523  localIndex connectionIndex = 0;
524  for( k[0]=0; k[0]<numPointsInFlux( iconn ); ++k[0] )
525  {
526  for( k[1]=k[0]+1; k[1]<numPointsInFlux( iconn ); ++k[1] )
527  {
528  localIndex const er0 = m_elementRegionIndices[iconn][k[0]];
529  localIndex const esr0 = m_elementSubRegionIndices[iconn][k[0]];
530  localIndex const ei0 = m_elementIndices[iconn][k[0]];
531 
532  localIndex const er1 = m_elementRegionIndices[iconn][k[1]];
533  localIndex const esr1 = m_elementSubRegionIndices[iconn][k[1]];
534  localIndex const ei1 = m_elementIndices[iconn][k[1]];
535 
536  real64 const mult0 = ( LvArray::math::abs( LvArray::tensorOps::AiBi< 3 >( m_cellCenterToEdgeCenters[iconn][k[0]], gravityVector ) ) > MULTIPLIER_THRESHOLD )
537  ? coefficientMultiplier[er0][esr0][ei0][0][1] : coefficientMultiplier[er0][esr0][ei0][0][0];
538  real64 const mult1 = ( LvArray::math::abs( LvArray::tensorOps::AiBi< 3 >( m_cellCenterToEdgeCenters[iconn][k[1]], gravityVector ) ) > MULTIPLIER_THRESHOLD )
539  ? coefficientMultiplier[er1][esr1][ei1][0][1] : coefficientMultiplier[er1][esr1][ei1][0][0];
540 
541  real64 const t0 = mult0 * m_weights[iconn][0] * coefficient[er0][esr0][ei0][0][0];
542  real64 const t1 = mult1 * m_weights[iconn][1] * coefficient[er1][esr1][ei1][0][0];
543 
544  real64 const harmonicWeight = t0*t1 / sumOfTrans;
545  real64 const arithmeticWeight = 0.25 * (t0+t1);
546 
547  real64 const value = m_meanPermCoefficient * harmonicWeight + (1 - m_meanPermCoefficient) * arithmeticWeight;
548 
549  weight[connectionIndex][0] = value;
550  weight[connectionIndex][1] = -value;
551 
552  connectionIndex++;
553  }
554  }
555 }
556 
558 inline void
561  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient1,
562  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient1Multiplier,
563  CoefficientAccessor< arrayView1d< real64 const > > const & coefficient2,
564  R1Tensor const & unitGravityVector,
565  real64 ( & weight1 )[maxNumPointsInFlux],
566  real64 ( & weight2 )[maxNumPointsInFlux],
567  real64 ( & geometricWeight )[maxNumPointsInFlux] ) const
568 {
569  real64 sumOfGeometricWeights = 0.0;
570 
571  for( localIndex k = 0; k < numPointsInFlux( iconn ); ++k )
572  {
573  localIndex const er = m_elementRegionIndices[iconn][k];
574  localIndex const esr = m_elementSubRegionIndices[iconn][k];
575  localIndex const ei = m_elementIndices[iconn][k];
576 
577  real64 const cellToEdgeDistance = LvArray::tensorOps::l2Norm< 3 >( m_cellCenterToEdgeCenters[iconn][k] );
578  real64 const edgeLength = m_weights[iconn][k] * cellToEdgeDistance;
579  real64 const edgeToFaceDownDistance = -LvArray::tensorOps::AiBi< 3 >( m_cellCenterToEdgeCenters[iconn][k], unitGravityVector )
580  * edgeLength / cellToEdgeDistance;
581 
582  real64 const mult = ( LvArray::math::abs( edgeToFaceDownDistance ) > MULTIPLIER_THRESHOLD )
583  ? coefficient1Multiplier[er][esr][ei][0][1] : coefficient1Multiplier[er][esr][ei][0][0];
584 
585  weight1[k] = mult * coefficient1[er][esr][ei][0][0] * m_weights[iconn][k];
586  weight2[k] = coefficient2[er][esr][ei] * edgeToFaceDownDistance;
587 
588  geometricWeight[k] = m_weights[iconn][k] / 12.0;
589  sumOfGeometricWeights += geometricWeight[k];
590  }
591 
592  for( localIndex k = 0; k < numPointsInFlux( iconn ); ++k )
593  {
594  geometricWeight[k] /= sumOfGeometricWeights;
595  }
596 }
597 
599 inline void
602 {
603  for( localIndex k = 0; k < stencilSize( iconn ); ++k )
604  {
605  localIndex const er = m_elementRegionIndices[iconn][k];
606  localIndex const esr = m_elementSubRegionIndices[iconn][k];
607  localIndex const ei = m_elementIndices[iconn][k];
608 
609  m_weights[iconn][k] = m_weights[iconn][k] / hydraulicAperture[er][esr][ei];
610  }
611 }
612 
614 inline void
617 {
618  for( localIndex k = 0; k < stencilSize( iconn ); ++k )
619  {
620  localIndex const er = m_elementRegionIndices[iconn][k];
621  localIndex const esr = m_elementSubRegionIndices[iconn][k];
622  localIndex const ei = m_elementIndices[iconn][k];
623 
624  m_weights[iconn][k] = m_weights[iconn][k] * hydraulicAperture[er][esr][ei];
625  }
626 }
627 
628 } /* namespace geos */
629 
630 #endif /* GEOS_FINITEVOLUME_SURFACEELEMENTSTENCIL_HPP_ */
#define GEOS_HOST_DEVICE
Marks a host-device function.
Definition: GeosxMacros.hpp:49
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
Definition: GeosxMacros.hpp:84
#define GEOS_FORCE_INLINE
Marks a function or lambda for inlining.
Definition: GeosxMacros.hpp:51
typename ElementViewAccessor< VIEWTYPE >::NestedViewTypeConst ElementViewConst
The ElementViewAccessor at the ElementRegionManager level is the type resulting from ElementViewAcces...
Provides management of the interior stencil points when using Two-Point flux approximation.
TRAITS::IndexContainerType m_elementRegionIndices
The container for the element region indices for each point in each stencil.
TRAITS::IndexContainerViewConstType m_elementRegionIndices
The container for the element region indices for each point in each stencil.
TRAITS::IndexContainerViewConstType m_elementSubRegionIndices
The container for the element sub region indices for each point in each stencil.
TRAITS::WeightContainerViewType m_weights
The container for the weights for each point in each stencil.
TRAITS::IndexContainerViewConstType m_elementIndices
The container for the element indices for each point in each stencil.
Provides management of the interior stencil points for a face elements when using Two-Point flux appr...
KernelWrapper createKernelWrapper() const
Create an update kernel wrapper.
virtual localIndex size() const override
Return the stencil size.
void add(localIndex const numPts, R1Tensor const *const cellCenterToEdgeCenter, localIndex const connectorIndex)
Add an entry to the stencil.
void setMeanPermCoefficient(real64 const &meanPermCoefficient)
sets the value of the mean perm conefficient
localIndex stencilSize(localIndex index) const
Give the number of stencil entries for the provided index.
virtual void move(LvArray::MemorySpace const space) override
Move the data arrays associated with the stencil to a specified memory space.
ArrayOfArraysView< R1Tensor const > getCellCenterToEdgeCenters() const
Give the array of vectors pointing from the cell center to the edge center.
virtual void add(localIndex const numPts, localIndex const *const elementRegionIndices, localIndex const *const elementSubRegionIndices, localIndex const *const elementIndices, real64 const *const weights, localIndex const connectorIndex) override
Add an entry to the stencil.
Provides access to the SurfaceElementStencil that may be called from a kernel function.
GEOS_HOST_DEVICE void computeStabilizationWeights(localIndex iconn, real64(&stabilizationWeight)[maxNumConnections][2]) const
Compute the stabilization weights.
GEOS_HOST_DEVICE GEOS_FORCE_INLINE localIndex size() const
Give the number of stencil entries.
ElementRegionManager::ElementViewConst< VIEWTYPE > CoefficientAccessor
Coefficient view accessory type.
GEOS_HOST_DEVICE GEOS_FORCE_INLINE localIndex stencilSize(localIndex index) const
Give the number of stencil entries for the provided index.
GEOS_HOST_DEVICE void addHydraulicApertureContribution(localIndex const iconn, ElementRegionManager::ElementViewConst< arrayView1d< real64 const > > hydraulicAperture) const
Add the contribution of the aperture to the weight in the stencil (done after aperture update)
static constexpr real64 MULTIPLIER_THRESHOLD
Threshold for the application of the permeability multiplier.
ArrayOfArraysView< R1Tensor const > getCellCenterToEdgeCenters() const
Accessor to the CellCenterToEdgeCenter vector.
GEOS_HOST_DEVICE void computeWeights(localIndex iconn, CoefficientAccessor< arrayView3d< real64 const > > const &coefficient, CoefficientAccessor< arrayView3d< real64 const > > const &dCoeff_dVar, real64(&weight)[maxNumConnections][2], real64(&dWeight_dVar)[maxNumConnections][2]) const
Compute weights and derivatives w.r.t to one variable.
GEOS_HOST_DEVICE GEOS_FORCE_INLINE localIndex numPointsInFlux(localIndex index) const
Give the number of points between which the flux is.
SurfaceElementStencilWrapper(IndexContainerType const &elementRegionIndices, IndexContainerType const &elementSubRegionIndices, IndexContainerType const &elementIndices, WeightContainerType const &weights, ArrayOfArrays< R1Tensor > const &cellCenterToEdgeCenters, real64 const meanPermCoefficient)
Constructor.
GEOS_HOST_DEVICE void removeHydraulicApertureContribution(localIndex const iconn, ElementRegionManager::ElementViewConst< arrayView1d< real64 const > > hydraulicAperture) const
Remove the contribution of the aperture from the weight in the stencil (done before aperture update)
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
LvArray::ArrayOfArraysView< T, INDEX_TYPE const, CONST_SIZES, LvArray::ChaiBuffer > ArrayOfArraysView
View of array of variable-sized arrays. See LvArray::ArrayOfArraysView for details.
Definition: DataTypes.hpp:286
double real64
64-bit floating point type.
Definition: DataTypes.hpp:99
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:85
ArrayView< T, 4, USD > arrayView4d
Alias for 4D array view.
Definition: DataTypes.hpp:228
LvArray::ArrayOfArrays< T, INDEX_TYPE, LvArray::ChaiBuffer > ArrayOfArrays
Array of variable-sized arrays. See LvArray::ArrayOfArrays for details.
Definition: DataTypes.hpp:282
ArrayView< T, 3, USD > arrayView3d
Alias for 3D array view.
Definition: DataTypes.hpp:212
A collection of properties of a stencil type.
Definition: StencilBase.hpp:42
CONTAINER< localIndex > IndexContainerType
The array type that will be used to store the indices of the stencil contributors.
Definition: StencilBase.hpp:44
CONTAINER< real64 > WeightContainerType
The array type that is used to store the weights of the stencil contributors.
Definition: StencilBase.hpp:50
static constexpr localIndex maxNumPointsInFlux
Maximum number of points the flux.
Definition: StencilBase.hpp:59
static constexpr localIndex maxNumConnections
Maximum number of connections in a stencil.
Definition: StencilBase.hpp:65