Skip to content
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

Merged
merged 11 commits into from
Nov 28, 2018

Conversation

wenqing
Copy link
Member

@wenqing wenqing commented Nov 27, 2018

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):
tintervalbc

            Left, t<=10.0;                            right, t>10

* Class for a time interval, which has a member to check whether the given time
* is in this time interval.
*/
class TimeInterval
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added.

{
return (current_time >= _start_time && current_time <= _end_time)
? true
: false;
Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed.

{
}

bool isInThisTimeInterval(const double current_time) const
Copy link
Member

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)) { ... }

Copy link
Member Author

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);
Copy link
Member

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...

Copy link
Member Author

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");
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

*/
#pragma once

namespace NumLib
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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.

@wenqing
Copy link
Member Author

wenqing commented Nov 28, 2018

@endJunction Introduced two functions to avoid class inheritance while to avoid source code duplication.

Copy link
Member

@endJunction endJunction left a 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.

@endJunction endJunction merged commit d822261 into ufz:master Nov 28, 2018
@ogsbot
Copy link
Member

ogsbot commented Jun 19, 2020

OpenGeoSys development has been moved to GitLab.

See this pull request on GitLab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants