Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: feature/byer3/thermal well #3156

Open
wants to merge 76 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
3c5801c
Add support for mass constraits (inj wells only)
tjb-ltk Dec 20, 2023
de5b3da
Mass constraint test cases - fixed value & table input
tjb-ltk Dec 20, 2023
993296d
add proper isZero check
tjb-ltk Dec 22, 2023
7bd1201
Merge branch 'develop' into feature/byer3/mass_inj_const
jafranc Dec 28, 2023
825d27d
Throw error if massinj constraint and useSurfaceConditions set to 0, …
tjb-ltk Jan 3, 2024
c94eed6
run make uncrustify_style
tjb-ltk Jan 8, 2024
701bce6
fix for UseSurfaceConditions set to 1
tjb-ltk Jan 8, 2024
6858b81
Thermal well devs
tjb-ltk Feb 8, 2024
8fd8f40
Fix rel mode compiler errors ++
tjb-ltk Feb 13, 2024
384e29e
Load well prop ders in containers similar to reservoir
tjb-ltk Feb 16, 2024
064cc07
Added col indexing for well jacobian terms, includes specialization f…
tjb-ltk Mar 13, 2024
aee32bc
thermal devs- 1) energy eqn for perf in/out flows, 2) reservoir well …
tjb-ltk Apr 15, 2024
6323c13
1) fix isthermal well field runtime error 2) fix refactored isotherm…
tjb-ltk Apr 17, 2024
34a2a01
thermal well devs - 1) derivative bugfixes 2) added thermal to post l…
tjb-ltk Apr 22, 2024
828b009
thermal devs - 1) fixes for > 1 well seg 2) added soln updating/scali…
tjb-ltk May 1, 2024
8b10201
1) Added simple temperature constraint 2) Fixes from running numerica…
tjb-ltk May 13, 2024
25e3503
missing merge in previous commit
tjb-ltk May 14, 2024
aa800e3
more merge fixes
tjb-ltk May 14, 2024
c9138c5
1) add iterative solver config for thermal res+well 2) skip well cal…
tjb-ltk May 24, 2024
5d95d0f
merge dev 20240526
tjb-ltk May 26, 2024
b4983b0
merge with dev
tjb-ltk May 28, 2024
d297111
code cleanup
tjb-ltk May 31, 2024
0ec258e
Use phase fraction not phase vol fraction ..and ders
tjb-ltk May 31, 2024
a489169
fix for spe11b
tjb-ltk Jun 3, 2024
420855d
fix pedantry
tjb-ltk Jun 3, 2024
32ae6b9
1) add Aww numerical derivative unit tests, 2) thermal index fix
tjb-ltk Jun 5, 2024
bea94d5
more pedantics
tjb-ltk Jun 5, 2024
887192d
pedantics
tjb-ltk Jun 5, 2024
b9b6676
remove debug
tjb-ltk Jun 5, 2024
99efdea
compiler warning error
tjb-ltk Jun 6, 2024
2b8ca8d
fix file path
tjb-ltk Jun 7, 2024
86ed597
lets try all combinations of file input path
tjb-ltk Jun 10, 2024
4de08c1
Merge remote-tracking branch 'origin/feature/byer3/thermal_well' into…
tjb-ltk Jun 14, 2024
7c8fb31
updated to latest dev/modules
tjb-ltk Jun 14, 2024
0e2b420
cleanup
tjb-ltk Jun 14, 2024
11e6056
mod fix
tjb-ltk Jun 14, 2024
dfaa419
Fix runner build errors
tjb-ltk Jun 14, 2024
f508369
move mpi com outside of subregion loop
tjb-ltk Jun 18, 2024
bce0bf9
build fix for ubunnto etal
tjb-ltk Jun 18, 2024
a1b70ac
build fix for ubunnto etal t2
tjb-ltk Jun 18, 2024
b3ed475
build fix for ubunnto etal t3
tjb-ltk Jun 18, 2024
e4edc21
move input file data to char array, write out array to file, delete file
tjb-ltk Jun 18, 2024
352ca5d
uncrustify
tjb-ltk Jun 18, 2024
574a18e
testing
tjb-ltk Jun 18, 2024
25fae7f
remove dead code
tjb-ltk Jun 19, 2024
371eb04
mpi parallel fix for closed wells
tjb-ltk Jun 21, 2024
9c7a462
1) fix temp constraint eqn setup for well spanning > 1 cores , 2) wel…
tjb-ltk Jul 9, 2024
b5b3413
Merge branch 'develop' into feature/byer3/thermal_well
rrsettgast Jul 11, 2024
2e1bb1e
resolve latest merge
tjb-ltk Jul 11, 2024
dc1faee
Merge branch 'develop' into feature/byer3/thermal_well
tjb-ltk Jul 22, 2024
561710e
1) remove schema addition for current nonlinear stats , 2) remove tes…
tjb-ltk Jul 22, 2024
fbf9898
only register region state props once
tjb-ltk Jul 23, 2024
e6db741
1) for shutin wells zero completion perforation rates for clarity in …
tjb-ltk Jul 29, 2024
109e43f
Merge branch 'develop' into feature/byer3/thermal_well
tjb-ltk Jul 29, 2024
8963ffa
code cleanup - remove partial thermal impl for single phase
tjb-ltk Jul 30, 2024
25d8e2b
run non-automatic uncrusty
tjb-ltk Jul 30, 2024
eee00a3
one more time
tjb-ltk Jul 30, 2024
11d1d80
revert single phase well initialization to dev ver, fix will be adde…
tjb-ltk Aug 1, 2024
c51952f
restructure for GPU reqs
tjb-ltk Aug 5, 2024
47eada8
remove tjb specifics
tjb-ltk Aug 5, 2024
3a70471
Fixes for unittests when GPU enabled
tjb-ltk Aug 9, 2024
d7c6759
Merge branch 'develop' into feature/byer3/thermal_well - Chasing the …
tjb-ltk Aug 9, 2024
5b66e34
fix merge error
tjb-ltk Aug 9, 2024
127d4cf
test add instead of remove plus insert.
CusiniM Aug 10, 2024
0f46cdc
Merge remote-tracking branch 'origin/develop' into feature/byer3/ther…
CusiniM Aug 10, 2024
4da9ef7
Merge branch 'feature/byer3/thermal_well' of github.com:GEOS-DEV/GEOS…
CusiniM Aug 10, 2024
b711a87
Remove & and add const.
CusiniM Aug 10, 2024
17cc023
Update src/coreComponents/unitTests/fluidFlowTests/testCompFlowUtils.hpp
CusiniM Aug 10, 2024
720901c
1) dont allocate temperature_n for isothermal run, 2) uncrustify style
tjb-ltk Aug 12, 2024
fdeea3a
remove debug std::cout
tjb-ltk Aug 20, 2024
4cf2106
remove std::cout
tjb-ltk Sep 5, 2024
35cf15b
code cleanup
tjb-ltk Sep 18, 2024
f1f633b
Code cleanup
tjb-ltk Sep 19, 2024
e659c7c
move KernalLaunchSelectors from common to physicsSolvers
tjb-ltk Oct 9, 2024
3162266
PR requested changes
tjb-ltk Oct 24, 2024
988ae2b
dev merge
tjb-ltk Oct 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 167 additions & 0 deletions src/coreComponents/common/KernelLaunchSelectors.hpp
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this file sits in common it should be a lot more generic IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could move to fluidflow...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to physicsSolvers

Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
/*
* ------------------------------------------------------------------------------------------------------------
* SPDX-License-Identifier: LGPL-2.1-only
*
* Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
* Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
* Copyright (c) 2018-2020 TotalEnergies
* Copyright (c) 2019- GEOSX Contributors
* All rights reserved
*
* See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
* ------------------------------------------------------------------------------------------------------------
*/

