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

fix: use mass and energy consistently for single phase solvers #3485

Open
wants to merge 17 commits into
base: feature/byer3/single_phase_prop_refactor
Choose a base branch
from

Conversation

paveltomin
Copy link
Contributor

@paveltomin paveltomin commented Dec 8, 2024

should go after #3460

unified where possible
for poromechanics - hard to do because porosity is being updated inside the assembly kernel, so left it as is
fixed glitch with double porosity update in poromechanics when it was updated both in flow solver and in poromechanics kernel using different equations leading to potential inconsistencies

@paveltomin paveltomin changed the title reafactor: use mass and energy consistently for single phase solvers refactor: use mass and energy consistently for single phase solvers Dec 9, 2024
@@ -241,46 +241,38 @@ DECLARE_FIELD( temperatureScalingFactor,
NO_WRITE,
"Scaling factors for temperature" );

DECLARE_FIELD( mass,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

mass went to single phase file since it is used there, not for compositional

@@ -594,8 +634,6 @@ void SinglePhaseBase::initializeFluidState( MeshLevel & mesh, arrayView1d< strin

// 2. save the initial density (for use in the single-phase poromechanics solver to compute the deltaBodyForce)
fluid.initializeState();

updateMass( subRegion );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this call is redundant, updateMass already called in updateFluidState few lines above

@@ -291,13 +260,11 @@ class SurfaceElementAccumulationKernel : public AccumulationKernel< SurfaceEleme
void computeAccumulation( localIndex const ei,
Base::StackVariables & stack ) const
{
Base::computeAccumulation( ei, stack, [&] ()
Base::computeAccumulation( ei, stack );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

keep it simple

Copy link
Contributor

Choose a reason for hiding this comment

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

nice... introducing mass cleaned up accum and flux kernels a fair bit and probably reduced computation at the same time ... same for introducing energy variable..

stack.dSolidEnergy_dPres = dSolidVolume_dPres * m_rockInternalEnergy[ei][0];
stack.dSolidEnergy_dTemp = solidVolume * m_dRockInternalEnergy_dTemp[ei][0] + dSolidVolume_dTemp * m_rockInternalEnergy[ei][0];
}
{};
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 not remove this, somehow compiler gets always confused

@paveltomin paveltomin self-assigned this Dec 9, 2024
@paveltomin paveltomin added type: cleanup / refactor Non-functional change (NFC) flag: ready for review ci: run integrated tests Allows to run the integrated tests in GEOS CI labels Dec 9, 2024
@paveltomin paveltomin marked this pull request as ready for review December 9, 2024 18:03
@CusiniM
Copy link
Collaborator

CusiniM commented Dec 12, 2024

you may want to keep an eye on this: #3460

@paveltomin
Copy link
Contributor Author

you may want to keep an eye on this: #3460

Yes thanks

Copy link
Collaborator

@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.

LGTM

@paveltomin paveltomin changed the title refactor: use mass and energy consistently for single phase solvers fix: use mass and energy consistently for single phase solvers Dec 12, 2024
@paveltomin paveltomin added the type: bug Something isn't working label Dec 12, 2024
@paveltomin paveltomin changed the base branch from develop to feature/byer3/single_phase_prop_refactor January 23, 2025 22:31
@paveltomin paveltomin requested review from tjb-ltk and removed request for wrtobin, corbett5 and dkachuma January 23, 2025 22:42
@@ -257,53 +263,93 @@ void SinglePhaseBase::updateMass( ElementSubRegionBase & subRegion ) const
{
GEOS_MARK_FUNCTION;

using DerivOffset = constitutive::singlefluid::DerivativeOffsetC< 1 >; // TODO check if this is correct
Copy link
Contributor

Choose a reason for hiding this comment

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

The assumption with this is that someone doesn't make pressure second index in isothermal run... to be safe I would use
geos::internal::kernelLaunchSelectorThermalSwitch( isThermal, [&] ( auto ISTHERMAL ) {
integer constexpr IS_THERMAL = ISTHERMAL();
using DerivOffset = constitutive::singlefluid::DerivativeOffsetC< IS_THERMAL >;
if constexpr(IS_THERMAL) // for the thermal bits
{
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added, thanks!

}

void SinglePhaseBase::updateEnergy( ElementSubRegionBase & subRegion ) const
{
GEOS_MARK_FUNCTION;

using DerivOffset = constitutive::singlefluid::DerivativeOffsetC< 1 >;

Copy link
Contributor

Choose a reason for hiding this comment

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

by definition this is thermal routine so this is fine

@paveltomin paveltomin added the flag: requires rebaseline Requires rebaseline branch in integratedTests label Jan 24, 2025
@paveltomin paveltomin removed the ci: run integrated tests Allows to run the integrated tests in GEOS CI label Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flag: ready for review flag: requires rebaseline Requires rebaseline branch in integratedTests type: bug Something isn't working type: cleanup / refactor Non-functional change (NFC)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants