Skip to content

Commit

Permalink
Documentation and minor fixes
Browse files Browse the repository at this point in the history
Implement suggestions provided during code review.

Refs #21275
  • Loading branch information
cpgr committed Jan 19, 2024
1 parent 57fc371 commit 712bbc6
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ This `FVKernel` implements the strong form of
\end{equation*}
where all parameters are defined in the [nomenclature](/nomenclature.md).

!alert note
Presently, a first-order accurate implicit Euler time derivative is hard-coded.

!syntax parameters /FVKernels/FVPorousFlowEnergyTimeDerivative

!syntax inputs /FVKernels/FVPorousFlowEnergyTimeDerivative
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ This `FVKernel` implements the strong form of
\end{equation*}
where all parameters are defined in the [nomenclature](/nomenclature.md).

!alert note
Presently, a first-order accurate implicit Euler time derivative is hard-coded.

!syntax parameters /FVKernels/FVPorousFlowMassTimeDerivative

!syntax inputs /FVKernels/FVPorousFlowMassTimeDerivative
Expand Down
4 changes: 2 additions & 2 deletions modules/porous_flow/src/fvkernels/FVPorousFlowAdvectiveFlux.C
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ FVPorousFlowAdvectiveFlux::computeQpResidual()
ADRealGradient pressure_grad;
ADRealTensorValue mobility;

