-
Notifications
You must be signed in to change notification settings - Fork 247
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
[GeoMechanicsApplication] Simplified fluid flux for pw element #12338
Merged
rfaasse
merged 8 commits into
master
from
geo/12319_simplified_fluid_flux_for_Pw_element
May 6, 2024
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3564929
Copied fluid flux vector calculation to pw element
rfaasse 4c02764
Extract `CalculateFluidFluxes` which takes permeability update factor…
rfaasse 4a5056e
Use `CalculateFluidFluxes` in U_Pw_small_strain_element.cpp
rfaasse 14f8280
Cleaning up and simplifying CalculateFluidFluxes
rfaasse e3d770c
Minor formatting commit
rfaasse f4e155a
Revert "Cleaning up and simplifying CalculateFluidFluxes"
rfaasse 0c56f55
Merge remote-tracking branch 'origin/master' into geo/12319_simplifie…
rfaasse c25296e
Processing review comments
rfaasse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -620,42 +620,21 @@ void UPwSmallStrainElement<TDim, TNumNodes>::CalculateOnIntegrationPoints( | |
if (rVariable == FLUID_FLUX_VECTOR) { | ||
ElementVariables Variables; | ||
this->InitializeElementVariables(Variables, rCurrentProcessInfo); | ||
|
||
const PropertiesType& rProp = this->GetProperties(); | ||
|
||
array_1d<double, TDim> GradPressureTerm; | ||
array_1d<double, TDim> FluidFlux; | ||
|
||
// Create general parameters of retention law | ||
RetentionLaw::Parameters RetentionParameters(this->GetProperties(), rCurrentProcessInfo); | ||
|
||
|
||
std::vector<double> permeability_update_factors; | ||
for (unsigned int GPoint = 0; GPoint < NumGPoints; ++GPoint) { | ||
// Compute Np, GradNpT, B and StrainVector | ||
this->CalculateKinematics(Variables, GPoint); | ||
|
||
// Compute strain, needed for update permeability | ||
this->CalculateStrain(Variables, GPoint); | ||
this->CalculatePermeabilityUpdateFactor(Variables); | ||
permeability_update_factors.push_back(Variables.PermeabilityUpdateFactor); | ||
} | ||
|
||
GeoElementUtilities::InterpolateVariableWithComponents<TDim, TNumNodes>( | ||
Variables.BodyAcceleration, Variables.NContainer, Variables.VolumeAcceleration, GPoint); | ||
Variables.FluidPressure = CalculateFluidPressure(Variables); | ||
|
||
RetentionParameters.SetFluidPressure(Variables.FluidPressure); | ||
|
||
Variables.RelativePermeability = | ||
mRetentionLawVector[GPoint]->CalculateRelativePermeability(RetentionParameters); | ||
|
||
noalias(GradPressureTerm) = prod(trans(Variables.GradNpT), Variables.PressureVector); | ||
|
||
noalias(GradPressureTerm) += | ||
PORE_PRESSURE_SIGN_FACTOR * rProp[DENSITY_WATER] * Variables.BodyAcceleration; | ||
|
||
noalias(FluidFlux) = PORE_PRESSURE_SIGN_FACTOR * Variables.DynamicViscosityInverse * | ||
Variables.RelativePermeability * Variables.PermeabilityUpdateFactor * | ||
prod(Variables.PermeabilityMatrix, GradPressureTerm); | ||
|
||
GeoElementUtilities::FillArray1dOutput(rOutput[GPoint], FluidFlux); | ||
const auto fluid_fluxes = CalculateFluidFluxes(permeability_update_factors, rCurrentProcessInfo); | ||
for (unsigned int GPoint = 0; GPoint < NumGPoints; ++GPoint) { | ||
GeoElementUtilities::FillArray1dOutput(rOutput[GPoint], fluid_fluxes[GPoint]); | ||
} | ||
} else { | ||
if (rOutput.size() != mConstitutiveLawVector.size()) | ||
|
@@ -1112,6 +1091,48 @@ void UPwSmallStrainElement<TDim, TNumNodes>::InitializeBiotCoefficients(ElementV | |
KRATOS_CATCH("") | ||
} | ||
|
||
template <unsigned int TDim, unsigned int TNumNodes> | ||
std::vector<array_1d<double, TDim>> UPwSmallStrainElement<TDim, TNumNodes>::CalculateFluidFluxes( | ||
const std::vector<double>& permeability_update_factors, const ProcessInfo& rCurrentProcessInfo) | ||
{ | ||
const GeometryType& rGeom = this->GetGeometry(); | ||
const IndexType NumGPoints = rGeom.IntegrationPointsNumber(this->GetIntegrationMethod()); | ||
|
||
std::vector<array_1d<double, TDim>> FluidFluxes; | ||
ElementVariables Variables; | ||
this->InitializeElementVariables(Variables, rCurrentProcessInfo); | ||
|
||
const PropertiesType& rProp = this->GetProperties(); | ||
|
||
array_1d<double, TDim> GradPressureTerm; | ||
|
||
// Create general parameters of retention law | ||
RetentionLaw::Parameters RetentionParameters(this->GetProperties(), rCurrentProcessInfo); | ||
|
||
for (unsigned int GPoint = 0; GPoint < NumGPoints; ++GPoint) { | ||
this->CalculateKinematics(Variables, GPoint); | ||
Variables.PermeabilityUpdateFactor = permeability_update_factors[GPoint]; | ||
|
||
GeoElementUtilities::InterpolateVariableWithComponents<TDim, TNumNodes>( | ||
Variables.BodyAcceleration, Variables.NContainer, Variables.VolumeAcceleration, GPoint); | ||
Variables.FluidPressure = CalculateFluidPressure(Variables); | ||
RetentionParameters.SetFluidPressure(Variables.FluidPressure); | ||
|
||
Variables.RelativePermeability = | ||
mRetentionLawVector[GPoint]->CalculateRelativePermeability(RetentionParameters); | ||
|
||
noalias(GradPressureTerm) = prod(trans(Variables.GradNpT), Variables.PressureVector); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lines 1124 and 1126 are constructing the contents of the same variable. This interspacing contradicts that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed blank line |
||
noalias(GradPressureTerm) += PORE_PRESSURE_SIGN_FACTOR * rProp[DENSITY_WATER] * Variables.BodyAcceleration; | ||
|
||
FluidFluxes.push_back(PORE_PRESSURE_SIGN_FACTOR * Variables.DynamicViscosityInverse * | ||
Variables.RelativePermeability * Variables.PermeabilityUpdateFactor * | ||
prod(Variables.PermeabilityMatrix, GradPressureTerm)); | ||
} | ||
|
||
return FluidFluxes; | ||
} | ||
|
||
template <unsigned int TDim, unsigned int TNumNodes> | ||
void UPwSmallStrainElement<TDim, TNumNodes>::CalculatePermeabilityUpdateFactor(ElementVariables& rVariables) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
To be in line with the Kratos Style Guide, we should rename the first parameter:
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.
Done