/**
* @file KernelLaunchSelectors.hpp
*/

#ifndef GEOS_COMMON_KERNELLAUNCHSELECTORS_HPP
#define GEOS_COMMON_KERNELLAUNCHSELECTORS_HPP

namespace geos
{
namespace internal
{

template< typename T, typename LAMBDA >
void kernelLaunchSelectorThermalSwitch( T value, LAMBDA && lambda )
{
static_assert( std::is_integral< T >::value, "kernelLaunchSelectorThermalSwitch: type should be integral" );

switch( value )
{
case 0:
{ lambda( std::integral_constant< T, 0 >() ); return; }
case 1:
{ lambda( std::integral_constant< T, 1 >() ); return; }

default:
{ GEOS_ERROR( "Unsupported thermal state: " << value ); }
}
}

template< typename T, typename LAMBDA >
void kernelLaunchSelectorCompThermSwitch( T value, bool const isThermal, LAMBDA && lambda )
{
static_assert( std::is_integral< T >::value, "kernelLaunchSelectorCompSwitch: value type should be integral" );

if( isThermal )
CusiniM marked this conversation as resolved.
Show resolved Hide resolved
{
switch( value )
{
case 1:
{
lambda( std::integral_constant< T, 1 >(), std::integral_constant< T, 1 >() ); return;
}
case 2:
{ lambda( std::integral_constant< T, 2 >(), std::integral_constant< T, 1 >() ); return; }
case 3:
{ lambda( std::integral_constant< T, 3 >(), std::integral_constant< T, 1 >() ); return; }
case 4:
{ lambda( std::integral_constant< T, 4 >(), std::integral_constant< T, 1 >() ); return; }
case 5:
{ lambda( std::integral_constant< T, 5 >(), std::integral_constant< T, 1 >()); return; }
default:
{ GEOS_ERROR( "Unsupported number of components: " << value ); }
}
}
else
{
switch( value )
{
case 1:
{
lambda( std::integral_constant< T, 1 >(), std::integral_constant< T, 0 >() ); return;
}
case 2:
{ lambda( std::integral_constant< T, 2 >(), std::integral_constant< T, 0 >() ); return; }
case 3:
{ lambda( std::integral_constant< T, 3 >(), std::integral_constant< T, 0 >() ); return; }
case 4:
{ lambda( std::integral_constant< T, 4 >(), std::integral_constant< T, 0 >() ); return; }
case 5:
{ lambda( std::integral_constant< T, 5 >(), std::integral_constant< T, 0 >() ); return; }
default:
{ GEOS_ERROR( "Unsupported number of components: " << value ); }
}
}
}


template< typename T, typename LAMBDA >
void kernelLaunchSelectorCompPhaseSwitch( T value, T n_phase, LAMBDA && lambda )
{
static_assert( std::is_integral< T >::value, "kernelLaunchSelectorCompSwitch: value type should be integral" );

if( n_phase == 1 )
{
switch( value )
{
case 1:
{
lambda( std::integral_constant< T, 1 >(), std::integral_constant< T, 1 >() ); return;
}
case 2:
{ lambda( std::integral_constant< T, 2 >(), std::integral_constant< T, 1 >() ); return; }
case 3:
{ lambda( std::integral_constant< T, 3 >(), std::integral_constant< T, 1 >() ); return; }
case 4:
{ lambda( std::integral_constant< T, 4 >(), std::integral_constant< T, 1 >() ); return; }
case 5:
tjb-ltk marked this conversation as resolved.
Show resolved Hide resolved
{ lambda( std::integral_constant< T, 5 >(), std::integral_constant< T, 1 >() ); return; }
default:
{ GEOS_ERROR( "Unsupported number of components: " << value ); }
}
}
else if( n_phase == 2 )
{
switch( value )
{
case 1:
{
lambda( std::integral_constant< T, 1 >(), std::integral_constant< T, 2 >() ); return;
}
case 2:
{ lambda( std::integral_constant< T, 2 >(), std::integral_constant< T, 2 >() ); return; }
case 3:
{ lambda( std::integral_constant< T, 3 >(), std::integral_constant< T, 2 >() ); return; }
case 4:
{ lambda( std::integral_constant< T, 4 >(), std::integral_constant< T, 2 >() ); return; }
case 5:
{ lambda( std::integral_constant< T, 5 >(), std::integral_constant< T, 2 >() ); return; }
default:
{ GEOS_ERROR( "Unsupported number of components: " << value ); }
}

}
else if( n_phase == 3 )
{
switch( value )
{
case 1:
{
lambda( std::integral_constant< T, 1 >(), std::integral_constant< T, 3 >() ); return;
}
case 2:
{ lambda( std::integral_constant< T, 2 >(), std::integral_constant< T, 3 >() ); return; }
case 3:
{ lambda( std::integral_constant< T, 3 >(), std::integral_constant< T, 3 >() ); return; }
case 4:
{ lambda( std::integral_constant< T, 4 >(), std::integral_constant< T, 3 >() ); return; }
case 5:
{ lambda( std::integral_constant< T, 5 >(), std::integral_constant< T, 3 >() ); return; }
default:
{ GEOS_ERROR( "Unsupported number of components: " << value ); }
}
}
else
{
{ GEOS_ERROR( "Unsupported number of phases: " << n_phase ); }
}
}
} // end namspace internal
} // end namespace geos


