GEOSX
SurfaceElementStencil.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2020 TotalEnergies
8  * Copyright (c) 2019- GEOSX Contributors
9  * All rights reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
19 #ifndef GEOS_FINITEVOLUME_SURFACEELEMENTSTENCIL_HPP_
20 #define GEOS_FINITEVOLUME_SURFACEELEMENTSTENCIL_HPP_
21 
22 #include "StencilBase.hpp"
23 
24 namespace geos
25 {
26 
34 
38 class SurfaceElementStencilWrapper : public StencilWrapperBase< SurfaceElementStencilTraits >
39 {
40 public:
41 
43  static constexpr real64 MULTIPLIER_THRESHOLD = 1e-10;
44 
46  template< typename VIEWTYPE >
48 
58  SurfaceElementStencilWrapper( IndexContainerType const & elementRegionIndices,
59  IndexContainerType const & elementSubRegionIndices,
60  IndexContainerType const & elementIndices,
61  WeightContainerType const & weights,
62  ArrayOfArrays< R1Tensor > const & cellCenterToEdgeCenters,
63  real64 const meanPermCoefficient );
64 
71  localIndex size() const
72  { return m_elementRegionIndices.size(); }
73 
82  { return m_elementRegionIndices.sizeOfArray( index ); }
83 
84 
93  {
94  return stencilSize( index );
95  }
96 
106  void computeWeights( localIndex iconn,
107  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient,
108  CoefficientAccessor< arrayView3d< real64 const > > const & dCoeff_dVar,
109  real64 ( &weight )[maxNumConnections][2],
110  real64 ( &dWeight_dVar )[maxNumConnections][2] ) const;
111 
121  void computeWeights( localIndex iconn,
122  real64 ( &weight )[maxNumConnections][2],
123  real64 ( &dWeight_dVar )[maxNumConnections][2] ) const;
124 
125 
137  void computeWeights( localIndex iconn,
138  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient,
139  CoefficientAccessor< arrayView3d< real64 const > > const & dCoeff_dVar1,
140  CoefficientAccessor< arrayView4d< real64 const > > const & dCoeff_dVar2,
141  real64 ( &weight )[maxNumConnections][2],
142  real64 ( &dWeight_dVar1 )[maxNumConnections][2],
143  real64 ( &dWeight_dVar2 )[maxNumConnections][2][3] ) const;
144 
154  void computeWeights( localIndex iconn,
155  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient,
156  CoefficientAccessor< arrayView3d< real64 const > > const & coefficientMultiplier,
157  R1Tensor const & gravityVector,
158  real64 ( &weight )[maxNumConnections][2] ) const;
159 
172  void computeWeights( localIndex iconn,
173  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient1,
174  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient1Multiplier,
175  CoefficientAccessor< arrayView1d< real64 const > > const & coefficient2,
176  R1Tensor const & gravityVector,
177  real64 ( &weight1 )[maxNumPointsInFlux],
178  real64 ( &weight2 )[maxNumPointsInFlux],
179  real64 ( &geometricWeight )[maxNumPointsInFlux] ) const;
180 
188  real64 ( & stabilizationWeight )[maxNumConnections][2] ) const
189  { GEOS_UNUSED_VAR( iconn, stabilizationWeight ); }
190 
196  { return m_cellCenterToEdgeCenters.toViewConst(); }
197 
206 
215 
216 private:
217 
219  ArrayOfArraysView< R1Tensor > m_cellCenterToEdgeCenters;
220 
222  real64 m_meanPermCoefficient;
223 };
224 
228 class SurfaceElementStencil final : public StencilBase< SurfaceElementStencilTraits, SurfaceElementStencil >
229 {
230 public:
231 
232  virtual void move( LvArray::MemorySpace const space ) override;
233 
234  virtual void add( localIndex const numPts,
235  localIndex const * const elementRegionIndices,
236  localIndex const * const elementSubRegionIndices,
237  localIndex const * const elementIndices,
238  real64 const * const weights,
239  localIndex const connectorIndex ) override;
240 
247  void add( localIndex const numPts,
248  R1Tensor const * const cellCenterToEdgeCenter,
249  localIndex const connectorIndex );
250 
251 
254 
260 
265  virtual localIndex size() const override
266  { return m_elementRegionIndices.size(); }
267 
274  { return m_elementRegionIndices.sizeOfArray( index ); }
275 
281  { return m_cellCenterToEdgeCenters.toViewConst(); }
282 
287  void setMeanPermCoefficient( real64 const & meanPermCoefficient )
288  {
289  m_meanPermCoefficient = meanPermCoefficient;
290  }
291 
292 private:
293 
295  ArrayOfArrays< R1Tensor > m_cellCenterToEdgeCenters;
296 
298  real64 m_meanPermCoefficient = 1.0;
299 
300 };
301 
303 inline void
306  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient,
307  CoefficientAccessor< arrayView3d< real64 const > > const & dCoeff_dVar,
308  real64 ( & weight )[maxNumConnections][2],
309  real64 ( & dWeight_dVar )[maxNumConnections][2] ) const
310 {
311 
312  real64 sumOfTrans = 0.0;
313  for( localIndex k=0; k<numPointsInFlux( iconn ); ++k )
314  {
315  localIndex const er = m_elementRegionIndices[iconn][k];
316  localIndex const esr = m_elementSubRegionIndices[iconn][k];
317  localIndex const ei = m_elementIndices[iconn][k];
318 
319  sumOfTrans += coefficient[er][esr][ei][0][0] * m_weights[iconn][k];
320  }
321 
322  localIndex k[2];
323  localIndex connectionIndex = 0;
324  for( k[0]=0; k[0]<numPointsInFlux( iconn ); ++k[0] )
325  {
326  for( k[1]=k[0]+1; k[1]<numPointsInFlux( iconn ); ++k[1] )
327  {
328  localIndex const er0 = m_elementRegionIndices[iconn][k[0]];
329  localIndex const esr0 = m_elementSubRegionIndices[iconn][k[0]];
330  localIndex const ei0 = m_elementIndices[iconn][k[0]];
331 
332  localIndex const er1 = m_elementRegionIndices[iconn][k[1]];
333  localIndex const esr1 = m_elementSubRegionIndices[iconn][k[1]];
334  localIndex const ei1 = m_elementIndices[iconn][k[1]];
335 
336  real64 const t0 = m_weights[iconn][0] * coefficient[er0][esr0][ei0][0][0]; // this is a bit insane to access perm
337  real64 const t1 = m_weights[iconn][1] * coefficient[er1][esr1][ei1][0][0];
338 
339  real64 const harmonicWeight = t0*t1 / sumOfTrans;
340  real64 const arithmeticWeight = 0.25 * (t0+t1);
341 
342  real64 const value = m_meanPermCoefficient * harmonicWeight + (1 - m_meanPermCoefficient) * arithmeticWeight;
343 
344  weight[connectionIndex][0] = value;
345  weight[connectionIndex][1] = -value;
346 
347  real64 const dt0 = m_weights[iconn][0] * dCoeff_dVar[er0][esr0][ei0][0][0];
348  real64 const dt1 = m_weights[iconn][1] * dCoeff_dVar[er1][esr1][ei1][0][0];
349 
350  real64 dHarmonic[2];
351  dHarmonic[0] = ( dt0 * t1 * sumOfTrans - dt0 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
352  dHarmonic[1] = ( t0 * dt1 * sumOfTrans - dt1 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
353 
354  real64 dArithmetic[2];
355  dArithmetic[0] = 0.25 * dt0;
356  dArithmetic[1] = 0.25 * dt1;
357 
358  dWeight_dVar[connectionIndex][0] = m_meanPermCoefficient * dHarmonic[0] + (1 - m_meanPermCoefficient) * dArithmetic[0];
359  dWeight_dVar[connectionIndex][1] = -( m_meanPermCoefficient * dHarmonic[1] + (1 - m_meanPermCoefficient) * dArithmetic[1] );
360 
361  connectionIndex++;
362  }
363  }
364 }
365 
367 inline void
370  real64 ( & weight )[maxNumConnections][2],
371  real64 ( & dWeight_dVar )[maxNumConnections][2] ) const
372 {
373 
374  real64 sumOfTrans = 0.0;
375  for( localIndex k=0; k<numPointsInFlux( iconn ); ++k )
376  {
377  sumOfTrans += m_weights[iconn][k];
378  }
379 
380  localIndex k[2];
381  localIndex connectionIndex = 0;
382  for( k[0]=0; k[0]<numPointsInFlux( iconn ); ++k[0] )
383  {
384  for( k[1]=k[0]+1; k[1]<numPointsInFlux( iconn ); ++k[1] )
385  {
386  real64 const t0 = m_weights[iconn][0];
387  real64 const t1 = m_weights[iconn][1];
388 
389  real64 const harmonicWeight = t0*t1 / sumOfTrans;
390  real64 const arithmeticWeight = 0.25 * (t0+t1);
391 
392  real64 const value = m_meanPermCoefficient * harmonicWeight + (1 - m_meanPermCoefficient) * arithmeticWeight;
393 
394  weight[connectionIndex][0] = value;
395  weight[connectionIndex][1] = -value;
396 
397  real64 const dt0 = m_weights[iconn][0];
398  real64 const dt1 = m_weights[iconn][1];
399 
400  real64 dHarmonic[2];
401  dHarmonic[0] = ( dt0 * t1 * sumOfTrans - dt0 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
402  dHarmonic[1] = ( t0 * dt1 * sumOfTrans - dt1 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
403 
404  real64 dArithmetic[2];
405  dArithmetic[0] = 0.25 * dt0;
406  dArithmetic[1] = 0.25 * dt1;
407 
408  dWeight_dVar[connectionIndex][0] = m_meanPermCoefficient * dHarmonic[0] + (1 - m_meanPermCoefficient) * dArithmetic[0];
409  dWeight_dVar[connectionIndex][1] = -( m_meanPermCoefficient * dHarmonic[1] + (1 - m_meanPermCoefficient) * dArithmetic[1] );
410 
411  connectionIndex++;
412  }
413  }
414 }
415 
416 
417 
419 inline void
422  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient,
423  CoefficientAccessor< arrayView3d< real64 const > > const & dCoeff_dVar1,
424  CoefficientAccessor< arrayView4d< real64 const > > const & dCoeff_dVar2,
425  real64 (& weight)[maxNumConnections][2],
426  real64 (& dWeight_dVar1 )[maxNumConnections][2],
427  real64 (& dWeight_dVar2 )[maxNumConnections][2][3] ) const
428 {
429  real64 sumOfTrans = 0.0;
430  for( localIndex k=0; k<numPointsInFlux( iconn ); ++k )
431  {
432  localIndex const er = m_elementRegionIndices[iconn][k];
433  localIndex const esr = m_elementSubRegionIndices[iconn][k];
434  localIndex const ei = m_elementIndices[iconn][k];
435 
436  sumOfTrans += coefficient[er][esr][ei][0][0] * m_weights[iconn][k];
437  }
438 
439  localIndex k[2];
440  localIndex connectionIndex = 0;
441  for( k[0]=0; k[0]<numPointsInFlux( iconn ); ++k[0] )
442  {
443  for( k[1]=k[0]+1; k[1]<numPointsInFlux( iconn ); ++k[1] )
444  {
445  localIndex const er0 = m_elementRegionIndices[iconn][k[0]];
446  localIndex const esr0 = m_elementSubRegionIndices[iconn][k[0]];
447  localIndex const ei0 = m_elementIndices[iconn][k[0]];
448 
449  localIndex const er1 = m_elementRegionIndices[iconn][k[1]];
450  localIndex const esr1 = m_elementSubRegionIndices[iconn][k[1]];
451  localIndex const ei1 = m_elementIndices[iconn][k[1]];
452 
453  real64 const t0 = m_weights[iconn][0] * coefficient[er0][esr0][ei0][0][0]; // this is a bit insane to access perm
454  real64 const t1 = m_weights[iconn][1] * coefficient[er1][esr1][ei1][0][0];
455 
456  real64 const harmonicWeight = t0*t1 / sumOfTrans;
457  real64 const arithmeticWeight = 0.25 * (t0+t1);
458 
459  real64 const value = m_meanPermCoefficient * harmonicWeight + (1 - m_meanPermCoefficient) * arithmeticWeight;
460 
461  weight[connectionIndex][0] = value;
462  weight[connectionIndex][1] = -value;
463 
464  real64 const dt0_dvar1 = m_weights[iconn][0] * dCoeff_dVar1[er0][esr0][ei0][0][0];
465  real64 const dt1_dvar1 = m_weights[iconn][1] * dCoeff_dVar1[er1][esr1][ei1][0][0];
466 
467  real64 dHarmonic_dvar1[2];
468  dHarmonic_dvar1[0] = ( dt0_dvar1 * t1 * sumOfTrans - dt0_dvar1 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
469  dHarmonic_dvar1[1] = ( dt0_dvar1 * t1 * sumOfTrans - dt0_dvar1 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
470 
471  real64 dArithmetic_dvar1[2];
472  dArithmetic_dvar1[0] = 0.25 * dt0_dvar1;
473  dArithmetic_dvar1[1] = 0.25 * dt1_dvar1;
474 
475  dWeight_dVar1[connectionIndex][0] = m_meanPermCoefficient * dHarmonic_dvar1[0] + (1 - m_meanPermCoefficient) * dArithmetic_dvar1[0];
476  dWeight_dVar1[connectionIndex][1] = -( m_meanPermCoefficient * dHarmonic_dvar1[1] + (1 - m_meanPermCoefficient) * dArithmetic_dvar1[1] );
477 
478  real64 const dt0_dvar2 = m_weights[iconn][0] * dCoeff_dVar2[er0][esr0][ei0][0][0][0];
479  real64 const dt1_dvar2 = m_weights[iconn][1] * dCoeff_dVar2[er1][esr1][ei1][0][0][0];
480 
481  real64 dHarmonic_dvar2[2];
482  dHarmonic_dvar2[0] = ( dt0_dvar2 * t1 * sumOfTrans - dt0_dvar2 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
483  dHarmonic_dvar2[1] = ( t0 * dt1_dvar2 * sumOfTrans - dt1_dvar2 * t0 * t1 ) / ( sumOfTrans * sumOfTrans );
484 
485  real64 dArithmetic_dvar2[2];
486  dArithmetic_dvar2[0] = 0.25 * dt0_dvar2;
487  dArithmetic_dvar2[1] = 0.25 * dt1_dvar2;
488 
489  dWeight_dVar2[connectionIndex][0][0] = ( m_meanPermCoefficient * dHarmonic_dvar2[0] + (1 - m_meanPermCoefficient) * dArithmetic_dvar2[0] );
490  dWeight_dVar2[connectionIndex][1][0] = -( m_meanPermCoefficient * dHarmonic_dvar2[1] + (1 - m_meanPermCoefficient) * dArithmetic_dvar2[1] );
491 
492  connectionIndex++;
493  }
494  }
495 }
496 
498 inline void
501  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient,
502  CoefficientAccessor< arrayView3d< real64 const > > const & coefficientMultiplier,
503  R1Tensor const & gravityVector,
504  real64 (& weight)[maxNumConnections][2] ) const
505 {
506  // TODO: this should become star-delta method
507  real64 sumOfTrans = 0.0;
508  for( localIndex k=0; k<numPointsInFlux( iconn ); ++k )
509  {
510  localIndex const er = m_elementRegionIndices[iconn][k];
511  localIndex const esr = m_elementSubRegionIndices[iconn][k];
512  localIndex const ei = m_elementIndices[iconn][k];
513 
514  real64 const mult = ( LvArray::math::abs( LvArray::tensorOps::AiBi< 3 >( m_cellCenterToEdgeCenters[iconn][k], gravityVector ) ) > MULTIPLIER_THRESHOLD )
515  ? coefficientMultiplier[er][esr][ei][0][1] : coefficientMultiplier[er][esr][ei][0][0];
516 
517  sumOfTrans += mult * coefficient[er][esr][ei][0][0] * m_weights[iconn][k];
518  }
519 
520 
521  localIndex k[2];
522  localIndex connectionIndex = 0;
523  for( k[0]=0; k[0]<numPointsInFlux( iconn ); ++k[0] )
524  {
525  for( k[1]=k[0]+1; k[1]<numPointsInFlux( iconn ); ++k[1] )
526  {
527  localIndex const er0 = m_elementRegionIndices[iconn][k[0]];
528  localIndex const esr0 = m_elementSubRegionIndices[iconn][k[0]];
529  localIndex const ei0 = m_elementIndices[iconn][k[0]];
530 
531  localIndex const er1 = m_elementRegionIndices[iconn][k[1]];
532  localIndex const esr1 = m_elementSubRegionIndices[iconn][k[1]];
533  localIndex const ei1 = m_elementIndices[iconn][k[1]];
534 
535  real64 const mult0 = ( LvArray::math::abs( LvArray::tensorOps::AiBi< 3 >( m_cellCenterToEdgeCenters[iconn][k[0]], gravityVector ) ) > MULTIPLIER_THRESHOLD )
536  ? coefficientMultiplier[er0][esr0][ei0][0][1] : coefficientMultiplier[er0][esr0][ei0][0][0];
537  real64 const mult1 = ( LvArray::math::abs( LvArray::tensorOps::AiBi< 3 >( m_cellCenterToEdgeCenters[iconn][k[1]], gravityVector ) ) > MULTIPLIER_THRESHOLD )
538  ? coefficientMultiplier[er1][esr1][ei1][0][1] : coefficientMultiplier[er1][esr1][ei1][0][0];
539 
540  real64 const t0 = mult0 * m_weights[iconn][0] * coefficient[er0][esr0][ei0][0][0];
541  real64 const t1 = mult1 * m_weights[iconn][1] * coefficient[er1][esr1][ei1][0][0];
542 
543  real64 const harmonicWeight = t0*t1 / sumOfTrans;
544  real64 const arithmeticWeight = 0.25 * (t0+t1);
545 
546  real64 const value = m_meanPermCoefficient * harmonicWeight + (1 - m_meanPermCoefficient) * arithmeticWeight;
547 
548  weight[connectionIndex][0] = value;
549  weight[connectionIndex][1] = -value;
550 
551  connectionIndex++;
552  }
553  }
554 }
555 
557 inline void
560  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient1,
561  CoefficientAccessor< arrayView3d< real64 const > > const & coefficient1Multiplier,
562  CoefficientAccessor< arrayView1d< real64 const > > const & coefficient2,
563  R1Tensor const & unitGravityVector,
564  real64 ( & weight1 )[maxNumPointsInFlux],
565  real64 ( & weight2 )[maxNumPointsInFlux],
566  real64 ( & geometricWeight )[maxNumPointsInFlux] ) const
567 {
568  real64 sumOfGeometricWeights = 0.0;
569 
570  for( localIndex k = 0; k < numPointsInFlux( iconn ); ++k )
571  {
572  localIndex const er = m_elementRegionIndices[iconn][k];
573  localIndex const esr = m_elementSubRegionIndices[iconn][k];
574  localIndex const ei = m_elementIndices[iconn][k];
575 
576  real64 const cellToEdgeDistance = LvArray::tensorOps::l2Norm< 3 >( m_cellCenterToEdgeCenters[iconn][k] );
577  real64 const edgeLength = m_weights[iconn][k] * cellToEdgeDistance;
578  real64 const edgeToFaceDownDistance = -LvArray::tensorOps::AiBi< 3 >( m_cellCenterToEdgeCenters[iconn][k], unitGravityVector )
579  * edgeLength / cellToEdgeDistance;
580 
581  real64 const mult = ( LvArray::math::abs( edgeToFaceDownDistance ) > MULTIPLIER_THRESHOLD )
582  ? coefficient1Multiplier[er][esr][ei][0][1] : coefficient1Multiplier[er][esr][ei][0][0];
583 
584  weight1[k] = mult * coefficient1[er][esr][ei][0][0] * m_weights[iconn][k];
585  weight2[k] = coefficient2[er][esr][ei] * edgeToFaceDownDistance;
586 
587  geometricWeight[k] = m_weights[iconn][k] / 12.0;
588  sumOfGeometricWeights += geometricWeight[k];
589  }
590 
591  for( localIndex k = 0; k < numPointsInFlux( iconn ); ++k )
592  {
593  geometricWeight[k] /= sumOfGeometricWeights;
594  }
595 }
596 
598 inline void
601 {
602  for( localIndex k = 0; k < stencilSize( iconn ); ++k )
603  {
604  localIndex const er = m_elementRegionIndices[iconn][k];
605  localIndex const esr = m_elementSubRegionIndices[iconn][k];
606  localIndex const ei = m_elementIndices[iconn][k];
607 
608  m_weights[iconn][k] = m_weights[iconn][k] / hydraulicAperture[er][esr][ei];
609  }
610 }
611 
613 inline void
616 {
617  for( localIndex k = 0; k < stencilSize( iconn ); ++k )
618  {
619  localIndex const er = m_elementRegionIndices[iconn][k];
620  localIndex const esr = m_elementSubRegionIndices[iconn][k];
621  localIndex const ei = m_elementIndices[iconn][k];
622 
623  m_weights[iconn][k] = m_weights[iconn][k] * hydraulicAperture[er][esr][ei];
624  }
625 }
626 
627 } /* namespace geos */
628 
629 #endif /* GEOS_FINITEVOLUME_SURFACEELEMENTSTENCIL_HPP_ */
#define GEOS_HOST_DEVICE
Marks a host-device function.
Definition: GeosxMacros.hpp:48
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
Definition: GeosxMacros.hpp:83
#define GEOS_FORCE_INLINE
Marks a function or lambda for inlining.
Definition: GeosxMacros.hpp:50
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:220
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:326
double real64
64-bit floating point type.
Definition: DataTypes.hpp:139
ArrayView< T, 4, USD > arrayView4d
Alias for 4D array view.
Definition: DataTypes.hpp:268
GEOSX_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125
LvArray::ArrayOfArrays< T, INDEX_TYPE, LvArray::ChaiBuffer > ArrayOfArrays
Array of variable-sized arrays. See LvArray::ArrayOfArrays for details.
Definition: DataTypes.hpp:322
ArrayView< T, 3, USD > arrayView3d
Alias for 3D array view.
Definition: DataTypes.hpp:252
A collection of properties of a stencil type.
Definition: StencilBase.hpp:41
CONTAINER< localIndex > IndexContainerType
The array type that will be used to store the indices of the stencil contributors.
Definition: StencilBase.hpp:43
CONTAINER< real64 > WeightContainerType
The array type that is used to store the weights of the stencil contributors.
Definition: StencilBase.hpp:49
static constexpr localIndex maxNumPointsInFlux
Maximum number of points the flux.
Definition: StencilBase.hpp:58
static constexpr localIndex maxNumConnections
Maximum number of connections in a stencil.
Definition: StencilBase.hpp:64