GEOS
ThermalCompositionalMultiphaseWellKernels.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_PHYSICSSOLVERS_FLUIDFLOW_WELLS_THERMALCOMPOSITIONALMULTIPHASEWELLKERNELS_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_WELLS_THERMALCOMPOSITIONALMULTIPHASEWELLKERNELS_HPP
22 
25 #include "physicsSolvers/fluidFlow/wells/WellConstraintsBase.hpp"
26 #include "physicsSolvers/fluidFlow/wells/WellPhaseVolumeRateConstraint.hpp"
27 
28 namespace geos
29 {
30 
31 namespace thermalCompositionalMultiphaseWellKernels
32 {
33 
34 using namespace constitutive;
35 
36 /******************************** TotalMassDensityKernel ****************************/
37 
44 template< integer NUM_COMP, integer NUM_PHASE >
46 {
47 public:
49  using Base::m_dCompFrac_dCompDens;
50  using Base::m_dPhaseMassDens;
51  using Base::m_dPhaseVolFrac;
52  using Base::m_dTotalMassDens;
53  using Base::m_phaseMassDens;
54  using Base::m_phaseVolFrac;
55  using Base::m_totalMassDens;
56  using Base::numComp;
57  using Base::numPhase;
58 
65  MultiFluidBase const & fluid )
66  : Base( subRegion, fluid )
67  {}
68 
75  GEOS_HOST_DEVICE inline void compute( localIndex const ei ) const
76  {
77  using Deriv = multifluid::DerivativeOffset;
78 
79  arraySlice1d< real64 const, compflow::USD_PHASE - 1 > phaseVolFrac = m_phaseVolFrac[ei];
80  arraySlice2d< real64 const, compflow::USD_PHASE_DC - 1 > dPhaseVolFrac = m_dPhaseVolFrac[ei];
81  arraySlice1d< real64 const, multifluid::USD_PHASE - 2 > phaseMassDens = m_phaseMassDens[ei][0];
82  arraySlice2d< real64 const, multifluid::USD_PHASE_DC - 2 > dPhaseMassDens = m_dPhaseMassDens[ei][0];
83 
84  real64 & dTotalMassDens_dT = m_dTotalMassDens[ei][Deriv::dT];
85 
86  // Call the base compute the compute the total mass density and derivatives
87  return Base::compute( ei, [&]( localIndex const ip )
88  {
89  dTotalMassDens_dT += dPhaseVolFrac[ip][Deriv::dT] * phaseMassDens[ip] + phaseVolFrac[ip] * dPhaseMassDens[ip][Deriv::dT];
90  } );
91  }
92 
93 protected:
94  // outputs
95  arrayView1d< real64 > m_dTotalMassDens_dTemp;
96 };
97 
102 {
103 public:
112  template< typename POLICY >
113  static void
114  createAndLaunch( integer const numComp,
115  integer const numPhase,
116  ObjectManagerBase & subRegion,
117  MultiFluidBase const & fluid )
118  {
119  if( numPhase == 2 )
120  {
121  isothermalCompositionalMultiphaseBaseKernels::internal::kernelLaunchSelectorCompSwitch( numComp, [&]( auto NC )
122  {
123  integer constexpr NUM_COMP = NC();
124  TotalMassDensityKernel< NUM_COMP, 2 > kernel( subRegion, fluid );
125  TotalMassDensityKernel< NUM_COMP, 2 >::template launch< POLICY >( subRegion.size(), kernel );
126  } );
127  }
128  else if( numPhase == 3 )
129  {
130  isothermalCompositionalMultiphaseBaseKernels::internal::kernelLaunchSelectorCompSwitch( numComp, [&]( auto NC )
131  {
132  integer constexpr NUM_COMP = NC();
133  TotalMassDensityKernel< NUM_COMP, 3 > kernel( subRegion, fluid );
134  TotalMassDensityKernel< NUM_COMP, 3 >::template launch< POLICY >( subRegion.size(), kernel );
135  } );
136  }
137  }
138 };
139 
140 /******************************** ResidualNormKernel ********************************/
141 
145 template< localIndex NUM_COMP >
147 {
148 public:
149 
151  static constexpr integer numComp = NUM_COMP;
152 
153 
155 
157  using Base::m_minNormalizer;
158  using Base::m_rankOffset;
159  using Base::m_localResidual;
160  using Base::m_dofNumber;
161 
162  ResidualNormKernel( globalIndex const rankOffset,
163  arrayView1d< real64 const > const & localResidual,
164  arrayView1d< globalIndex const > const & dofNumber,
165  arrayView1d< localIndex const > const & ghostRank,
166 
167  WellElementSubRegion const & subRegion,
168  MultiFluidBase const & fluid,
169  WellControls const & wellControls,
170  real64 const time,
171  real64 const dt,
172  real64 const minNormalizer )
173  : Base( rankOffset,
174  localResidual,
175  dofNumber,
176  ghostRank,
177  minNormalizer ),
178  m_numPhases( fluid.numFluidPhases()),
179  m_targetPhaseIndex( wellControls.isProducer() ? wellControls.getConstraintPhaseIndex() : -1 ),
180  m_dt( dt ),
181  m_isLocallyOwned( subRegion.isLocallyOwned() ),
182  m_iwelemControl( subRegion.getTopWellElementIndex() ),
183  m_isProducer( wellControls.isProducer() ),
184  m_currentControl( wellControls.getControl() ),
185  m_targetBHP( wellControls.getTargetBHP( time ) ),
186  m_volume( subRegion.getElementVolume() ),
187  m_phaseDens_n( fluid.phaseDensity_n() ),
188  m_totalDens_n( fluid.totalDensity_n() ),
189  m_phaseVolFraction_n( subRegion.getField< fields::well::phaseVolumeFraction_n >()),
190  m_phaseInternalEnergy_n( fluid.phaseInternalEnergy_n() )
191  {
192  const WellConstraintBase * currentConstraint = wellControls.getCurrentConstraint();
193  ConstraintTypeId currentControl = wellControls.getControl();
194  // Note this assumes that there is only one rate constraint
195  // This is a normalizer for the balance equations. The normalizaer should be the current rate not the constraint value!!
196  // This is one of the reasons for restricting constraint type for a production well
197  // Another pr will remove fix this (so the cause for difference results is isolated to one change)
198  auto const * rateConstraint = wellControls.getRateConstraints().front();
199  if( rateConstraint != nullptr )
200  {
201  m_constraintValue = rateConstraint->getConstraintValue( time );
202  }
203  if( currentControl == ConstraintTypeId::BHP )
204  {
205  m_targetBHP = currentConstraint->getConstraintValue( time );
206  }
207  else
208  {
209  m_constraintValue = currentConstraint->getConstraintValue( time );
210  }
211  }
212 
214  void computeMassEnergyNormalizers( localIndex const iwelem,
215  real64 & massNormalizer,
216  real64 & energyNormalizer ) const
217  {
218  massNormalizer = LvArray::math::max( m_minNormalizer, m_totalDens_n[iwelem][0] * m_volume[iwelem] );
219 
220  for( integer ip = 0; ip < m_numPhases; ++ip )
221  {
222  energyNormalizer += m_phaseInternalEnergy_n[iwelem][0][ip] * m_phaseDens_n[iwelem][0][ip] * m_phaseVolFraction_n[iwelem][ip] * m_volume[iwelem];
223  }
224  // warning: internal energy can be negative
225  energyNormalizer = LvArray::math::max( m_minNormalizer, LvArray::math::abs( energyNormalizer ) );
226  }
227 
229  virtual void computeLinf( localIndex const iwelem,
230  LinfStackVariables & stack ) const override
231  {
232  real64 normalizer = 0.0;
233  for( integer idof = 0; idof < WJ_ROFFSET::nEqn; ++idof )
234  {
235 
236  // Step 1: compute a normalizer for the control or pressure equation
237 
238  // for the control equation, we distinguish two cases
239  if( idof == WJ_ROFFSET::CONTROL )
240  {
241 
242  // for the top well element, normalize using the current control
243  if( m_isLocallyOwned && iwelem == m_iwelemControl )
244  {
245  if( m_currentControl == ConstraintTypeId::BHP )
246  {
247  // the residual entry is in pressure units
248  normalizer = m_targetBHP;
249  }
250  else if( m_currentControl == ConstraintTypeId::TOTALVOLRATE )
251  {
252  // the residual entry is in volume / time units
253  normalizer = LvArray::math::max( LvArray::math::abs( m_constraintValue ), m_minNormalizer );
254  }
255  else if( m_currentControl == ConstraintTypeId::PHASEVOLRATE )
256  {
257  // the residual entry is in volume / time units
258  normalizer = LvArray::math::max( LvArray::math::abs( m_constraintValue ), m_minNormalizer );
259  }
260  else if( m_currentControl == ConstraintTypeId::MASSRATE )
261  {
262  // the residual entry is in volume / time units
263  normalizer = LvArray::math::max( LvArray::math::abs( m_constraintValue ), m_minNormalizer );
264  }
265  }
266  // for the pressure difference equation, always normalize by the BHP
267  else
268  {
269  normalizer = m_targetBHP;
270  }
271  }
272  // Step 2: compute a normalizer for the mass balance equations
273  else if( idof >= WJ_ROFFSET::MASSBAL && idof < WJ_ROFFSET::MASSBAL + numComp )
274  {
275  if( m_isProducer ) // only PHASEVOLRATE is supported for now
276  {
277  // the residual is in mass units
278  normalizer = m_dt * LvArray::math::abs( m_constraintValue ) * m_phaseDens_n[iwelem][0][m_targetPhaseIndex];
279  }
280  else // Type::INJECTOR, only TOTALVOLRATE is supported for now
281  {
282  if( m_currentControl == ConstraintTypeId::MASSRATE )
283  {
284  normalizer = m_dt * LvArray::math::abs( m_constraintValue );
285  }
286  else
287  {
288  // the residual is in mass units
289  normalizer = m_dt * LvArray::math::abs( m_constraintValue ) * m_totalDens_n[iwelem][0];
290  }
291 
292  }
293 
294  // to make sure that everything still works well if the rate is zero, we add this check
295  normalizer = LvArray::math::max( normalizer, m_volume[iwelem] * m_totalDens_n[iwelem][0] );
296  }
297  // Step 3: compute a normalizer for the volume balance equations
298  else if( idof == WJ_ROFFSET::VOLBAL )
299  {
300  if( m_isProducer ) // only PHASEVOLRATE is supported for now
301  {
302  // the residual is in volume units
303  normalizer = m_dt * LvArray::math::abs( m_constraintValue );
304  }
305  else // Type::INJECTOR, only TOTALVOLRATE is supported for now
306  {
307  if( m_currentControl == ConstraintTypeId::MASSRATE )
308  {
309  normalizer = m_dt * LvArray::math::abs( m_constraintValue/ m_totalDens_n[iwelem][0] );
310  }
311  else
312  {
313  normalizer = m_dt * LvArray::math::abs( m_constraintValue );
314  }
315 
316  }
317  // to make sure that everything still works well if the rate is zero, we add this check
318  normalizer = LvArray::math::max( normalizer, m_volume[iwelem] );
319  }
320  // step 3: energy residual
321  if( idof == WJ_ROFFSET::ENERGYBAL )
322  {
323  real64 massNormalizer = 0.0, energyNormalizer = 0.0;
324  computeMassEnergyNormalizers( iwelem, massNormalizer, energyNormalizer );
325  real64 const valEnergy = LvArray::math::abs( m_localResidual[stack.localRow + WJ_ROFFSET::ENERGYBAL] ) / energyNormalizer;
326  if( valEnergy > stack.localValue[1] )
327  {
328  stack.localValue[1] = valEnergy;
329  }
330 
331  }
332  else
333  {
334  normalizer = LvArray::math::max( m_minNormalizer, normalizer );
335  // Step 4: compute the contribution to the residual
336  real64 const val = LvArray::math::abs( m_localResidual[stack.localRow + idof] ) / normalizer;
337  if( val > stack.localValue[0] )
338  {
339  stack.localValue[0] = val;
340  }
341  }
342  }
343  }
344 
346  virtual void computeL2( localIndex const iwelem,
347  L2StackVariables & stack ) const override
348  {
349  GEOS_UNUSED_VAR( iwelem, stack );
350  GEOS_ERROR( "The L2 norm is not implemented for CompositionalMultiphaseWell" );
351  }
352 
353 
354 protected:
355 
358 
361 
363  real64 const m_dt;
364 
366  bool const m_isLocallyOwned;
367 
370 
372  bool const m_isProducer;
373 
376  real64 m_constraintValue;
377  real64 m_targetBHP;
378 
379 
382 
386  arrayView2d< real64 const, compflow::USD_PHASE > const m_phaseVolFraction_n;
387  arrayView3d< real64 const, multifluid::USD_PHASE > const m_phaseInternalEnergy_n;
388 
389 };
390 
391 /*
392  *@class ResidualNormKernelFactory
393  */
395 {
396 public:
397 
413  template< typename POLICY >
414  static void
415  createAndLaunch( integer const numComp,
416  globalIndex const rankOffset,
417  string const & dofKey,
418  arrayView1d< real64 const > const & localResidual,
419  WellElementSubRegion const & subRegion,
420  MultiFluidBase const & fluid,
421  WellControls const & wellControls,
422  real64 const time,
423  real64 const dt,
424  real64 const minNormalizer,
425  real64 (& residualNorm)[2] )
426  {
427  isothermalCompositionalMultiphaseBaseKernels::internal::kernelLaunchSelectorCompSwitch ( numComp, [&]( auto NC )
428  {
429 
430  integer constexpr NUM_COMP = NC();
431  using kernelType = ResidualNormKernel< NUM_COMP >;
432  arrayView1d< globalIndex const > const dofNumber = subRegion.getReference< array1d< globalIndex > >( dofKey );
433  arrayView1d< integer const > const ghostRank = subRegion.ghostRank();
434 
435  kernelType kernel( rankOffset, localResidual, dofNumber, ghostRank,
436  subRegion, fluid, wellControls, time, dt, minNormalizer );
437  kernelType::template launchLinf< POLICY >( subRegion.size(), kernel, residualNorm );
438  } );
439  }
440 
441 };
442 
443 /******************************** ElementBasedAssemblyKernel ********************************/
444 
451 template< localIndex NUM_COMP >
453 {
454 public:
456  using Base::m_dCompFrac_dCompDens;
457  using Base::m_dofNumber;
458  using Base::m_dPhaseCompFrac;
459  using Base::m_dPhaseDens;
460  using Base::m_dPhaseVolFrac;
461  using Base::m_dPoro_dPres;
462  using Base::m_elemGhostRank;
463  using Base::m_localMatrix;
464  using Base::m_localRhs;
465  using Base::m_numPhases;
466  using Base::m_phaseCompFrac;
467  using Base::m_phaseCompFrac_n;
468  using Base::m_phaseDens;
469  using Base::m_phaseDens_n;
470  using Base::m_phaseVolFrac;
471  using Base::m_phaseVolFrac_n;
472  using Base::m_porosity;
473  using Base::m_porosity_n;
474  using Base::m_rankOffset;
475  using Base::m_volume;
476  using Base::numComp;
477  using Base::numDof;
478  using Base::numEqn;
479 
480  using FLUID_PROP_COFFSET = multifluid::DerivativeOffsetC< NUM_COMP, 1 >;
481 
482 
494  bool const thermalEffectsEnabled,
495  integer const isProducer,
496  globalIndex const rankOffset,
497  string const dofKey,
498  WellElementSubRegion const & subRegion,
499  MultiFluidBase const & fluid,
500  CRSMatrixView< real64, globalIndex const > const & localMatrix,
501  arrayView1d< real64 > const & localRhs,
502  BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > const kernelFlags )
503  : Base( numPhases, thermalEffectsEnabled, isProducer, rankOffset, dofKey, subRegion, fluid, localMatrix, localRhs, kernelFlags ),
504  m_phaseInternalEnergy_n( fluid.phaseInternalEnergy_n()),
505  m_phaseInternalEnergy( fluid.phaseInternalEnergy()),
506  m_dPhaseInternalEnergy( fluid.dPhaseInternalEnergy())
507  {}
508 
509  struct StackVariables : public Base::StackVariables
510  {
511 public:
514  : Base::StackVariables()
515  {}
516  using Base::StackVariables::eqnRowIndices;
517  using Base::StackVariables::dofColIndices;
518  using Base::StackVariables::localJacobian;
519  using Base::StackVariables::localResidual;
520  using Base::StackVariables::localRow;
521  using Base::StackVariables::volume;
522 
523 
524 
525  };
532  void setup( localIndex const ei,
533  StackVariables & stack ) const
534  {
535  Base::setup( ei, stack );
536 
537 
538 
539  }
540 
549  StackVariables & stack ) const
550  {
551  using Deriv = multifluid::DerivativeOffset;
552 
553  Base::computeAccumulation( ei, stack, [&]( integer const ip
554  , real64 const & phaseAmount
555  , real64 const & phaseAmount_n
556  , real64 const (&dPhaseAmount)[FLUID_PROP_COFFSET::nDer] )
557  {
558  // We are in the loop over phases, ip provides the current phase index.
559  // We have to do two things:
560  // 1- Assemble the derivatives of the component mass balance equations with respect to temperature
561  // 2- Assemble the phase-dependent part of the accumulation term of the energy equation
562 
563  real64 dPhaseInternalEnergy_dC[numComp]{};
564 
565  // construct the slices
566  arraySlice2d< real64 const, compflow::USD_COMP_DC - 1 > dCompFrac_dCompDens = m_dCompFrac_dCompDens[ei];
567  arraySlice1d< real64 const, multifluid::USD_PHASE - 2 > phaseInternalEnergy_n = m_phaseInternalEnergy_n[ei][0];
568  arraySlice1d< real64 const, multifluid::USD_PHASE - 2 > phaseInternalEnergy = m_phaseInternalEnergy[ei][0];
569  arraySlice2d< real64 const, multifluid::USD_PHASE_DC - 2 > dPhaseInternalEnergy = m_dPhaseInternalEnergy[ei][0];
570 
571  // Step 1: assemble the phase-dependent part of the accumulation term of the energy equation
572 
573  real64 const phaseEnergy = phaseAmount * phaseInternalEnergy[ip];
574  real64 const phaseEnergy_n = phaseAmount_n * phaseInternalEnergy_n[ip];
575  real64 const dPhaseEnergy_dP = dPhaseAmount[FLUID_PROP_COFFSET::dP] * phaseInternalEnergy[ip]
576  + phaseAmount * dPhaseInternalEnergy[ip][Deriv::dP];
577  real64 const dPhaseEnergy_dT = dPhaseAmount[FLUID_PROP_COFFSET::dT] * phaseInternalEnergy[ip]
578  + phaseAmount * dPhaseInternalEnergy[ip][Deriv::dT];
579  // local accumulation
580  stack.localResidual[numEqn-1] += phaseEnergy - phaseEnergy_n;
581 
582  // derivatives w.r.t. pressure and temperature
583  stack.localJacobian[numEqn-1][0] += dPhaseEnergy_dP;
584  stack.localJacobian[numEqn-1][numDof-1] += dPhaseEnergy_dT;
585 
586  // derivatives w.r.t. component densities
587  applyChainRule( numComp, dCompFrac_dCompDens, dPhaseInternalEnergy[ip], dPhaseInternalEnergy_dC, Deriv::dC );
588  for( integer jc = 0; jc < numComp; ++jc )
589  {
590  stack.localJacobian[numEqn-1][jc + 1] += phaseInternalEnergy[ip] * dPhaseAmount[FLUID_PROP_COFFSET::dC+jc]
591  + dPhaseInternalEnergy_dC[jc] * phaseAmount;
592  }
593  } );
594 
595 
596  }
597 
606  StackVariables & stack ) const
607  {
608  Base::computeVolumeBalance( ei, stack );
609 
610  }
611 
613  void complete( localIndex const ei,
614  StackVariables & stack ) const
615  {
616  // Assemble the component mass balance equations and volume balance equations
617  // Energy balance equation updates to solver matrices included in Base class
618  Base::complete( ei, stack );
619 
620  }
621 
622 protected:
625 
630 
631 };
632 
637 {
638 public:
651  template< typename POLICY >
652  static void
653  createAndLaunch( localIndex const numComps,
654  localIndex const numPhases,
655  integer const thermalEffectsEnabled,
656  integer const isProducer,
657  globalIndex const rankOffset,
658  BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags,
659  string const dofKey,
660  WellElementSubRegion const & subRegion,
661  MultiFluidBase const & fluid,
662  CRSMatrixView< real64, globalIndex const > const & localMatrix,
663  arrayView1d< real64 > const & localRhs )
664  {
665  isothermalCompositionalMultiphaseBaseKernels::internal::kernelLaunchSelectorCompSwitch( numComps, [&]( auto NC )
666  {
667  localIndex constexpr NUM_COMP = NC();
668 
670  kernel( numPhases, thermalEffectsEnabled, isProducer, rankOffset, dofKey, subRegion, fluid, localMatrix, localRhs, kernelFlags );
672  launch< POLICY, ElementBasedAssemblyKernel< NUM_COMP > >( subRegion.size(), kernel );
673  } );
674  }
675 };
676 
677 /******************************** FaceBasedAssemblyKernel ********************************/
678 
684 template< integer NC >
686 {
687 public:
688  static constexpr integer IS_THERMAL = 1;
690 
691  // Well jacobian column and row indicies
694 
695  using CP_Deriv = multifluid::DerivativeOffsetC< NC, IS_THERMAL >;
696 
698 
699 
700  using Base::m_isProducer;
701  using Base::m_dt;
702  using Base::m_localRhs;
703  using Base::m_localMatrix;
704  using Base::m_rankOffset;
705  using Base::maxNumElems;
706  using Base::maxStencilSize;
707  using Base::m_useTotalMassEquation;
708 
710  static constexpr integer numComp = NC;
711 
713  static constexpr integer numDof = WJ_COFFSET::nDer;
714 
716  static constexpr integer numEqn = WJ_ROFFSET::nEqn - 2;
717 
733  globalIndex const rankOffset,
734  string const wellDofKey,
735  WellControls const & wellControls,
736  WellElementSubRegion const & subRegion,
737  MultiFluidBase const & fluid,
738  CRSMatrixView< real64, globalIndex const > const & localMatrix,
739  arrayView1d< real64 > const & localRhs,
740  BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags )
741  : Base( dt
742  , rankOffset
743  , wellDofKey
744  , wellControls
745  , subRegion
746  , localMatrix
747  , localRhs
748  , kernelFlags ),
749  m_numPhases ( fluid.numFluidPhases()),
750  m_thermalEffectsEnabled( wellControls.thermalEffectsEnabled() ),
751  m_globalWellElementIndex( subRegion.getGlobalWellElementIndex() ),
752  m_phaseFraction( fluid.phaseFraction()),
753  m_dPhaseFraction( fluid.dPhaseFraction()),
754  m_phaseEnthalpy( fluid.phaseEnthalpy()),
755  m_dPhaseEnthalpy( fluid.dPhaseEnthalpy())
756  { }
757 
759  {
760 public:
761 
763  StackVariables( localIndex const size )
764  : Base::StackVariables( size )
765  {}
766 
773  };
774 
776  inline
777  void setup( localIndex const iwelem, StackVariables & stack ) const
778  {
779  Base::setup ( iwelem, stack );
780  stack.localEnergyFlux.resize( stack.numConnectedElems );
781  stack.localEnergyFluxJacobian.resize( stack.numConnectedElems, stack.stencilSize * numDof );
782  stack.localEnergyFluxJacobian_dQ.resize( stack.numConnectedElems, 1 );
783  for( integer i=0; i<stack.numConnectedElems; i++ )
784  {
785  stack.localEnergyFlux[i]=0.0;
786  stack.localEnergyFluxJacobian_dQ[i][0]=0.0;
787  for( integer j=0; j< stack.stencilSize * numDof; j++ )
788  stack.localEnergyFluxJacobian[i][j] = 0.0;
789  }
790  }
791 
793  inline
794  void complete( localIndex const iwelem, StackVariables & stack ) const
795  {
796  Base::complete ( iwelem, stack );
797  // tjb iso return;
798  if( !m_thermalEffectsEnabled ) return;
799  using namespace compositionalMultiphaseUtilities;
800  if( stack.numConnectedElems ==1 )
801  {
802  // Setup Jacobian global row indicies for energy equation
803  globalIndex oneSidedEqnRowIndices = stack.offsetUp + WJ_ROFFSET::ENERGYBAL - m_rankOffset;
804 
805  if( oneSidedEqnRowIndices >= 0 && oneSidedEqnRowIndices < m_localMatrix.numRows() )
806  {
807 
808  if( !m_isProducer && m_globalWellElementIndex[iwelem] == 0 )
809  {
810  // For top segment energy balance eqn replaced with T(n+1) - T = 0
811  // No other energy balance derivatives
812  // Assumption is global index == 0 is top segment with fixed temp BC
813  for( integer i=0; i< CP_Deriv::nDer; i++ )
814  {
815  stack.localEnergyFluxJacobian[0][i] = 0.0;
816  }
817  stack.localEnergyFluxJacobian_dQ[0][0]=0;
818  stack.localEnergyFlux[0]=0;
819  }
820 
821 
822  // Setup Jacobian global col indicies ( Mapping from local jac order to well jac order)
823  globalIndex oneSidedDofColIndices_dRate = stack.offsetCurrent + WJ_COFFSET::dQ;
824  globalIndex oneSidedDofColIndices_dPresCompTempUp[CP_Deriv::nDer]{};
825 
826  int ioff=0;
827  oneSidedDofColIndices_dPresCompTempUp[ioff++] = stack.offsetUp + WJ_COFFSET::dP;
828  oneSidedDofColIndices_dPresCompTempUp[ioff++] = stack.offsetUp + WJ_COFFSET::dT;
829  for( integer jdof = 0; jdof < NC; ++jdof )
830  {
831  oneSidedDofColIndices_dPresCompTempUp[ioff++] = stack.offsetUp + WJ_COFFSET::dC+ jdof;
832  }
833 
834  m_localMatrix.template addToRow< parallelDeviceAtomic >( oneSidedEqnRowIndices,
835  &oneSidedDofColIndices_dRate,
836  stack.localEnergyFluxJacobian_dQ[0],
837  1 );
838  m_localMatrix.template addToRowBinarySearchUnsorted< parallelDeviceAtomic >( oneSidedEqnRowIndices,
839  oneSidedDofColIndices_dPresCompTempUp,
840  stack.localEnergyFluxJacobian[0],
841  CP_Deriv::nDer );
842  RAJA::atomicAdd( parallelDeviceAtomic{}, &m_localRhs[oneSidedEqnRowIndices], stack.localEnergyFlux[0] );
843  }
844  }
845  else // if ( stack.numConnectedElems == 2 )
846  {
847  globalIndex row_current = stack.offsetCurrent + WJ_ROFFSET::ENERGYBAL - m_rankOffset;
848  globalIndex row_next = stack.offsetNext + WJ_ROFFSET::ENERGYBAL - m_rankOffset;
849 
850  if( !m_isProducer )
851  {
852  if( row_next >= 0 && row_next < m_localMatrix.numRows() )
853  {
854  if( m_globalWellElementIndex[stack.iwelemNext] == 0 )
855  {
856  for( integer i=0; i<CP_Deriv::nDer; i++ )
857  stack.localEnergyFluxJacobian[TAG::NEXT][i] = 0.0;
858  stack.localEnergyFluxJacobian_dQ[TAG::NEXT][0] =0;
859  stack.localEnergyFlux[TAG::NEXT] =0;
860  }
861 
862  }
863  }
864  // Setup Jacobian global row indicies
865  // equations for COMPONENT + ENERGY balances
866  globalIndex eqnRowIndices[2]{};
867 
868  // energy balance equations
869  eqnRowIndices[TAG::CURRENT ] = row_current;
870  eqnRowIndices[TAG::NEXT ] = row_next;
871 
872 
873  // Setup Jacobian global col indicies ( Mapping from local jac order to well jac order)
874  globalIndex dofColIndices[CP_Deriv::nDer]{};
875  globalIndex dofColIndices_dRate = stack.offsetCurrent + WJ_COFFSET::dQ;
876 
877  int ioff=0;
878  // Indice storage order reflects local jac col storage order CP::Deriv order P T DENS
879  // well jacobian order is P DENS Q T
880  dofColIndices[ioff++] = stack.offsetUp + WJ_COFFSET::dP;
881 
882  if constexpr ( IS_THERMAL )
883  {
884  dofColIndices[ioff++] = stack.offsetUp + WJ_COFFSET::dT;
885  }
886  for( integer jdof = 0; jdof < NC; ++jdof )
887  {
888  dofColIndices[ioff++] = stack.offsetUp + WJ_COFFSET::dC+ jdof;
889  }
890  // Note this updates diag and offdiag
891  for( integer i = 0; i < 2; ++i )
892  {
893  if( eqnRowIndices[i] >= 0 && eqnRowIndices[i] < m_localMatrix.numRows() )
894  {
895  m_localMatrix.template addToRow< parallelDeviceAtomic >( eqnRowIndices[i],
896  &dofColIndices_dRate,
897  stack.localEnergyFluxJacobian_dQ[i],
898  1 );
899  m_localMatrix.template addToRowBinarySearchUnsorted< parallelDeviceAtomic >( eqnRowIndices[i],
900  dofColIndices,
901  stack.localEnergyFluxJacobian[i],
902  CP_Deriv::nDer );
903  RAJA::atomicAdd( parallelDeviceAtomic{}, &m_localRhs[eqnRowIndices[i]], stack.localEnergyFlux[i] );
904  }
905  }
906  }
907 
908  }
909 
919  inline
920  void computeFlux( localIndex const iwelem, StackVariables & stack ) const
921  {
922  Base::computeFlux ( iwelem, stack, [&] ( localIndex const & iwelemNext
923  , localIndex const & iwelemUp
924  , real64 const & currentConnRate
925  , real64 const (&dCompFrac_dCompDens)[NC][NC] )
926  {
927 
928  if( iwelemNext < 0 && !m_isProducer ) // exit connection, injector
929  {
930  real64 eflux=0;
931  real64 eflux_dq=0;
932  for( integer ip = 0; ip < m_numPhases; ++ip )
933  {
934  eflux += m_phaseEnthalpy[iwelemUp][0][ip]* m_phaseFraction[iwelemUp][0][ip];
935  eflux_dq += m_phaseEnthalpy[iwelemUp][0][ip] * m_phaseFraction[iwelemUp][0][ip];
936 
937  stack.localEnergyFluxJacobian[0] [CP_Deriv::dP] += m_phaseEnthalpy[iwelemUp][0][ip]*m_dPhaseFraction[iwelemUp][0][ip][CP_Deriv::dP]
938  + m_dPhaseEnthalpy[iwelemUp][0][ip][CP_Deriv::dP]*m_phaseFraction[iwelemUp][0][ip];
939  stack.localEnergyFluxJacobian[0] [CP_Deriv::dT] += m_phaseEnthalpy[iwelemUp][0][ip]*m_dPhaseFraction[iwelemUp][0][ip][CP_Deriv::dT]
940  + m_dPhaseEnthalpy[iwelemUp][0][ip][CP_Deriv::dT]*m_phaseFraction[iwelemUp][0][ip];
941 
942  real64 dProp1_dC[numComp]{};
943  applyChainRule( numComp, dCompFrac_dCompDens, m_dPhaseEnthalpy[iwelemUp][0][ip], dProp1_dC, CP_Deriv::dC );
944  real64 dProp2_dC[numComp]{};
945  applyChainRule( numComp, dCompFrac_dCompDens, m_dPhaseFraction[iwelemUp][0][ip], dProp2_dC, CP_Deriv::dC );
946  for( integer dof=0; dof < numComp; dof++ )
947  {
948  stack.localEnergyFluxJacobian[0] [CP_Deriv::dC+dof] += m_phaseEnthalpy[iwelemUp][0][ip]*dProp2_dC[dof]
949  + dProp1_dC[dof]*m_phaseFraction[iwelemUp][0][ip];
950  }
951  }
952  for( integer dof=0; dof < CP_Deriv::nDer; dof++ )
953  {
954  stack.localEnergyFluxJacobian[0] [dof] *= -m_dt*currentConnRate;
955  }
956  // Energy equation
957  stack.localEnergyFlux[0] = -m_dt * eflux * currentConnRate;
958  stack.localEnergyFluxJacobian_dQ[0][0] = -m_dt * eflux_dq;
959  }
960  else if( ( iwelemNext < 0 && m_isProducer ) ) // exit connection, producer
961  {
962  real64 eflux=0;
963  real64 eflux_dq=0;
964  for( integer ip = 0; ip < m_numPhases; ++ip )
965  {
966  eflux += m_phaseEnthalpy[iwelemUp][0][ip]* m_phaseFraction[iwelemUp][0][ip];
967  eflux_dq += m_phaseEnthalpy[iwelemUp][0][ip] * m_phaseFraction[iwelemUp][0][ip];
968  stack.localEnergyFluxJacobian[0] [CP_Deriv::dP] += m_phaseEnthalpy[iwelemUp][0][ip]*m_dPhaseFraction[iwelemUp][0][ip][CP_Deriv::dP]
969  + m_dPhaseEnthalpy[iwelemUp][0][ip][CP_Deriv::dP]*m_phaseFraction[iwelemUp][0][ip];
970  stack.localEnergyFluxJacobian[0] [CP_Deriv::dT] += m_phaseEnthalpy[iwelemUp][0][ip]*m_dPhaseFraction[iwelemUp][0][ip][CP_Deriv::dT]
971  + m_dPhaseEnthalpy[iwelemUp][0][ip][CP_Deriv::dT]*m_phaseFraction[iwelemUp][0][ip];
972 
973  real64 dProp1_dC[numComp]{};
974  applyChainRule( numComp, dCompFrac_dCompDens, m_dPhaseEnthalpy[iwelemUp][0][ip], dProp1_dC, CP_Deriv::dC );
975  real64 dProp2_dC[numComp]{};
976  applyChainRule( numComp, dCompFrac_dCompDens, m_dPhaseFraction[iwelemUp][0][ip], dProp2_dC, CP_Deriv::dC );
977  for( integer dof=0; dof < numComp; dof++ )
978  {
979  stack.localEnergyFluxJacobian[0] [CP_Deriv::dC+dof] += m_phaseEnthalpy[iwelemUp][0][ip]*dProp2_dC[dof]
980  + dProp1_dC[dof]*m_phaseFraction[iwelemUp][0][ip];
981  }
982 
983  }
984 
985  for( integer dof=0; dof < CP_Deriv::nDer; dof++ )
986  {
987  stack.localEnergyFluxJacobian[0][dof] *= -m_dt*currentConnRate;
988  }
989  stack.localEnergyFlux[0] = -m_dt * eflux * currentConnRate;
990  stack.localEnergyFluxJacobian_dQ[0][0] = -m_dt*eflux_dq;
991  }
992  else
993  {
994  real64 eflux=0;
995  real64 eflux_dq=0;
996  for( integer ip = 0; ip < m_numPhases; ++ip )
997  {
998  eflux += m_phaseEnthalpy[iwelemUp][0][ip]* m_phaseFraction[iwelemUp][0][ip];
999  eflux_dq += m_phaseEnthalpy[iwelemUp][0][ip] * m_phaseFraction[iwelemUp][0][ip];
1000 
1001  real64 dprop_dp = m_phaseEnthalpy[iwelemUp][0][ip]*m_dPhaseFraction[iwelemUp][0][ip][CP_Deriv::dP]
1002  + m_dPhaseEnthalpy[iwelemUp][0][ip][CP_Deriv::dP]*m_phaseFraction[iwelemUp][0][ip];
1003  real64 dprop_dt = m_phaseEnthalpy[iwelemUp][0][ip]*m_dPhaseFraction[iwelemUp][0][ip][CP_Deriv::dT]
1004  + m_dPhaseEnthalpy[iwelemUp][0][ip][CP_Deriv::dT]*m_phaseFraction[iwelemUp][0][ip];
1005 
1006  stack.localEnergyFluxJacobian[TAG::NEXT ] [CP_Deriv::dP] += dprop_dp;
1007  stack.localEnergyFluxJacobian[TAG::NEXT] [CP_Deriv::dT] += dprop_dt;
1008 
1009  stack.localEnergyFluxJacobian[TAG::CURRENT ] [CP_Deriv::dP] += dprop_dp;
1010  stack.localEnergyFluxJacobian[TAG::CURRENT] [CP_Deriv::dT] += dprop_dt;
1011 
1012  real64 dPE_dC[numComp]{};
1013  applyChainRule( numComp, dCompFrac_dCompDens, m_dPhaseEnthalpy[iwelemUp][0][ip], dPE_dC, CP_Deriv::dC );
1014  real64 dPF_dC[numComp]{};
1015  applyChainRule( numComp, dCompFrac_dCompDens, m_dPhaseFraction[iwelemUp][0][ip], dPF_dC, CP_Deriv::dC );
1016 
1017  for( integer dof=0; dof < numComp; dof++ )
1018  {
1019  stack.localEnergyFluxJacobian[TAG::NEXT ][CP_Deriv::dC+dof] += m_phaseEnthalpy[iwelemUp][0][ip]*dPF_dC[dof]
1020  +dPE_dC[dof]*m_phaseFraction[iwelemUp][0][ip];
1021  stack.localEnergyFluxJacobian[TAG::CURRENT ][CP_Deriv::dC+dof] += m_phaseEnthalpy[iwelemUp][0][ip]*dPF_dC[dof]
1022  +dPE_dC[dof]*m_phaseFraction[iwelemUp][0][ip];
1023  }
1024  }
1025  stack.localEnergyFlux[TAG::NEXT ] = m_dt * eflux * currentConnRate;
1026  stack.localEnergyFlux[TAG::CURRENT ] = -m_dt * eflux * currentConnRate;
1027  stack.localEnergyFluxJacobian_dQ [TAG::NEXT ][0] = m_dt * eflux_dq;
1028  stack.localEnergyFluxJacobian_dQ [TAG::CURRENT][0] = -m_dt * eflux_dq;
1029  for( integer dof=0; dof < CP_Deriv::nDer; dof++ )
1030  {
1031  stack.localEnergyFluxJacobian[TAG::NEXT ][dof] *= m_dt*currentConnRate;
1032  stack.localEnergyFluxJacobian[TAG::CURRENT ][dof] *= -m_dt*currentConnRate;
1033  }
1034  }
1035 
1036  } );
1037 
1038  }
1039 
1040 
1049  template< typename POLICY, typename KERNEL_TYPE >
1050  static void
1051  launch( localIndex const numElements,
1052  KERNEL_TYPE const & kernelComponent )
1053  {
1055  forAll< POLICY >( numElements, [=] GEOS_HOST_DEVICE ( localIndex const ie )
1056  {
1057  typename KERNEL_TYPE::StackVariables stack( 1 );
1058 
1059  kernelComponent.setup( ie, stack );
1060  kernelComponent.computeFlux( ie, stack );
1061  kernelComponent.complete( ie, stack );
1062  } );
1063  }
1064 
1065 protected:
1070 
1073 
1077 
1081 
1082 
1083 };
1084 
1089 {
1090 public:
1091 
1105  template< typename POLICY >
1106  static void
1107  createAndLaunch( integer const numComps,
1108  real64 const dt,
1109  globalIndex const rankOffset,
1110  BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags,
1111  string const dofKey,
1112  WellControls const & wellControls,
1113  WellElementSubRegion const & subRegion,
1114  MultiFluidBase const & fluid,
1115  CRSMatrixView< real64, globalIndex const > const & localMatrix,
1116  arrayView1d< real64 > const & localRhs )
1117  {
1118  isothermalCompositionalMultiphaseBaseKernels::internal::kernelLaunchSelectorCompSwitch( numComps, [&]( auto NC )
1119  {
1120  integer constexpr NUM_COMP = NC();
1121 
1122  using kernelType = FaceBasedAssemblyKernel< NUM_COMP >;
1123  kernelType kernel( dt, rankOffset, dofKey, wellControls, subRegion, fluid, localMatrix, localRhs, kernelFlags );
1124  kernelType::template launch< POLICY >( subRegion.size(), kernel );
1125  } );
1126  }
1127 };
1128 
1129 } // end namespace thermalCompositionalMultiphaseWellKernels
1130 
1131 } // end namespace geos
1132 
1133 #endif // GEOS_PHYSICSSOLVERS_FLUIDFLOW_WELLS_THERMALCOMPOSITIONALMULTIPHASEWELLKERNELS_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.
#define GEOS_ERROR(...)
Raise a hard error and terminate the program.
Definition: Logger.hpp:220
#define GEOS_MARK_FUNCTION
Mark function with both Caliper and NVTX if enabled.
The ObjectManagerBase is the base object of all object managers in the mesh data hierachy.
array1d< integer > const & ghostRank()
Get the ghost information of each object.
real64 getConstraintValue(real64 const &currentTime) const
Get the target bottom hole pressure value.
This class describes the controls used to operate a well.
This class describes a collection of local well elements and perforations.
Define the interface for the assembly kernel in charge of accumulation and volume balance.
Define the interface for the assembly kernel in charge of flux terms.
Define the interface for the property kernel in charge of computing the total mass density.
GEOS_DECLTYPE_AUTO_RETURN getReference(LOOKUP_TYPE const &lookup) const
Look up a wrapper and get reference to wrapped object.
Definition: Group.hpp:1273
localIndex size() const
Get the "size" of the group, which determines the number of elements in resizable wrappers.
Definition: Group.hpp:1315
Define the base interface for the property update kernels.
Define the base interface for the residual calculations.
static void createAndLaunch(localIndex const numComps, localIndex const numPhases, integer const thermalEffectsEnabled, integer const isProducer, globalIndex const rankOffset, BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags, string const dofKey, WellElementSubRegion const &subRegion, MultiFluidBase const &fluid, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs)
Create a new kernel and launch.
Define the interface for the assembly kernel in charge of thermal accumulation and volume balance.
arrayView2d< real64 const > const m_dPoro_dTemp
View on derivative of porosity w.r.t temperature.
GEOS_HOST_DEVICE void computeVolumeBalance(localIndex const ei, StackVariables &stack) const
Compute the local volume balance contributions to the residual and Jacobian.
ElementBasedAssemblyKernel(localIndex const numPhases, bool const thermalEffectsEnabled, integer const isProducer, globalIndex const rankOffset, string const dofKey, WellElementSubRegion const &subRegion, MultiFluidBase const &fluid, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs, BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > const kernelFlags)
Constructor.
arrayView3d< real64 const, multifluid::USD_PHASE > m_phaseInternalEnergy_n
Views on phase internal energy.
GEOS_HOST_DEVICE void computeAccumulation(localIndex const ei, StackVariables &stack) const
Compute the local accumulation contributions to the residual and Jacobian.
GEOS_HOST_DEVICE void setup(localIndex const ei, StackVariables &stack) const
Performs the setup phase for the kernel.
static void createAndLaunch(integer const numComps, real64 const dt, globalIndex const rankOffset, BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags, string const dofKey, WellControls const &wellControls, WellElementSubRegion const &subRegion, MultiFluidBase const &fluid, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs)
Create a new kernel and launch.
Define the interface for the assembly kernel in charge of flux terms.
FaceBasedAssemblyKernel(real64 const dt, globalIndex const rankOffset, string const wellDofKey, WellControls const &wellControls, WellElementSubRegion const &subRegion, MultiFluidBase const &fluid, CRSMatrixView< real64, globalIndex const > const &localMatrix, arrayView1d< real64 > const &localRhs, BitFlags< isothermalCompositionalMultiphaseBaseKernels::KernelFlags > kernelFlags)
Constructor for the kernel interface.
bool const m_thermalEffectsEnabled
Flag specifying whether thermal effects are enabled.
arrayView3d< real64 const, multifluid::USD_PHASE > m_phaseEnthalpy
Views on phase enthalpy.
GEOS_HOST_DEVICE void computeFlux(localIndex const iwelem, StackVariables &stack) const
Compute the local flux contributions to the residual and Jacobian.
arrayView1d< globalIndex const > m_globalWellElementIndex
Global index of local element.
arrayView3d< real64 const, multifluid::USD_PHASE > const m_phaseFraction
Element phase fraction.
static void launch(localIndex const numElements, KERNEL_TYPE const &kernelComponent)
Performs the kernel launch.
static void createAndLaunch(integer const numComp, globalIndex const rankOffset, string const &dofKey, arrayView1d< real64 const > const &localResidual, WellElementSubRegion const &subRegion, MultiFluidBase const &fluid, WellControls const &wellControls, real64 const time, real64 const dt, real64 const minNormalizer, real64(&residualNorm)[2])
Create a new kernel and launch.
arrayView3d< real64 const, multifluid::USD_PHASE > const m_phaseDens_n
View on phase/total density at the previous converged time step.
localIndex const m_iwelemControl
Index of the element where the control is enforced.
virtual GEOS_HOST_DEVICE void computeLinf(localIndex const iwelem, LinfStackVariables &stack) const override
Compute the local values for the Linf norm.
virtual GEOS_HOST_DEVICE void computeL2(localIndex const iwelem, L2StackVariables &stack) const override
Compute the local values and normalizer for the L2 norm.
bool const m_isProducer
Flag indicating whether the well is a producer or an injector.
bool const m_isLocallyOwned
Flag indicating whether the well is locally owned or not.
static void createAndLaunch(integer const numComp, integer const numPhase, ObjectManagerBase &subRegion, MultiFluidBase const &fluid)
Create a new kernel and launch.
Define the interface for the property kernel in charge of computing the total mass density.
GEOS_HOST_DEVICE void compute(localIndex const ei) const
Compute the total mass density in an element.
TotalMassDensityKernel(ObjectManagerBase &subRegion, MultiFluidBase const &fluid)
Constructor.
ConstraintTypeId getControl() const
Get the control type for the well.
stdVector< WellConstraintBase const * > getRateConstraints() const
Gets a list of rate constraints.
WellConstraintBase * getCurrentConstraint()
Get the current consrtaint.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:179
StackArray< T, 2, MAXSIZE > stackArray2d
Alias for 2D stack array.
Definition: DataTypes.hpp:203
GEOS_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
Definition: DataTypes.hpp:87
StackArray< T, 1, MAXSIZE > stackArray1d
Alias for 1D stack array.
Definition: DataTypes.hpp:187
ArraySlice< T, 2, USD > arraySlice2d
Alias for 2D array slice.
Definition: DataTypes.hpp:199
double real64
64-bit floating point type.
Definition: DataTypes.hpp:98
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:84
ArraySlice< T, 1, USD > arraySlice1d
Alias for 1D array slice.
Definition: DataTypes.hpp:183
LvArray::CRSMatrixView< T, COL_INDEX, INDEX_TYPE const, LvArray::ChaiBuffer > CRSMatrixView
Alias for CRS Matrix View.
Definition: DataTypes.hpp:309
ArrayView< T, 4, USD > arrayView4d
Alias for 4D array view.
Definition: DataTypes.hpp:227
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Definition: DataTypes.hpp:195
int integer
Signed integer type.
Definition: DataTypes.hpp:81
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:175
ArrayView< T, 3, USD > arrayView3d
Alias for 3D array view.
Definition: DataTypes.hpp:211
Kernel variables (dof numbers, jacobian and residual) located on the stack.
stackArray1d< real64, maxNumElems > localEnergyFlux
Storage for the face local residual vector (energy equation)
stackArray2d< real64, maxNumElems *maxStencilSize > localEnergyFluxJacobian_dQ
Storage for the face local Jacobian matrix dQ only.
stackArray2d< real64, maxNumElems *maxStencilSize *CP_Deriv::nDer > localEnergyFluxJacobian
Storage for the face local energy Jacobian matrix dC dP dT.