-
Notifications
You must be signed in to change notification settings - Fork 95
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
Conversation
@@ -377,4 +377,73 @@ WellControls const & WellSolverBase::getWellControls( WellElementSubRegion const | |||
return this->getGroup< WellControls >( subRegion.getWellControlsName()); | |||
} | |||
|
|||
real64 WellSolverBase::setNextDt( real64 const & currentTime, const real64 & lastDt, geos::DomainPartition & domain ) |
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.
main thing is in this function
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.
I noticed in test case that the writeCSV report is a little different ... Before ,first report was end of first DT, so no rates report at t=0, but there is report at last time, Now report starts at T=0, which is good, but no report at last timestep. So one needs to add dt to get the full picture, along with manually adding the line if in excel. Maybe on destruction or if component got end of sim call, the file record could be written..
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.
Also how does this affect other output reporting...
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.
i added time step size in the output, i think that should be enough to represent full picture
no effect on other output reporting is expected
This comment was marked as resolved.
This comment was marked as resolved.
@@ -377,4 +377,73 @@ WellControls const & WellSolverBase::getWellControls( WellElementSubRegion const | |||
return this->getGroup< WellControls >( subRegion.getWellControlsName()); | |||
} | |||
|
|||
real64 WellSolverBase::setNextDt( real64 const & currentTime, const real64 & lastDt, geos::DomainPartition & domain ) |
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.
I noticed in test case that the writeCSV report is a little different ... Before ,first report was end of first DT, so no rates report at t=0, but there is report at last time, Now report starts at T=0, which is good, but no report at last timestep. So one needs to add dt to get the full picture, along with manually adding the line if in excel. Maybe on destruction or if component got end of sim call, the file record could be written..
@@ -377,4 +377,73 @@ WellControls const & WellSolverBase::getWellControls( WellElementSubRegion const | |||
return this->getGroup< WellControls >( subRegion.getWellControlsName()); | |||
} | |||
|
|||
real64 WellSolverBase::setNextDt( real64 const & currentTime, const real64 & lastDt, geos::DomainPartition & domain ) |
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.
Also how does this affect other output reporting...
// - 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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
calling for Linear
would not make much sense i think, should i add a check and throw an error for Linear
?
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.
added
GEOS_ASSERT_MSG( interpolationMethod != InterpolationType::Linear,
GEOS_FMT( "{}: TableFunction::getCoord should not be called with {} interpolation method",
getDataContext(), EnumStrings< InterpolationType >::toString( interpolationMethod )));
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.
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 comment
The 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
@CusiniM, @VidarStiernstrom, @castelletto1, @cssherman, @frankfeifan, @jhuang2601, @matteofrigo5, @rrsettgast, @wrtobin please review |
this->registerWrapper( viewKeyStruct::timeStepFromTablesFlagString(), &m_timeStepFromTables ). | ||
setApplyDefaultValue( 0 ). | ||
setInputFlag( dataRepository::InputFlags::OPTIONAL ). | ||
setDescription( "Choose time step to honor rates/bhp tables time intervals" ); |
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.
shouldn't this always be true? I am guessing we always want the timestep to respect the intervals, don't we?
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.
If I remember correctly, @dkachuma requested this behavior to be an option and I was hesitant to make it default
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.
(Minor remarks)
Nice things in this PR!
* @brief ... | ||
* @param[in] input vector of input value | ||
* @param[in] dim table dimension | ||
* @param[in] interpolationMethod interpolation method | ||
* @return coordinate value |
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
/** | ||
* @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; |
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.
I think you should annotate the docs that this method is assuming createKernelWrapper()
has been called (because it is based on the m_kernelWrapper
data).
Maybe add an error in it?
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.
added
GEOS_ASSERT( dim >= 0 && dim < m_coordinates.size() );
Two things in this PR:
setNextDt
in well solver which looks at all rates/bhp/status tables and makes sure time step is selected so that we honor table intervals. Can be enabled bytimeStepFromTables
flag in well solver.t_n+dt
(end of time step) - switch tot_n
(beginning of time step) - this should be more consistent withlower
interpolation method that is used and prevent grabbing "future" rate from tables and avoid weird behavior when time step cut can lead to shutting of wells.