-
Notifications
You must be signed in to change notification settings - Fork 189
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
Support a different elastic material in each block #5737
Conversation
1370a66
to
b322e11
Compare
|
||
private: | ||
size_t num_blocks_; | ||
std::vector<std::string> block_names_; | ||
std::unordered_map<std::string, std::unordered_set<std::string>> | ||
block_groups_; | ||
}; | ||
|
||
template <typename 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.
Could we move the definitions to a tpp
and instantiate STL types maybe in ExpandOverBlocks.cpp
? We can then also instantiate specific other types in other places as necessary. I'd us to continue to reduce code in header files. In this case I worry a bit that it'll be transitively included in a decent number of places.
std::to_string(num_blocks_) + " blocks."}; | ||
} | ||
if constexpr (tt::is_a_v<std::unique_ptr, T>) { | ||
std::vector<T> expanded{}; |
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.
Utilities/CloneUniquePtrs.hpp
has code to do this. Can you just use that?
// Expand group names | ||
auto value_per_block = [&value]() { | ||
if constexpr (tt::is_a_v<std::unique_ptr, T>) { | ||
std::unordered_map<std::string, T> copy{}; |
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.
Again, can we use Utilities/CloneUniquePtrs.hpp
?
@@ -38,6 +38,7 @@ | |||
#include "Utilities/ErrorHandling/Error.hpp" |
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 understand how this change allows observing anything per material layer. It just allows you to name ObserveNorms
something else. Couldn't this be achieved with compute tags filtering on the layer?
This needs tests regardless, but I'm not sure this is the right solution to the problem. Maybe we can discuss in the tech call?
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.
As discussed in a meeting recently, yes, this only provides a name for the event in the input file. It's needed when you have multiple ObserveNorms
events in the same executable (here you have one for norms over the full domain and one for norms over each material layer). I think passing along a label struct is consistent with other parts of the code where we do that, e.g. Options::Auto<T, Label>
. I added some docs to explain.
src/Domain/Creators/BlockGroups.hpp
Outdated
* \p all_block_names. If one of the input names was a group, then all block | ||
* names from that group are included. Overlaps between groups are allowed. | ||
*/ | ||
std::unordered_set<std::string> expand_block_groups( |
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 _to_block_names
? It isn't clear to me from the current name what it does, and while documented, the extra clarity seems worth it to me 🤷
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.
squashed this rename in
@@ -0,0 +1,201 @@ | |||
// Distributed under the MIT License. |
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.
Are there tests for these?
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 one quick thing I saw so far…haven’t finished reviewing yet
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 I missed it, but is there a unit test anywhere that actually uses different constitutive relations in different blocks? If not, would it be hard to add one>?
I squashed in the split of ExpandOverBlocks into a tpp file, and added a test. |
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.
LGTM, please squash!
Also support `std::unique_ptr`s. This helps specify an elastic material for each block of the domain in the input file.
Allows to use this to observe quantities per material layer.
Also modernize constructors a bit.
@geoffrey4444 do you want to take another look? |
Proposed changes
Getting code merged that's used in the thermal noise paper (https://arxiv.org/abs/2111.06893). This PR adds support for layered materials, but the DG scheme still needs an update to support this (next PR).
Upgrade instructions
Code review checklist
make doc
to generate the documentation locally intoBUILD_DIR/docs/html
.Then open
index.html
.code review guide.
bugfix
ornew feature
if appropriate.Further comments