for (unsigned int p = 0; p < _num_phases; ++p)
for (const auto p : make_range(_num_phases))
{
// If we are on a boundary face, use the reconstructed gradient computed in _grad_p
// If we are on a boundary face, use the gradient computed in _grad_p
if (onBoundary(*_face_info))
{
const auto & gradp = -_grad_p[_qp][p];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ FVPorousFlowDispersiveFlux::computeQpResidual()
ADRealGradient gradp;
ADRealTensorValue mobility;

// If we are on a boundary face, use the reconstructed gradient computed in _grad_p
// If we are on a boundary face, use the gradient computed in _grad_p
if (onBoundary(*_face_info))
{
gradp = -_grad_p[_qp][p] + _density[_qp][p] * _gravity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ FVPorousFlowEnergyTimeDerivative::computeQpResidual()

/// Add the fluid heat energy
if (_fluid_present)
for (unsigned int p = 0; p < _num_phases; ++p)
for (const auto p : make_range(_num_phases))
{
energy += _porosity[_qp] * (*_density)[_qp][p] * (*_saturation)[_qp][p] * (*_energy)[_qp][p];
energy_old += _porosity_old[_qp] * (*_density_old)[_qp][p] * (*_saturation_old)[_qp][p] *
Expand Down
4 changes: 2 additions & 2 deletions modules/porous_flow/src/fvkernels/FVPorousFlowHeatAdvection.C
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ FVPorousFlowHeatAdvection::computeQpResidual()
ADRealGradient pressure_grad;
ADRealTensorValue mobility;

for (unsigned int p = 0; p < _num_phases; ++p)
for (const auto p : make_range(_num_phases))
{
// If we are on a boundary face, use the reconstructed gradient computed in _grad_p
// If we are on a boundary face, use the gradient computed in _grad_p
if (onBoundary(*_face_info))
{
const auto & gradp = -_grad_p[_qp][p];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ FVPorousFlowHeatConduction::computeQpResidual()
ADRealGradient gradT;
ADRealTensorValue coeff;

// If we are on a boundary face, use the reconstructed gradient computed in _grad_T
// If we are on a boundary face, use the gradient computed in _grad_T
if (onBoundary(*_face_info))
{
gradT = -_grad_T[_qp];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ FVPorousFlowMassTimeDerivative::computeQpResidual()
ADReal mass = 0.0;
Real mass_old = 0.0;

for (unsigned int p = 0; p < _num_phases; ++p)
for (const auto p : make_range(_num_phases))
{
mass += _density[_qp][p] * _saturation[_qp][p] * _mass_fractions[_qp][p][_fluid_component];
mass_old += _density_old[_qp][p] * _saturation_old[_qp][p] *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ PorousFlowThermalConductivityFromPorosityTempl<is_ad>::computeQpProperties()
if constexpr (!is_ad)
{
(*_dla_qp_dvar)[_qp].assign(_num_var, RealTensorValue());
for (unsigned v = 0; v < _num_var; ++v)
for (const auto v : make_range(_num_var))
(*_dla_qp_dvar)[_qp][v] = (_la_f - _la_s) * (*_dporosity_qp_dvar)[_qp][v];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ PorousFlowThermalConductivityIdealTempl<is_ad>::computeQpProperties()
{
(*_dla_qp_dvar)[_qp].assign(_num_var, RealTensorValue());
if (_aqueous_phase && _wet_and_dry_differ)
for (unsigned v = 0; v < _num_var; ++v)
for (const auto v : make_range(_num_var))
(*_dla_qp_dvar)[_qp][v] =
_exponent * std::pow((*_saturation_qp)[_qp][_aqueous_phase_number], _exponent - 1.0) *
(*_dsaturation_qp_dvar)[_qp][_aqueous_phase_number][v] * (_la_wet - _la_dry);
Expand Down
8 changes: 4 additions & 4 deletions modules/porous_flow/test/tests/heat_advection/tests
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
threading = '!pthreads'
issues = '#7984'
design = 'PorousFlowHeatAdvection.md PorousFlowEnergyTimeDerivative.md porous_flow/tests/heat_advection/heat_advection_tests.md'
requirement = 'The system shall correctly advect heat energy with a moving fluid, using no numerical stabilizatio.n'
requirement = 'The system shall correctly advect heat energy with a moving fluid, using no numerical stabilization'
[]
[heat_advection_1d_fully_saturated_action_none]
type = CSVDiff
Expand All @@ -26,7 +26,7 @@
threading = '!pthreads'
issues = '#10426'
design = 'PorousFlowFullySaturated.md porous_flow/numerical_diffusion.md porous_flow/kt_worked.md porous_flow/tests/heat_advection/heat_advection_tests.md'
requirement = 'The system shall correctly advect heat energy with a moving fluid, using no numerical stabilization, and the user should be able to activiate this stabilization using the PorousFlow Action system.'
requirement = 'The system shall correctly advect heat energy with a moving fluid, using no numerical stabilization, and the user should be able to activate this stabilization using the PorousFlow Action system.'
[]
[heat_advection_1d]
type = CSVDiff
Expand All @@ -44,7 +44,7 @@
threading = '!pthreads'
issues = '#7984 #21275'
design = 'PorousFlowHeatAdvection.md PorousFlowEnergyTimeDerivative.md porous_flow/tests/heat_advection/heat_advection_tests.md'
requirement = 'The system shall correctly advect heat energy with a moving fluid, using full-upwinding for numerical stabilization.'
requirement = 'The system shall correctly advect heat energy with a moving fluid using a finite volume discretization.'
[]
[heat_advection_1d_fullsat]
type = CSVDiff
Expand All @@ -66,7 +66,7 @@
threading = '!pthreads'
issues = '#16841'
design = 'PorousFlowFullySaturated.md PorousFlowEnergyTimeDerivative.md porous_flow/tests/heat_advection/heat_advection_tests.md'
requirement = 'The system shall correctly advect heat energy with a moving fluid, using full-upwinding for numerical stabilization, in fully-saturated single-phase systems, and the user should be able to activiate this stabilization using the PorousFlow Action system.'
requirement = 'The system shall correctly advect heat energy with a moving fluid, using full-upwinding for numerical stabilization, in fully-saturated single-phase systems, and the user should be able to activate this stabilization using the PorousFlow Action system.'
[]
[heat_advection_1d_KT]
type = CSVDiff
Expand Down
6 changes: 3 additions & 3 deletions modules/porous_flow/test/tests/heat_conduction/tests
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
csvdiff = 'no_fluid_fv.csv'
rel_err = 1.0E-5
threading = '!pthreads'
requirement = 'The system shall be able to simulate heat conduction in a fluid-free environment.'
requirement = 'The system shall be able to simulate heat conduction in a fluid-free environment using a finite volume discretization.'
design = 'porous_flow/tests/heat_conduction/heat_conduction_tests.md'
issues = '#13155 #21275'
[]
Expand All @@ -25,7 +25,7 @@
csvdiff = 'two_phase.csv'
rel_err = 1.0E-5
threading = '!pthreads'
requirement = 'The system shall be able to simulate heat conduction for systems containing multi-phase fluid.s'
requirement = 'The system shall be able to simulate heat conduction for systems containing multi-phase fluids.'
design = 'porous_flow/tests/heat_conduction/heat_conduction_tests.md'
issues = '#13155'
[]
Expand All @@ -35,7 +35,7 @@
csvdiff = 'two_phase_fv.csv'
rel_err = 1.0E-5
threading = '!pthreads'
requirement = 'The system shall be able to simulate heat conduction for systems containing multi-phase fluids.'
requirement = 'The system shall be able to simulate heat conduction for systems containing multi-phase fluids using a finite volume discretization.'
design = 'porous_flow/tests/heat_conduction/heat_conduction_tests.md'
issues = '#13155 #21275'
[]
Expand Down

0 comments on commit 712bbc6

Please sign in to comment.