Skip to content

Conversation

@CusiniM
Copy link
Collaborator

@CusiniM CusiniM commented Nov 7, 2020

This original content of the PR has been split into multiple pieces that have been implemented separately:

This PR implements the kernel interfaces that add the thermal derivatives and assemble the energy balance (internal energy term, enthalpy flux, conduction flux).

  • Unit test (finite difference derivatives)
  • Integrated test (CO2-brine simulation)

Rebaseline in https://github.com/GEOSX/integratedTests/pull/213

@CusiniM CusiniM added flag: requires rebaseline Requires rebaseline branch in integratedTests type: feature New feature or request labels Dec 21, 2020
@CusiniM CusiniM marked this pull request as ready for review December 26, 2020 20:52
@CusiniM
Copy link
Collaborator Author

CusiniM commented Dec 28, 2020

Conduction is still missing. I see two way to add it:

  1. add another stencil with it's own coefficient which would be the conductivity.
  2. allow the stencil to have more than one coefficient. Basically I would modify the stencil so that it could contain weights relative to two different properties (or coefficients). We may want to modify some of the naming if we choose this path.

I personally prefer option 2 because the connections for the advective and the conductive parts are exactly the same so we would only have to loop over the connections once instead of twice.

@francoishamon @rrsettgast @klevzoff @castelletto1 opinions?

@francoishamon
Copy link
Contributor

francoishamon commented Mar 7, 2022

@CusiniM GitHub prevents me from selecting your name as a reviewer because you opened this PR, but it is now ready for review. I added an 2D integrated test with cold CO2 injection in brine, and I will now work on validation against another code.

I am also going to add a unit test to validate the derivatives, but I am going to refactor the unit tests testCompMultiphaseFlow and testCompMultiphaseHybrid first to avoid code duplication (in a separate PR -> this is done now).

Copy link
Collaborator Author

@CusiniM CusiniM left a comment

Choose a reason for hiding this comment

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

Outstanding job @francoishamon ! It's a pretty big PR:

  • we should probably organize a walk through
  • we should allow you to merge asap. maintaining it up-to-date with develop is going to be painful.

CO2BrinePhillipsFluid,
CO2BrineEzrokhiFluid >::execute( fluid, std::forward< LAMBDA >( lambda ) );
CO2BrineEzrokhiFluid,
CO2BrinePhillipsThermalFluid /*, // if I uncomment the two models at the same time, the compiler segfaults on
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

is this still happening?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I really don't understand what is going on there:

  • If I add only CO2BrinePhillipsThermalFluid, the code compiles and works
  • If I add only CO2BrineEzrokhiThermalFluid, the code compiles and works
  • If I add both, I get the following error:
[ 61%] Building CUDA object coreComponents/physicsSolvers/CMakeFiles/physicsSolvers.dir/fluidFlow/CompositionalMultiphaseBase.cpp.o                                                      
[ 63%] Building CUDA object coreComponents/physicsSolvers/CMakeFiles/physicsSolvers.dir/fluidFlow/wells/CompositionalMultiphaseWell.cpp.o                                                
[ 63%] Building CUDA object coreComponents/constitutive/CMakeFiles/constitutive.dir/fluid/PVTDriver.cpp.o                                                                                
[ 88%] Built target constitutive                                                                                                                                                         
nvcc error   : 'ptxas' died due to signal 11 (Invalid memory reference)                                                                                                                  
make[3]: *** [coreComponents/physicsSolvers/CMakeFiles/physicsSolvers.dir/build.make:115: coreComponents/physicsSolvers/CMakeFiles/physicsSolvers.dir/fluidFlow/CompositionalMultiphaseBase.cpp.o] Error 11 

This is not a blocking problem for me, but I don't understand why it does not compile with the two models activated.

// Step 1: compute the thermal transmissibilities at this face
m_stencilWrapper.computeWeights( iconn,
m_thermalConductivity,
m_thermalConductivity, // unused for now
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

why twice? I m guessing it's just to pass smt to the function coz thta should be the derivative wrt to pressure.

Copy link
Contributor

Choose a reason for hiding this comment

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

For thermal conductivity, I implemented what the two of us discussed some time ago: the dependence of thermal conductivity on saturation and porosity is treated explicitly to make sure that we can easily reuse the computeWeights function. So yes you are right, I pass m_thermalConductivity twice because I need to pass something, but I don't have anything else to pass. I added more explanations in the code.

In a future PR, we could modify the computeWeights function to accommodate explicit coefficients (just pass the coefficient, and return the transmissibility). That would be useful for thermal transmissibility and also for diffusion transmissibility that would likely be explicit/lagged in iteration as well.

@francoishamon francoishamon added ci: run CUDA builds Allows to triggers (costly) CUDA jobs and removed flag: ready for review labels Mar 30, 2022
Copy link
Contributor

@klevzoff klevzoff left a comment

Choose a reason for hiding this comment

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

Looks great!

localIndex const k = targetSet[a];
for( localIndex q = 0; q < fluidWrapper.numGauss(); ++q )
{
fluidWrapper.update( k, q, pres[k] + dPres[k], temp[k] + dTemp[k], compFrac[k] );
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it's too late at this point to think about changing our (flow) formulations from oldField, deltaField to oldField, newField. So much extra code can be eliminated...
(This is obviously not a comment on this PR, just thinking out loud)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be great to try, if everyone agrees. I can post an issue to get feedback and try after the PR is merged.

{

namespace compositionalMultiphaseFVMKernels
namespace isothermalCompositionalMultiphaseFVMKernels
Copy link
Contributor

@klevzoff klevzoff Apr 4, 2022

Choose a reason for hiding this comment

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

I have an issue with the length of these namespace names (and it's only got worse now). I don't have a specific suggestion for this PR, but intuitively it seems that having a more nested namespace structure might be one way to deal with it, e.g. ::geosx::flow::multiphase::kernels::isothermal or ::geosx::kernels::flow::multiphase::isothermal (we'd have to think about the order). The benefit is being able to reference any level of this hierarchy by an explicit local alias or a using directive, and thus reduce typing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci: run CUDA builds Allows to triggers (costly) CUDA jobs flag: requires rebaseline Requires rebaseline branch in integratedTests type: feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants