20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_RESIDUALNORMKERNEL_HPP
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONAL_RESIDUALNORMKERNEL_HPP
28 namespace isothermalCompositionalMultiphaseBaseKernels
52 constitutive::MultiFluidBase
const & fluid,
53 constitutive::CoupledSolidBase
const & solid,
54 real64 const minNormalizer )
68 LinfStackVariables & stack )
const override
79 if( valMass > stack.localValue[0] )
81 stack.localValue[0] = valMass;
88 if( valVol > stack.localValue[1] )
90 stack.localValue[1] = valVol;
96 L2StackVariables & stack )
const override
107 stack.localNormalizer[0] += massNormalizer;
114 stack.localValue[1] += val * val;
115 stack.localNormalizer[1] += massNormalizer;
156 template<
typename POLICY >
164 constitutive::MultiFluidBase
const & fluid,
165 constitutive::CoupledSolidBase
const & solid,
166 real64 const minNormalizer,
167 real64 (& residualNorm)[2],
168 real64 (& residualNormalizer)[2] )
173 ResidualNormKernel kernel( rankOffset, localResidual, dofNumber, ghostRank, numComps, subRegion, fluid, solid, minNormalizer );
174 if( normType == physicsSolverBaseKernels::NormType::Linf )
176 ResidualNormKernel::launchLinf< POLICY >( subRegion.
size(), kernel, residualNorm );
180 ResidualNormKernel::launchL2< POLICY >( subRegion.
size(), kernel, residualNorm, residualNormalizer );
#define GEOS_HOST_DEVICE
Marks a host-device function.
NormType
Type of norm used to check convergence TODO: find a way to put this inside the class.
arrayView1d< real64 const > getElementVolume() const
Get the volume of each element in this subregion.
array1d< integer > const & ghostRank()
Get the ghost information of each object.
GEOS_DECLTYPE_AUTO_RETURN getReference(LOOKUP_TYPE const &lookup) const
Look up a wrapper and get reference to wrapped object.
localIndex size() const
Get the "size" of the group, which determines the number of elements in resizable wrappers.
static void createAndLaunch(physicsSolverBaseKernels::NormType const normType, integer const numComps, globalIndex const rankOffset, string const dofKey, arrayView1d< real64 const > const &localResidual, ElementSubRegionBase const &subRegion, constitutive::MultiFluidBase const &fluid, constitutive::CoupledSolidBase const &solid, real64 const minNormalizer, real64(&residualNorm)[2], real64(&residualNormalizer)[2])
Create a new kernel and launch.
arrayView1d< real64 const > const m_volume
View on the volume.
arrayView2d< real64 const > const m_porosity_n
View on porosity at the previous converged time step.
arrayView2d< real64 const, constitutive::multifluid::USD_FLUID > const m_totalDens_n
View on total mass/molar density at the previous converged time step.
virtual GEOS_HOST_DEVICE void computeL2(localIndex const ei, L2StackVariables &stack) const override
Compute the local values and normalizer for the L2 norm.
integer const m_numComponents
Number of fluid coponents.
virtual GEOS_HOST_DEVICE void computeLinf(localIndex const ei, LinfStackVariables &stack) const override
Compute the local values for the Linf norm.
Define the base interface for the residual calculations.
real64 const m_minNormalizer
Value used to make sure that normalizers are never zero.
arrayView1d< globalIndex const > const m_dofNumber
View on the dof numbers.
GEOS_HOST_DEVICE integer ghostRank(localIndex const i) const
Getter for the ghost rank.
globalIndex const m_rankOffset
Offset for my MPI rank.
arrayView1d< real64 const > const m_localResidual
View on the local residual.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
GEOS_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
double real64
64-bit floating point type.
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
std::int32_t integer
Signed integer type.
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Array< T, 1 > array1d
Alias for 1D array.