#endif // GEOS_COMMON_KERNELLAUNCHSELECTORS_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ CO2BrineFluid< PHASE1, PHASE2, FLASH >::KernelWrapper::

if( m_isThermal )
{

m_phase1.enthalpy.compute( pressure,
temperatureInCelsius,
phaseCompFraction.value[ip1].toSliceConst(), phaseCompFraction.derivs[ip1].toSliceConst(),
Expand Down
40 changes: 40 additions & 0 deletions src/coreComponents/constitutive/fluid/multifluid/Layouts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,23 @@ namespace geos
{
namespace constitutive
{

namespace singlefluid
{
struct DerivativeOffset
{
/// index of derivative wrt pressure
static integer constexpr dP = 0;
/// index of derivative wrt temperature
static integer constexpr dT = 1;

};
}
namespace multifluid
{

/// indices of pressure, temperature, and composition derivatives
// Fix me - if the order is changed the code crashes
struct DerivativeOffset
{
/// index of derivative wrt pressure
Expand All @@ -44,6 +57,33 @@ struct DerivativeOffset
static integer constexpr dC = 2;
};

/// indices of pressure, temperature, and composition derivatives
template< integer NC, integer IS_THERMAL >
struct DerivativeOffsetC {};

template< integer NC >
struct DerivativeOffsetC< NC, 1 >
{
/// index of derivative wrt pressure
static integer constexpr dP = 0;
/// index of derivative wrt temperature
static integer constexpr dT = dP + 1;
/// index of first derivative wrt compositions
static integer constexpr dC = dP+2;
/// number of derivatives
static integer constexpr nDer = NC + 2;
};
template< integer NC >
struct DerivativeOffsetC< NC, 0 >
{
/// index of derivative wrt pressure
static integer constexpr dP = 0;
/// index of first derivative wrt compositions
static integer constexpr dC = dP+1;
/// number of derivatives
static integer constexpr nDer = NC + 1;
};

#if defined( GEOS_USE_DEVICE )

/// Constitutive model phase property array layout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,14 @@ class SingleFluidBase : public ConstitutiveBase
virtual real64 defaultDensity() const = 0;
virtual real64 defaultViscosity() const = 0;

/**
* @brief Get the thermal flag.
* @return boolean value indicating whether the model can be used to assemble the energy balance equation or not
* @detail if isThermal is true, the constitutive model compute the enthalpy and internal energy of the phase.
* This can be used to check the compatibility of the constitutive model with the solver
*/
virtual bool isThermal() const { return false; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need to add one with true in ThermalCompressibleSinglePhaseFluid ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tjb-ltk Is this resolved?


protected:

virtual void postInputInitialization() override;
Expand Down
4 changes: 2 additions & 2 deletions src/coreComponents/dataRepository/Group.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@


#include <iostream>
#include <typeinfo>
CusiniM marked this conversation as resolved.
Show resolved Hide resolved

#ifndef NOCHARTOSTRING_KEYLOOKUP
/// macro definition to enable/disable char * lookups
Expand Down Expand Up @@ -455,7 +456,6 @@ class Group
{
using T = std::conditional_t< std::is_const< CONTAINERTYPE >::value, CASTTYPE const, CASTTYPE >;
T * const castedContainer = dynamic_cast< T * >( &container );

if( castedContainer != nullptr )
{
lambda( *castedContainer );
Expand Down Expand Up @@ -596,6 +596,7 @@ class Group
void forSubGroups( LOOKUP_CONTAINER const & subGroupKeys, LAMBDA && lambda )
{
localIndex counter = 0;

for( auto const & subgroup : subGroupKeys )
{
applyLambdaToContainer< GROUPTYPE, GROUPTYPES... >( getGroup( subgroup ), [&]( auto & castedSubGroup )
Expand Down Expand Up @@ -879,7 +880,6 @@ class Group

for( auto const & subGroupIter : m_subGroups )
{
std::cout << indent << subGroupIter.second->getName() << std::endl;
CusiniM marked this conversation as resolved.
Show resolved Hide resolved
subGroupIter.second->generateDataStructureSkeleton( level + 1 );
}
}
Expand Down
1 change: 1 addition & 0 deletions src/coreComponents/linearAlgebra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ if( ENABLE_HYPRE )
interfaces/hypre/mgrStrategies/SinglePhaseReservoirHybridFVM.hpp
interfaces/hypre/mgrStrategies/SolidMechanicsEmbeddedFractures.hpp
interfaces/hypre/mgrStrategies/ThermalCompositionalMultiphaseFVM.hpp
interfaces/hypre/mgrStrategies/ThermalCompositionalMultiphaseReservoirFVM.hpp
interfaces/hypre/mgrStrategies/ThermalMultiphasePoromechanics.hpp
interfaces/hypre/mgrStrategies/ThermalSinglePhasePoromechanics.hpp )
list( APPEND linearAlgebra_sources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "linearAlgebra/interfaces/hypre/mgrStrategies/SinglePhaseReservoirFVM.hpp"
#include "linearAlgebra/interfaces/hypre/mgrStrategies/SinglePhaseReservoirHybridFVM.hpp"
#include "linearAlgebra/interfaces/hypre/mgrStrategies/ThermalCompositionalMultiphaseFVM.hpp"
#include "linearAlgebra/interfaces/hypre/mgrStrategies/ThermalCompositionalMultiphaseReservoirFVM.hpp"
#include "linearAlgebra/interfaces/hypre/mgrStrategies/ThermalSinglePhasePoromechanics.hpp"
#include "linearAlgebra/interfaces/hypre/mgrStrategies/ThermalMultiphasePoromechanics.hpp"
#include "linearAlgebra/interfaces/hypre/mgrStrategies/SolidMechanicsEmbeddedFractures.hpp"
Expand Down Expand Up @@ -112,6 +113,11 @@ void hypre::mgr::createMGR( LinearSolverParameters const & params,
setStrategy< ThermalCompositionalMultiphaseFVM >( params.mgr, numComponentsPerField, precond, mgrData );
break;
}
case LinearSolverParameters::MGR::StrategyType::thermalCompositionalMultiphaseReservoirFVM:
{
setStrategy< ThermalCompositionalMultiphaseReservoirFVM >( params.mgr, numComponentsPerField, precond, mgrData );
break;
}
case LinearSolverParameters::MGR::StrategyType::hybridSinglePhasePoromechanics:
{
setStrategy< HybridSinglePhasePoromechanics >( params.mgr, numComponentsPerField, precond, mgrData );
Expand Down
Loading