Skip to content

Commit

Permalink
Implement relative permeabilities with tables on device (#1277)
Browse files Browse the repository at this point in the history
* completed initial implementation of table relperms on device

* addressed Sergey's comments; add unit test and three-phase interpolation

* add integrated tests

* defined KernelWrapper as nested class of TableFunction

* addressed Thomas' comments

* added check on the axis monotonicity

* updated integratedTests submodule

* updated integratedTests submodule
  • Loading branch information
francoishamon authored Feb 19, 2021
1 parent ec566dc commit b9fb6bc
Show file tree
Hide file tree
Showing 36 changed files with 1,792 additions and 550 deletions.
2 changes: 1 addition & 1 deletion integratedTests
3 changes: 3 additions & 0 deletions src/coreComponents/constitutive/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ set( constitutive_headers
relativePermeability/BrooksCoreyBakerRelativePermeability.hpp
relativePermeability/relativePermeabilitySelector.hpp
relativePermeability/VanGenuchtenBakerRelativePermeability.hpp
relativePermeability/TableRelativePermeability.hpp
relativePermeability/RelativePermeabilityInterpolators.hpp
capillaryPressure/CapillaryPressureBase.hpp
capillaryPressure/BrooksCoreyCapillaryPressure.hpp
capillaryPressure/VanGenuchtenCapillaryPressure.hpp
Expand Down Expand Up @@ -99,6 +101,7 @@ set( constitutive_sources
relativePermeability/BrooksCoreyRelativePermeability.cpp
relativePermeability/BrooksCoreyBakerRelativePermeability.cpp
relativePermeability/VanGenuchtenBakerRelativePermeability.cpp
relativePermeability/TableRelativePermeability.cpp
capillaryPressure/CapillaryPressureBase.cpp
capillaryPressure/BrooksCoreyCapillaryPressure.cpp
capillaryPressure/VanGenuchtenCapillaryPressure.cpp
Expand Down
17 changes: 0 additions & 17 deletions src/coreComponents/constitutive/ConstitutiveBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,6 @@
* ------------------------------------------------------------------------------------------------------------
*/

/*
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Copyright (c) 2018, Lawrence Livermore National Security, LLC.
*
* Produced at the Lawrence Livermore National Laboratory
*
* LLNL-CODE-746361
*
* All rights reserved. See COPYRIGHT for details.
*
* This file is part of the GEOSX Simulation Framework.
*
* GEOSX is a free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License (as published by the
* Free Software Foundation) version 2.1 dated February 1999.
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
/**
* @file ConstitutiveBase.cpp
*/
Expand Down
16 changes: 6 additions & 10 deletions src/coreComponents/constitutive/contact/ContactRelationBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,16 @@ void ContactRelationBase::initializePreSubGroups( Group * const )
TableFunction * const apertureTable = dynamic_cast< TableFunction * >(m_apertureFunction);
if( apertureTable!=nullptr )
{
array1d< array1d< real64 > > & xvals0 = apertureTable->getCoordinates();
ArrayOfArraysView< real64 > xvals0 = apertureTable->getCoordinates();
array1d< real64 > & yvals = apertureTable->getValues();

GEOSX_ERROR_IF( xvals0.size() > 1,
"Aperture limiter table cannot be greater than a 1d table." );

array1d< real64 > & xvals = xvals0[0];
arraySlice1d< real64 > xvals = xvals0[0];
localIndex const size = xvals.size();

GEOSX_ERROR_IF( xvals.back() > 0.0 || xvals.back() < 0.0,
GEOSX_ERROR_IF( xvals0( 0, size-1 ) > 0.0 || xvals0( 0, size-1 ) < 0.0,
"Invalid aperture limiter table. Last coordinate must be zero!!" );

GEOSX_ERROR_IF( xvals.size() < 2,
Expand All @@ -130,20 +131,15 @@ void ContactRelationBase::initializePreSubGroups( Group * const )

real64 m_apertureTransition = (yvals[n] - slope * xvals[n] ) / ( 1.0 - slope );

xvals.emplace_back( m_apertureTransition );
xvals0.emplaceBack( 0, m_apertureTransition );
yvals.emplace_back( m_apertureTransition );

xvals.emplace_back( m_apertureTransition*10e9 );
xvals0.emplaceBack( 0, m_apertureTransition*10e9 );
yvals.emplace_back( m_apertureTransition*10e9 );

apertureTable->reInitializeFunction();
}

// for( int i=0 ; i<200 ; ++i )
// {
// real64 coord = 0.01*i-1.0;
// std::cout<<coord<<" "<<apertureTable->Evaluate( &coord )<<std::endl;
// }

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,27 @@ BrooksCoreyBakerRelativePermeability::BrooksCoreyBakerRelativePermeability( stri
registerWrapper( viewKeyStruct::waterOilRelPermExponentString, &m_waterOilRelPermExponent )->
setApplyDefaultValue( 1.0 )->
setInputFlag( InputFlags::OPTIONAL )->
setDescription( "Rel perm power law exponent for the pair (water phase, oil phase) at residual gas saturation" );
setDescription( "Rel perm power law exponent for the pair (water phase, oil phase) at residual gas saturation\n"
"The expected format is \"{ waterExp, oilExp }\", in that order" );

registerWrapper( viewKeyStruct::waterOilRelPermMaxValueString, &m_waterOilRelPermMaxValue )->
setApplyDefaultValue( 0.0 )->
setInputFlag( InputFlags::OPTIONAL )->
setDescription( "Maximum rel perm value for the pair (water phase, oil phase) at residual gas saturation" );
setDescription( "Maximum rel perm value for the pair (water phase, oil phase) at residual gas saturation\n"
"The expected format is \"{ waterMax, oilMax }\", in that order" );


registerWrapper( viewKeyStruct::gasOilRelPermExponentString, &m_gasOilRelPermExponent )->
setApplyDefaultValue( 1.0 )->
setInputFlag( InputFlags::OPTIONAL )->
setDescription( "Rel perm power law exponent for the pair (gas phase, oil phase) at residual water saturation" );
setDescription( "Rel perm power law exponent for the pair (gas phase, oil phase) at residual water saturation\n"
"The expected format is \"{ gasExp, oilExp }\", in that order" );

registerWrapper( viewKeyStruct::gasOilRelPermMaxValueString, &m_gasOilRelPermMaxValue )->
setApplyDefaultValue( 0.0 )->
setInputFlag( InputFlags::OPTIONAL )->
setDescription( "Maximum rel perm value for the pair (gas phase, oil phase) at residual water saturation" );
setDescription( "Maximum rel perm value for the pair (gas phase, oil phase) at residual water saturation\n"
"The expected format is \"{ gasMax, oilMax }\", in that order" );

registerWrapper( viewKeyStruct::volFracScaleString, &m_volFracScale )->
setApplyDefaultValue( 1.0 )->
Expand All @@ -73,7 +77,7 @@ void BrooksCoreyBakerRelativePermeability::postProcessInput()
{
RelativePermeabilityBase::postProcessInput();

localIndex const NP = numFluidPhases();
localIndex const numPhases = numFluidPhases();

GEOSX_ERROR_IF( m_phaseOrder[PhaseType::OIL] < 0,
"BrooksCoreyBakerRelativePermeability: reference oil phase has not been defined and must be included in model" );
Expand All @@ -87,7 +91,7 @@ void BrooksCoreyBakerRelativePermeability::postProcessInput()
<< (expected) << " expected)" ); \
}

COREY_CHECK_INPUT_LENGTH( m_phaseMinVolumeFraction, NP, viewKeyStruct::phaseMinVolumeFractionString )
COREY_CHECK_INPUT_LENGTH( m_phaseMinVolumeFraction, numPhases, viewKeyStruct::phaseMinVolumeFractionString )

if( m_phaseOrder[PhaseType::WATER] >= 0 )
{
Expand All @@ -104,7 +108,7 @@ void BrooksCoreyBakerRelativePermeability::postProcessInput()
#undef COREY_CHECK_INPUT_LENGTH

m_volFracScale = 1.0;
for( localIndex ip = 0; ip < NP; ++ip )
for( localIndex ip = 0; ip < numPhases; ++ip )
{
GEOSX_ERROR_IF( m_phaseMinVolumeFraction[ip] < 0.0 || m_phaseMinVolumeFraction[ip] > 1.0,
"BrooksCoreyBakerRelativePermeability: invalid phase min volume fraction value: " << m_phaseMinVolumeFraction[ip] );
Expand Down
Loading

0 comments on commit b9fb6bc

Please sign in to comment.