GEOS-DEV / GEOS

GEOS Simulation Framework
GNU Lesser General Public License v2.1
207 stars 83 forks source link

Test case crashes with more components #1814

Closed EngSubsurfaceModeling closed 1 year ago

EngSubsurfaceModeling commented 2 years ago

Please find the following two cases: eos.txt eos2.txt

eos.txt is a test case from GEOSX example with 4 components {N2, C10, C20, H2O}. and it works fine.

eso2.txt is a example, derived from eos.txt. This case has 7 components {CO2, C1, C2, C4, C6, C11, C17}, and geosx(latest build) fails with the following error:

GEOSX version 0.2.0 (develop, sha1: 60b5ccee8)
Adding Solver of type CompositionalMultiphaseFVM, named compflow
Adding Mesh: InternalMesh, mesh
   TableFunction: initialPressureFunc
Adding Object CellElementRegion named region from ObjectManager::Catalog.
Total number of nodes:16
Total number of elems:3
Rank 0: Total number of nodes:16

***** LOCATION: /apps/GEOSX/src/coreComponents/dataRepository/Group.hpp:337
***** Controlling expression (should be false): child == nullptr
***** Rank 0: Group m/domain/Constitutive doesn't have a child fluid

** StackTrace of 7 frames **
Frame 0: geosx
Frame 1: geosx::ProblemManager::setRegionQuadrature(geosx::dataRepository::Group&, geosx::constitutive::ConstitutiveManager const&, geosx::mapBase<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, long, std::integral_constant<bool, true> > const&)
Frame 2: geosx::ProblemManager::applyNumericalMethods()
Frame 3: geosx::ProblemManager::problemSetup()
Frame 4: geosx::GeosxState::initializeDataRepository()
Frame 5: main
Frame 6: __libc_start_main
Frame 7: _start
=====

It looks like GEOSX will always crash when number of components is greater than 5. Please review and fix once confirmed.

jhuang2601 commented 2 years ago

@EngSubsurfaceModeling In the constitutive section of eos2 file, the fluid is named as fluid1; but in the ElementRegions section, fluid is called in the materialList, which caused the problem. Please make them consistent with each other.

<ElementRegions>
    <CellElementRegion name="region" cellBlocks="{cb1}" materialList="{fluid, rock, relperm, cappressure}" />
  </ElementRegions>
EngSubsurfaceModeling commented 2 years ago

https://github.com/jhuang2601 thanks for pointing out that typo. I fixed that typo, and geosx still show error with the following message:

Adding Solver of type CompositionalMultiphaseFVM, named compflow
Adding Mesh: InternalMesh, mesh
   TableFunction: initialPressureFunc
Adding Object CellElementRegion named region from ObjectManager::Catalog.
Total number of nodes:16
Total number of elems:3
Rank 0: Total number of nodes:16
  region/cb1/fluid is allocated with 1 quadrature points.
  region/cb1/rock is allocated with 1 quadrature points.
  region/cb1/relperm is allocated with 1 quadrature points.
  region/cb1/cappressure is allocated with 1 quadrature points.
***** ERROR
***** LOCATION: /apps/GEOSX/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBaseKernels.hpp:131
***** Controlling expression (should be false): true
***** Rank 0: Unsupported number of components: 7

** StackTrace of 11 frames **
Frame 0: geosx::CompositionalMultiphaseBase::updatePhaseVolumeFraction(geosx::ObjectManagerBase&) const
Frame 1: geosx
Frame 2: geosx::CompositionalMultiphaseBase::initializeFluidState(geosx::MeshLevel&, LvArray::ArrayView<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, 1, 0, long, LvArray::ChaiBuffer> const&)
Frame 3: geosx
Frame 4: geosx::CompositionalMultiphaseBase::initializePostInitialConditionsPreSubGroups()
Frame 5: geosx::dataRepository::Group::initializePostInitialConditions()
Frame 6: geosx::dataRepository::Group::initializePostInitialConditions()
Frame 7: geosx::dataRepository::Group::initializePostInitialConditions()
Frame 8: geosx::GeosxState::applyInitialConditions()
Frame 9: main
Frame 10: __libc_start_main
Frame 11: _start
=====

--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
with errorcode 1.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------

any idea?
jhuang2601 commented 2 years ago

@EngSubsurfaceModeling By looking into the source code (CompositionalMultiphaseBaseKernels.hpp), it seems that GEOSX currently does not support the case with more than 5 components in fluid. @francoishamon Any suggestion/comment for this limitation?

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

  switch( value )
  {
    case 1:
    { lambda( std::integral_constant< T, 1 >() ); return; }
    case 2:
    { lambda( std::integral_constant< T, 2 >() ); return; }
    case 3:
    { lambda( std::integral_constant< T, 3 >() ); return; }
    case 4:
    { lambda( std::integral_constant< T, 4 >() ); return; }
    case 5:
    { lambda( std::integral_constant< T, 5 >() ); return; }
    default:
    { GEOSX_ERROR( "Unsupported number of components: " << value ); }
  }
}
francoishamon commented 2 years ago

