-
Notifications
You must be signed in to change notification settings - Fork 240
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
Allow different boundary temperature plugins on different boundaries #2051
base: main
Are you sure you want to change the base?
Allow different boundary temperature plugins on different boundaries #2051
Conversation
Let me know once you have this rebased after merging #2044. |
0864574
to
c907ea7
Compare
4569c47
to
66eef39
Compare
This should be ready for review. I recommend reviewing in 'split' mode, as much of interface.cc has changed. On the upside I was able to remove several deprecated things, so that the new structure looks actually simpler than before. The only complicated part is the |
* The point of this function is to allow complex boundary temperature | ||
* models to do an initialization step once at the beginning of each | ||
* time step. An example would be a model that needs to call an | ||
* external program to compute the temperature change at a boundary. |
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.
Any particular reason to remove this comment?
boundary_temperature (const types::boundary_id boundary_indicator, | ||
const Point<dim> &position) const; | ||
const std::vector<std_cxx11::shared_ptr<Interface<dim> > > & | ||
get_active_boundary_temperature_conditions () const; | ||
|
||
/** | ||
* Return the minimal temperature of all selected plugins on that | ||
* part of the boundary on which Dirichlet conditions are posed. | ||
*/ |
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 this comment is no longer accurate (and hasn't been for a while). That's because it's not that part of the boundary on which Dirichlet conditions are posed, but in fact that subset of Dirichlet boundaries with indicators given by the argument list. While you're here, can you update this? Or maybe leave it for a follow-up, if you prefer given that this likely shows up in a number of places -- in that case, just open an issue.
= std::set<types::boundary_id>()) const; | ||
double | ||
maximal_temperature (const std::set<types::boundary_id> &fixed_boundary_ids | ||
= std::set<types::boundary_id>()) 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.
Same for this function.
= std::set<types::boundary_id>()) const; | ||
|
||
/** | ||
* A function that calls the boundary_temperature functions of all the |
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.
please fix the indentation of the comment here
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, if you write it as boundary_temperature()
(with parens) then doxygen will automatically link to it
} | ||
|
||
|
||
|
||
template <int dim> | ||
double | ||
Manager<dim>::boundary_temperature (const types::boundary_id boundary_indicator, | ||
const Point<dim> &position) const | ||
Manager<dim>::minimal_temperature (const std::set<types::boundary_id> &/*fixed_boundary_ids*/) 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.
oh, this negates my comment on the documentation of the function -- the function apparently ignores its argument. is this intended? If so, this is not a virtual function, so it's not possible to overload it, and if the only existing implementation ignores the argument, why not drop it altogether?
@@ -200,13 +135,15 @@ namespace aspect | |||
|
|||
template <int dim> | |||
double | |||
Manager<dim>::minimal_temperature (const std::set<types::boundary_id> &fixed_boundary_ids) const | |||
Manager<dim>::maximal_temperature (const std::set<types::boundary_id> &/*fixed_boundary_ids*/) 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.
same here, of course
source/utilities.cc
Outdated
AssertThrow(false, | ||
ExcMessage ("ASPECT only accepts the following operators: " | ||
"add, subtract, minimum and maximum. But your parameter file " | ||
"contains: " + operation + ". Please check your parameter file.") ); |
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 write this as
"contains <" + operation + ">. Please check..."
for consistency with other places.
In some places, we pass the name of the parameter where this happened to similar functions (e..g., to possibly_extend_1_to_N()
) so that it's easier to find the location where this happened in the input file. Could we do the same here?
parameters.fixed_temperature_boundary_indicators.erase(bottom); | ||
std::set<types::boundary_id> &temperature_boundary_ids = | ||
const_cast<std::set<types::boundary_id> &> (simulator_access.get_boundary_temperature_manager().get_fixed_temperature_boundary_indicators()); | ||
temperature_boundary_ids.erase(bottom); |
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.
oh, if this was anywhere other than in a test, I'd be quite unhappy about such a trick :-)
I addressed most issues. About your comments: First comment: I removed the part about the purpose, because it is not happening in this function. The I updated the documentation and implementation of the I added a parameter to the Last comment: I am also not happy about this. Problem is that the test tested functionality that is now not longer easily available. The parameter to change is not longer a member of |
ce75622
to
1c06bc1
Compare
1c06bc1
to
8771bf9
Compare
8771bf9
to
2da2617
Compare
2da2617
to
3af7d82
Compare
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 don't unerstand all of the technical details, but I guess as @bangerth has already looked at this, this is fine.
@bangerth, as @gassmoeller already addressed your comments, is this okay from your side?
@gassmoeller: You need to add a changelog entry. And I'll add this to the list of cookbooks we need, because I feel this is really not intuitive to understand without an example. Do you think it would be worth it to add a short section to the manual, just to explain the syntax?
* A map between fixed_temperature_boundary_indicators and one or more | ||
* indices into the boundary_temperature_names, | ||
* boundary_temperature_objects, and boundary_temperature_operators vectors. | ||
* This variable stores which plugins are active for which boundary. |
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 am a bit confused how this works. Can you extend the comment a bit and explain how this is structured (how do I know what this second index is for; boundary_temperature_name, boundary_temperature_object, or boundary_temperature_operator)?
"but not explicitly listed here will end up with no-flux " | ||
"(insulating) boundary conditions." | ||
"\n\n" | ||
"The names of the boundaries listed here can either by " |
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.
by --> be?
"compute the boundary temperature. If only one plugin is given, " | ||
"only this plugin is used. The same boundary identifier can " | ||
"appear multiple times with different plugin names, in which " | ||
"case all given plugins will be combined to compute the boundary " |
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 add a sentence to make it more clear that this is the only way to assign more than one plugin to a boundary, because it would not work to write 'boundary identifier : plugin name 1, plugin name 2'. By the way, the only reason that this does not work is that if there is a comma in the list, we do not know if the thing after it is a new boundary indicator or another plugin, right? So what about allowing something like 'boundary identifier : [plugin name 1, plugin name 2]'? I feel that would be much easier to read in the input file than 'boundary identifier : plugin name 1, boundary identifier : plugin name 2', and this way you could check again if any of the indicators is present in the list twice, and let the user know, so it would be less error prone.
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.
After thinking about this for a while, I guess the most reasonable approach I see would be to change this format to allow something like:
set Fixed temperature boundary indicators = top : box & function & constant, left : box & initial temperature, bottom
If there is no colon, all plugins are applied (as it is right now, so it's backwards compatible). I guess that means duplicating the list of plugins in the 'List of model names' parameter, but I don't really see any other way to do this, and it would only come up in complex models.
So I guess the only other question we have to think about here is: Do we ever want to allow having the same kind of plugin, but with different parameters, for different boundaries (like 2 different functions)? Because I don't really see how we would put that into this framework, so we would essentially say that this is someting we do not want to change in the near future.
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 haven't looked at this since my last review, but just about the format: instead of &
we've generally used ;
as a top-level separator between entries I believe.
"on which the temperature is fixed and described by the " | ||
"boundary temperature objects selected in the " | ||
"<Boundary temperature model/List of model names> parameter " | ||
"of this input file. All boundary indicators used by the geometry " |
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.
One question: With this new format, is there still a reason to even have the section Boundary temperature model/List of model names other than backwards compatibility? Or in other words, should we also allow users to put in boundary temperature plugins here that they have not selected in the List of model names? This way, we could deprecate the other parameter and remove it at some point, and we would end up with the same format for the temperature and the velocity boundary conditions.
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.
Update: I see, you need it to apply the operators. So do we have plans for the future to allow several plugins for the velocity boundary conditions too? Because then I guess it would make sense to think about a format that would work for all three (temperature, composition, velocity).
prm.leave_subsection(); | ||
|
||
// Now create and initialize all of the requested models. We can only do this here at the end, | ||
// because some models might ask, which boundary they are responsible for. |
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.
remove comma
@@ -123,7 +123,8 @@ namespace aspect | |||
Utilities::possibly_extend_from_1_to_N (Utilities::split_string_list(prm.get("List of model operators")), | |||
model_names.size(), | |||
"List of model operators"); | |||
model_operators = Utilities::create_model_operator_list(model_operator_names); | |||
model_operators = Utilities::create_model_operator_list(model_operator_names, | |||
"Boundary composition model/List of model operators"); |
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.
This should be initial temperature, not boundary composition, right? And maybe add a test for that if we haven't caught this with any of the existing tests?
{ | ||
AssertThrow(false, | ||
ExcMessage ("ASPECT only accepts the following operators: " | ||
"add, subtract, minimum and maximum. But your parameter file " |
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.
Is there a way to get the operators we allow from the Operator object instead of spelling them out by hand? This would allow adding operators in the future without having to change the error message by hand (which we might forget).
@@ -272,17 +275,6 @@ namespace aspect | |||
"will be used to append the listed temperature models onto " | |||
"the previous models. If only one operator is given, " | |||
"the same operator is applied to all models."); |
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 know this doesn't have anything to do with your pull request, but can you please add a sentence here (and in other places where we declare these operators), that this list of operators has to be exactly as long as the list of plugins (if it doesn't have just one entry), and that the order has to be the same as in the 'List of model names' because each operator will be applied to a plugin according to the order they're given in.
Same as #2099, lets postpone this after 2.0. |
@gassmoeller: What's the status here? Can you rebase and should I then take a look? |
This sits on top of #2044 and does the same thing for boundary temperature plugins. Now, one can select different boundary temperature plugins for different boundaries in the same style and input format as for velocities. I still want to make the parsing a bit more intuitive by allowing to only specify plugin names (that are then used for all boundaries) and not only pairs of boundaries and plugins, but this gets a bit complicated due to backwards compatibility to the current system, where a single entry is interpreted as a boundary id (not a plugin name). I need to do some more work on the parsing and documentation before this is finished.