-
Notifications
You must be signed in to change notification settings - Fork 97
feat: well time step selector based on rates/bhp tables and clarify well rates logic #3427
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
Changes from 41 commits
fd5d21a
a724165
2ed34d6
42827b1
f70fb2d
05d5168
433498b
6c87a96
11bb54b
2c3ea5f
4a34a38
e03621b
d1374da
997a58e
32782a7
4e4eee0
3e950fe
56594c3
e3e0f10
9946aa7
7304811
a7eaf4a
4562fe4
6ceb88e
6d8f9ff
47ea23c
c20745b
301527f
a448c9f
e71b608
a2ed152
03170a3
4cf1a3e
777f05f
842ae59
42a49ff
31fcd8c
638bf71
0451f0a
75e38a7
111eea8
7a8e7eb
494eb93
0c52b88
f0bce1b
f641234
c2d84ac
7eca216
dcd9121
34d1de8
a30fdbe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,6 +173,18 @@ class TableFunction : public FunctionBase | |
real64 | ||
interpolateRound( IN_ARRAY const & input ) const; | ||
|
||
/** | ||
* @brief ... | ||
* @param[in] input vector of input value | ||
* @param[in] dim table dimension | ||
* @param[in] interpolationMethod interpolation method | ||
* @return coordinate value | ||
*/ | ||
template< typename IN_ARRAY > | ||
GEOS_HOST_DEVICE | ||
real64 | ||
getCoord( IN_ARRAY const & input, localIndex dim, InterpolationType interpolationMethod ) const; | ||
|
||
/** | ||
* @brief Interpolate in the table with derivatives using linear method. | ||
* @param[in] input vector of input value | ||
|
@@ -240,6 +252,15 @@ class TableFunction : public FunctionBase | |
*/ | ||
virtual real64 evaluate( real64 const * const input ) const override final; | ||
|
||
/** | ||
* @brief Method to get coordinates | ||
* @param input a scalar input | ||
* @param dim the table dimension | ||
* @param interpolationMethod the interpolation method | ||
* @return the coordinate | ||
*/ | ||
real64 getCoord( real64 const * const input, localIndex dim, InterpolationType interpolationMethod ) const; | ||
Comment on lines
+255
to
+262
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. I think you should annotate the docs that this method is assuming 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. added |
||
|
||
/** | ||
* @brief Check if the given coordinate is in the bounds of the table coordinates in the | ||
* specified dimension, throw an exception otherwise. | ||
|
@@ -554,6 +575,57 @@ TableFunction::KernelWrapper::interpolateRound( IN_ARRAY const & input ) const | |
return m_values[tableIndex]; | ||
} | ||
|
||
template< typename IN_ARRAY > | ||
GEOS_HOST_DEVICE | ||
GEOS_FORCE_INLINE | ||
real64 | ||
TableFunction::KernelWrapper::getCoord( IN_ARRAY const & input, localIndex const dim, InterpolationType interpolationMethod ) const | ||
{ | ||
// Determine the index to the nearest table entry | ||
localIndex subIndex; | ||
arraySlice1d< real64 const > const coords = m_coordinates[dim]; | ||
// Determine the index along each table axis | ||
if( input[dim] <= coords[0] ) | ||
{ | ||
// Coordinate is to the left of the table axis | ||
subIndex = 0; | ||
} | ||
else if( input[dim] >= coords[coords.size() - 1] ) | ||
{ | ||
// Coordinate is to the right of the table axis | ||
subIndex = coords.size() - 1; | ||
} | ||
else | ||
{ | ||
// Coordinate is within the table axis | ||
// Note: find() will return the index of the upper table vertex | ||
auto const lower = LvArray::sortedArrayManipulation::find( coords.begin(), coords.size(), input[dim] ); | ||
subIndex = LvArray::integerConversion< localIndex >( lower ); | ||
|
||
// Interpolation types: | ||
// - Nearest returns the value of the closest table vertex | ||
// - Upper returns the value of the next table vertex | ||
// - Lower returns the value of the previous table vertex | ||
if( interpolationMethod == TableFunction::InterpolationType::Nearest ) | ||
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. Looks like there are 4 interpolation types... Linear, Nearest, Upper, Lower... Using the find method defaults to Upper ? then overridden if method is nearest or lower... Is there any chance of method being called with Linear 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. calling for 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. added
|
||
{ | ||
if( ( input[dim] - coords[subIndex - 1]) <= ( coords[subIndex] - input[dim]) ) | ||
{ | ||
--subIndex; | ||
} | ||
} | ||
else if( interpolationMethod == TableFunction::InterpolationType::Lower ) | ||
{ | ||
if( subIndex > 0 ) | ||
{ | ||
--subIndex; | ||
} | ||
} | ||
} | ||
|
||
// Retrieve the nearest coordinate | ||
return coords[subIndex]; | ||
} | ||
|
||
template< typename IN_ARRAY, typename OUT_ARRAY > | ||
GEOS_HOST_DEVICE | ||
GEOS_FORCE_INLINE | ||
|
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. Changing BasedOnNewton tier changed to just IterNumber looks to support workflows beyond newton solvers? for better understanding. what is an example 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. simply the coupled sequential solver, it's not Newton iterations but the solver uses same logic for time step selection |
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.
Maybe unify the documentation with the other
getCoord
signature?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