-
Notifications
You must be signed in to change notification settings - Fork 97
Add energy balance equation to Compositional solver. #1225
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
Add energy balance equation to Compositional solver. #1225
Conversation
|
Conduction is still missing. I see two way to add it:
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? |
|
@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 |
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this still happening?
There was a problem hiding this comment.
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.
src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp
Outdated
Show resolved
Hide resolved
src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp
Outdated
Show resolved
Hide resolved
src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseUtilities.hpp
Show resolved
Hide resolved
| // Step 1: compute the thermal transmissibilities at this face | ||
| m_stencilWrapper.computeWeights( iconn, | ||
| m_thermalConductivity, | ||
| m_thermalConductivity, // unused for now |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
src/coreComponents/physicsSolvers/fluidFlow/ThermalCompositionalMultiphaseFVMKernels.hpp
Show resolved
Hide resolved
klevzoff
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
src/coreComponents/physicsSolvers/fluidFlow/ThermalCompositionalMultiphaseFVMKernels.hpp
Outdated
Show resolved
Hide resolved
src/coreComponents/physicsSolvers/fluidFlow/ThermalCompositionalMultiphaseFVMKernels.hpp
Outdated
Show resolved
Hide resolved
src/coreComponents/physicsSolvers/fluidFlow/ThermalCompositionalMultiphaseFVMKernels.hpp
Outdated
Show resolved
Hide resolved
src/coreComponents/physicsSolvers/fluidFlow/ThermalCompositionalMultiphaseBaseKernels.hpp
Outdated
Show resolved
Hide resolved
| 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] ); |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
This original content of the PR has been split into multiple pieces that have been implemented separately:
CO2BrineThermalfluid model (Activated thermal option in CO2-brine fluid model #1755)This PR implements the kernel interfaces that add the thermal derivatives and assemble the energy balance (internal energy term, enthalpy flux, conduction flux).
Rebaseline in https://github.com/GEOSX/integratedTests/pull/213