-
Notifications
You must be signed in to change notification settings - Fork 53
Allow setting fiber orientation with mesh data in the mixture module #1396
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
base: main
Are you sure you want to change the base?
Allow setting fiber orientation with mesh data in the mixture module #1396
Conversation
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.
Pull Request Overview
This PR enables fiber orientation specification through mesh data (VTU files) in the growth and remodeling (G&R) framework, replacing the legacy FIBER_ID and INIT parameters with an ORIENTATION field that can reference mesh data. The changes allow fiber directions to be defined directly in VTU files, improving flexibility and usability.
Key changes:
- Replaced
FIBER_IDandINITparameters withORIENTATIONfield in material definitions - Added fiber interpolation strategy for unit-vector fields
- Updated all test input files to use new orientation specification
- Added VTK dependency to affected tests
- Modified growth strategies to accept evaluation context for fiber direction interpolation
Reviewed Changes
Copilot reviewed 45 out of 46 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
tests/list_of_tests.cmake |
Added VTK dependency requirement to arc tests |
tests/input_files/vtu/*.vtu |
New VTU mesh files with embedded fiber direction data |
tests/input_files/*.4C.yaml |
Updated material definitions to use new ORIENTATION field instead of FIBER_ID/INIT |
src/mixture/src/4C_mixture_growth_strategy_*.cpp |
Updated growth strategies to accept evaluation context and element ID |
src/mixture/src/4C_mixture_constituent_remodelfiber_*.hpp |
Replaced anisotropy extension with direct fiber orientation handling |
src/mat/4C_mat_fiber_interpolation.hpp |
New fiber interpolation strategy for unit-vector fields |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| double currentReferenceGrowthScalar, const Mat::EvaluationContext& context, int gp, | ||
| int eleGID) const | ||
| { | ||
| if (gp >= static_cast<int>(structural_tensors_.size())) |
Copilot
AI
Oct 15, 2025
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 check-then-act pattern on structural_tensors_ is not thread-safe. If multiple threads evaluate the same Gauss point concurrently, they could both pass the condition and attempt to emplace, leading to a race condition. Consider using thread-safe initialization or documenting the thread-safety requirements.
| weights.end(), fibers.begin(), Core::LinAlg::Tensor<double, 3>{{0.0, 0.0, 0.0}}); | ||
|
|
||
| // normalize vector | ||
| return interpolated_fiber / Core::LinAlg::norm2(interpolated_fiber); |
Copilot
AI
Oct 15, 2025
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.
Division by zero can occur if interpolated_fiber has zero norm (e.g., when all input fibers are zero vectors or weights sum to zero). Add a check for zero norm before division or document the precondition that the norm must be non-zero.
| Core::LinAlg::Tensor<double, 3> growth_direction = | ||
| params_->growth_direction.interpolate(eleGID, context.xi->as_span()); |
Copilot
AI
Oct 15, 2025
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.
Potential null pointer dereference if context.xi is null. Add a null check before dereferencing or document that context.xi must not be null when calling this function.
8e33f49 to
f6276ff
Compare
This PR allows to set the fiber orientation in the G&R-framework from an input field (instead of the
FIBERx-input). This allows us to directly use the fiber definition in vtu-files.@tuchpaul You can have a look at the added vtu files how we defined the fibers.
Draft for now since the framework also has a legacy test that we might remove before we can proceed. And we might need some internal optimization so that we can already pre-compute the fibers at the Gauss-points during the setup-phase.