-
Notifications
You must be signed in to change notification settings - Fork 239
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
Dirichlet boundary condition within a time interval #2272
Conversation
1c12b93
to
7fc0b17
Compare
NumLib/TimeStepping/TimeInterval.h
Outdated
* Class for a time interval, which has a member to check whether the given time | ||
* is in this time interval. | ||
*/ | ||
class TimeInterval |
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.
final
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.
NumLib/TimeStepping/TimeInterval.h
Outdated
{ | ||
return (current_time >= _start_time && current_time <= _end_time) | ||
? true | ||
: false; |
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.
The result of comparison is already a boolean, I'd drop the true:false
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.
changed.
NumLib/TimeStepping/TimeInterval.h
Outdated
{ | ||
} | ||
|
||
bool isInThisTimeInterval(const double current_time) 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.
Maybe isActive
, s.t.
TimeInterval time_interval{start, end};
...
if (time_interval.isActive(t)) { ... }
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.
changed as if (time_interval.contains(t))
.
{ | ||
if (_time_interval->isInThisTimeInterval(t)) | ||
{ | ||
return getEssentialBCValuesLocal(t, x, bc_values); |
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.
The return type of the function is void
...
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.
changed.
|
||
const double end_time = | ||
//! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__DirichletWithinTimeInterval__end_time} | ||
config.getConfigParameter<double>("end_time"); |
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.
Just a suggestion: I'd rather extract the config parsing into createTimeInterval()
and have the <time_interval>
tag in the project file:
...
<time_interval>
<start>0</start>
<end>1</end>
</time_interval>
Because parsing of the time interval is not a task for a boundary condition, in my opinion.
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.
NumLib/TimeStepping/TimeInterval.h
Outdated
*/ | ||
#pragma once | ||
|
||
namespace NumLib |
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.
Why is it in NumLib? I would put it in BaseLib.
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.
At beginning of my implementation, I had put it in BaseLib. Later on, I thought that this class is related to the time stepping only. Therefore I moved it to NumLib/TimeStepping. If you still think BaseLib is the best choice for it after reading this reply, I will move it BaseLib again.
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.
Could be BaseLib because it's rather general, or ProcessLib/BC/ because this is the only place where it is used now.
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.
Since both of you prefer to move to BaseLib, I have moved it to there but kept the path of parameter documentation.
@endJunction Introduced two functions to avoid class inheritance while to avoid source code duplication. |
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 good to me.
To move or not to move is up to you.
…r reducing source code duplication.
9a4459e
to
deac805
Compare
035110b
to
96ded07
Compare
OpenGeoSys development has been moved to GitLab. |
This PR presents a Dirichlet boundary condition within a time interval.
The benchmark is about a square domain under liquid pressure on its top and bottom. On the top boundary, pressure is always 1.0e+5, while on the bottom boundary, pressure is 1.0e+6 within a time interval of [0, 10] (see the following figure):
