Skip to content

Commit ed4be65

Browse files
committed
Use the interpolation bounds from the files in (v,e) over querying the FP
- otherwise we would compute min/max from FP calls OOB from the tabulation - then flush to min/max that could be OOB
1 parent be047cb commit ed4be65

File tree

2 files changed

+25
-24
lines changed

2 files changed

+25
-24
lines changed

modules/fluid_properties/src/fluidproperties/TabulatedFluidProperties.C

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,14 @@ TabulatedFluidProperties::initialSetup()
359359
generateVETabulatedData();
360360
}
361361
}
362-
// Could be needed to get bounds computed from (p, T) bounds
363-
else if (_fp)
364-
createVEGridVectors();
365362

366363
computePropertyIndicesInInterpolationVectors();
367364
constructInterpolation();
368365

366+
// Could be needed to get bounds computed from (p, T) bounds
367+
if (_fp && !_create_direct_ve_interpolations)
368+
createVEGridVectors();
369+
369370
// Write tabulated data to file
370371
if (_save_file)
371372
{
@@ -2633,18 +2634,8 @@ TabulatedFluidProperties::createVGridVector()
26332634
mooseAssert(_file_name_ve_in.empty(), "We should be reading the specific volume grid from file");
26342635
if (!_v_bounds_specified)
26352636
{
2636-
if (_fp)
2637-
{
2638-
// extreme values of specific volume for the grid bounds
2639-
Real v1 = _fp->v_from_p_T(_pressure_min, _temperature_min);
2640-
Real v2 = _fp->v_from_p_T(_pressure_max, _temperature_min);
2641-
Real v3 = _fp->v_from_p_T(_pressure_min, _temperature_max);
2642-
Real v4 = _fp->v_from_p_T(_pressure_max, _temperature_max);
2643-
_v_min = std::min({v1, v2, v3, v4});
2644-
_v_max = std::max({v1, v2, v3, v4});
2645-
}
26462637
// if csv exists, get max and min values from csv file
2647-
else if (_interpolate_density)
2638+
if (_interpolate_density)
26482639
{
26492640
Real rho_max =
26502641
*std::max_element(_properties[_density_idx].begin(), _properties[_density_idx].end());
@@ -2653,6 +2644,16 @@ TabulatedFluidProperties::createVGridVector()
26532644
_v_max = 1 / rho_min;
26542645
_v_min = 1 / rho_max;
26552646
}
2647+
else if (_fp)
2648+
{
2649+
// extreme values of specific volume for the grid bounds
2650+
Real v1 = _fp->v_from_p_T(_pressure_min, _temperature_min);
2651+
Real v2 = _fp->v_from_p_T(_pressure_max, _temperature_min);
2652+
Real v3 = _fp->v_from_p_T(_pressure_min, _temperature_max);
2653+
Real v4 = _fp->v_from_p_T(_pressure_max, _temperature_max);
2654+
_v_min = std::min({v1, v2, v3, v4});
2655+
_v_max = std::max({v1, v2, v3, v4});
2656+
}
26562657
else
26572658
mooseWarning("Unable to compute grid bounds in specific volume. Please specify the v_min/max "
26582659
"parameters");
@@ -2686,7 +2687,15 @@ TabulatedFluidProperties::createVEGridVectors()
26862687
createVGridVector();
26872688
if (!_e_bounds_specified)
26882689
{
2689-
if (_fp)
2690+
// if csv exists, get max and min values from csv file
2691+
if (_interpolate_internal_energy)
2692+
{
2693+
_e_min = *std::min_element(_properties[_internal_energy_idx].begin(),
2694+
_properties[_internal_energy_idx].end());
2695+
_e_max = *std::max_element(_properties[_internal_energy_idx].begin(),
2696+
_properties[_internal_energy_idx].end());
2697+
}
2698+
else if (_fp)
26902699
{
26912700
// extreme values of internal energy for the grid bounds
26922701
Real e1 = _fp->e_from_p_T(_pressure_min, _temperature_min);
@@ -2696,14 +2705,6 @@ TabulatedFluidProperties::createVEGridVectors()
26962705
_e_min = std::min({e1, e2, e3, e4});
26972706
_e_max = std::max({e1, e2, e3, e4});
26982707
}
2699-
// if csv exists, get max and min values from csv file
2700-
else if (_interpolate_internal_energy)
2701-
{
2702-
_e_min = *std::min_element(_properties[_internal_energy_idx].begin(),
2703-
_properties[_internal_energy_idx].end());
2704-
_e_max = *std::max_element(_properties[_internal_energy_idx].begin(),
2705-
_properties[_internal_energy_idx].end());
2706-
}
27072708
else
27082709
mooseWarning("Unable to compute grid bounds in internal energy. Please specify the e_min/max "
27092710
"parameters");

modules/porous_flow/test/tests/fluidstate/water_vapor_tab.i

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
allow_fp_and_tabulation = true
176176
fluid_property_file = fluid_properties_extended.csv
177177
# the test relies on forwarding enthalpy evaluations to 'water_true'
178-
interpolated_properties = 'density viscosity'
178+
interpolated_properties = 'density viscosity internal_energy'
179179
[]
180180
[]
181181

0 commit comments

Comments
 (0)