Increasing the number of allowed components in the dispatch may/will have an impact on the compilation time, so we should be a little bit careful with this, I think (until we have just-in-time compilation, at least).

I can always create a branch, increase the number of components allowed in the dispatches, and report compilation times to make sure we make an informed decision. @klevzoff what is your opinion on this?

klevzoff commented 2 years ago

I can always create a branch, increase the number of components allowed in the dispatches, and report compilation times to make sure we make an informed decision. @klevzoff what is your opinion on this?

To solve the current problem in the short term, we could just add two more cases to the switch above (and possibly remove case 1 since we don't support single-component multiphase systems yet afaik).

Longer term my preference would be to have cmake-level settings (something like GEOSX_FLUID_COMP_MIN=2 and GEOSX_FLUID_COMP_MAX=5, or even an explicit list like GEOSX_FLUID_COMP_LIST="3,5,7"), and replacing the switch above with a recursive template dispatch (similar to constitutive one) that is parametrized by the above settings. Thus the user can trade compilation time for more flexibility of fluid descriptions. Eventually this might be JITted away.

francoishamon commented 2 years ago

Sounds good, I will take care of this

EngSubsurfaceModeling commented 2 years ago

Thanks all for taking care of this issue.

several questions here related to compositional flow: 1>How many components will be allowed in new release? can endusers disable such restrict when deploying in production?

2>What is the recommended way for water phase? make it like this? <CompositionalMultiphaseFluid name="fluid" phaseNames="{oil, gas, water}" equationsOfState="{PR, PR, ?}"

or just treat water as a component like the following? <CompositionalMultiphaseFluid name="fluid" phaseNames="{oil, gas}" equationsOfState="{PR, PR}" componentNames="{N2, C10, C20, H2O}" If only the second method supported, does this have any limitation? for example, solubility of CO2 in water?

  1. Is there any complete example for CO2 injection in compositional case? Hope this example include water(brine?) phase, CO2 injection, initialization. We noticed that there are lots of keyword changes recently. It's hard to catch up quickly. If possible, we can provide a black oil case, can you show us how to convert it to compositional case?
francoishamon commented 2 years ago

Hello @EngSubsurfaceModeling,

Questions 1 and 2, we will provide a complete answer soon.

Question 3:

I attach a complete example with CO2 injection with water phase, CO2 injection, initialization, wells, etc... In develop, we still have issues with our linear solver that will be resolved soon, so the instructions to run are:

Note that this is going through the custom CO2-brine fluid package that we have. If you want to use the true compositional flash with CO2 and brine, we have to go through another model (CompositionalMultiphaseFluid), and enable the free water flash to allow for the presence of brine.

Please send your black-oil case, and we will convert it to this CompositionalMultiphaseFluid model.

realCase.zip

EngSubsurfaceModeling commented 2 years ago

Francois,

Thank you! That co2-brine example is super helpful, and we'll use that with latest GEOSX build later.

Here is a test case for compositional simulation. It's converted from a co2-brine case, and we're trying to add EOS equation(7 components) and water. If possible, we also would like to try two ways to initialize the reservoir: Equilibrium keyword and Enumeration(specify each component). Can you try to convert? If you have any questions, please let me know.

eos_test.zip

EngSubsurfaceModeling commented 1 year ago

Francois,

Thank you! That co2-brine example is super helpful, and we'll use that with latest GEOSX build later.

Here is a test case for compositional simulation. It's converted from a co2-brine case, and we're trying to add EOS equation(7 components) and water. If possible, we also would like to try two ways to initialize the reservoir: Equilibrium keyword and Enumeration(specify each component). Can you try to convert? If you have any questions, please let me know.

Regards,

Eng

On Sun, Mar 13, 2022 at 1:12 PM Francois Hamon @.***> wrote:

Hello @EngSubsurfaceModeling https://github.com/EngSubsurfaceModeling,

Questions 1 and 2, we will provide a complete answer soon.

Question 3:

I attach a complete example with CO2 injection with water phase, CO2 injection, initialization, wells, etc... In develop, we still have issues with our linear solver that will be resolved soon, so the instructions to run are:

Note that this is going through the custom CO2-brine fluid package that we have. If you want to use the true compositional flash with CO2 and brine, we have to go through another model (CompositionalMultiphaseFluid), and enable the free water flash to allow for the presence of brine.

Please send your black-oil case, and we will convert it to this CompositionalMultiphaseFluid model.

GEOSX_example_with_irregular_input.zip https://github.com/GEOSX/GEOSX/files/8240329/GEOSX_example_with_irregular_input.zip

— Reply to this email directly, view it on GitHub https://github.com/GEOSX/GEOSX/issues/1814#issuecomment-1066154312, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXNDJWBFTBQJNX57UDV5TADU7Y43HANCNFSM5QMLX4RQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

francoishamon commented 1 year ago

Hello @EngSubsurfaceModeling We are working on this: please check our workplan detailed here https://github.com/GEOS-DEV/GEOS/issues/2465 It will take a few months before it can be used in a simulation, but it will cover the use case you mentioned (CO2 in hydrocarbon systems with water). I am closing this issue and I encourage you to check back in a few months.