Skip to content

Conversation

@amgebauer
Copy link
Member

@amgebauer amgebauer commented Oct 15, 2025

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.

@amgebauer amgebauer requested review from Copilot and tuchpaul October 15, 2025 14:19
Copy link

Copilot AI left a 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_ID and INIT parameters with ORIENTATION field 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()))
Copy link

Copilot AI Oct 15, 2025

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.

Copilot uses AI. Check for mistakes.
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);
Copy link

Copilot AI Oct 15, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +66 to +67
Core::LinAlg::Tensor<double, 3> growth_direction =
params_->growth_direction.interpolate(eleGID, context.xi->as_span());
Copy link

Copilot AI Oct 15, 2025

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.

Copilot uses AI. Check for mistakes.
@amgebauer amgebauer force-pushed the allow-setting-fiber-orientation-with-mesh-data branch from 8e33f49 to f6276ff Compare October 16, 2025 13: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.

1 participant