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

Support a different elastic material in each block #5737

Merged
merged 7 commits into from
Mar 1, 2024

Conversation

nilsvu
Copy link
Member

@nilsvu nilsvu commented Feb 2, 2024

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

  • The code is documented and the documentation renders correctly. Run
    make doc to generate the documentation locally into BUILD_DIR/docs/html.
    Then open index.html.
  • The code follows the stylistic and code quality guidelines listed in the
    code review guide.
  • The PR lists upgrade instructions and is labeled bugfix or
    new feature if appropriate.

Further comments

@nilsvu nilsvu added this to the Thermal noise with coatings milestone Feb 2, 2024
@nilsvu nilsvu force-pushed the elasticity1 branch 15 times, most recently from 1370a66 to b322e11 Compare February 5, 2024 17:58

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

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

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

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

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?

Copy link
Member Author

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.

* \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(
Copy link
Member

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 🤷

Copy link
Member Author

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.
Copy link
Member

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?

Copy link
Contributor

@geoffrey4444 geoffrey4444 left a 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

.clang-tidy Outdated Show resolved Hide resolved
Copy link
Contributor

@geoffrey4444 geoffrey4444 left a 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>?

@nilsvu
Copy link
Member Author

nilsvu commented Feb 26, 2024

I squashed in the split of ExpandOverBlocks into a tpp file, and added a test.

Copy link
Member

@nilsdeppe nilsdeppe left a comment

Choose a reason for hiding this comment

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

LGTM, please squash!

nilsvu and others added 6 commits February 29, 2024 09:07
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.
@nilsvu
Copy link
Member Author

nilsvu commented Mar 1, 2024

@geoffrey4444 do you want to take another look?

@nilsdeppe nilsdeppe merged commit 6c78fa2 into sxs-collaboration:develop Mar 1, 2024
22 checks passed
@nilsvu nilsvu deleted the elasticity1 branch March 1, 2024 15:32
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.

3 participants