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

[CLApp] Generalizing the Serial Parallel Rule of Mixtures to perform 2d simulations #12983

Merged
merged 17 commits into from
Jan 9, 2025

Conversation

AlejandroCornejo
Copy link
Member

@AlejandroCornejo AlejandroCornejo commented Jan 7, 2025

📝 Description
In this PR I am:

  • Optimising and generalising the original SerialParallelRuleOfMixturesLaw to be used in 3d and in 2d simulations. The implementation is generic thanks to the newly templated Dimension. A few checks have been added to avoid incompatibilities between 2D and 3D individual constitutive laws.
  • The AdvancedConstitutiveLawsUtilities have been enhanced with a CalculateTangentTensorByPerturbation method to start avoiding repetition in other CLs in the future.

// Vicente Mataix Ferrandiz
// Fernando Rastellini
// Collaborator: Lucia Barbu
// Vicente Mataix
Copy link
Member

Choose a reason for hiding this comment

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

(I like my mother's name)

Copy link
Member Author

Choose a reason for hiding this comment

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

Besides, she's a good woman, I'll put her back

return Kratos::make_shared<SerialParallelRuleOfMixturesLaw>(fiber_volumetric_participation, parallel_directions);

Vector parallel_directions = NewParameters["parallel_behaviour_directions"].GetVector();
KRATOS_ERROR_IF_NOT(parallel_directions.size() == VoigtSize) << "The parallel_behaviour_directions vector is not consistent with the VoigtSize of the Serial Parallel Rule of Mixtures CL..." << std::endl;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
KRATOS_ERROR_IF_NOT(parallel_directions.size() == VoigtSize) << "The parallel_behaviour_directions vector is not consistent with the VoigtSize of the Serial Parallel Rule of Mixtures CL..." << std::endl;
KRATOS_ERROR_IF_NOT(parallel_directions.size() == VoigtSize) << "The parallel_behaviour_directions vector is not consistent with the VoigtSize of the Serial Parallel Rule of Mixtures CL. parallel_directions.size(): " << parallel_directions.size() << " vs VoigtSize: " << VoigtSize << std::endl;

Specify sizes

const std::size_t voigt_size = this->GetStrainSize();
const int num_parallel_components = inner_prod(mParallelDirections, mParallelDirections);
const int num_serial_components = voigt_size - num_parallel_components;
const SizeType voigt_size = GetStrainSize();
Copy link
Member

Choose a reason for hiding this comment

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

Question. Do we do not assume the Voigt size from the Dimension size?, sorry I forgot that detail

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, the GetStrainSize() return a static SizeType, I can remove it if you think is best to access it directly.

Copy link
Member

Choose a reason for hiding this comment

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

I those method were override somewhere else it could make some sense, but here I thinbk it is better to just use it.

noalias(B_tensor) = prod(F, trans(F));

AdvancedConstitutiveLawUtilities<6>::CalculateAlmansiStrain(B_tensor, r_strain_vector);
AdvancedConstitutiveLawUtilities<VoigtSize>::CalculateAlmansiStrain(B_tensor, r_strain_vector);
Copy link
Member

Choose a reason for hiding this comment

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

But in here VoigtSize is retrieved as static

if (rValue.size1() != voigt_size)
rValue.resize(voigt_size, voigt_size, false);
noalias(rValue) = MathUtils<double>::StrainVectorToTensor(matrix_strain_vector);
return rValue;
} else if (rThisVariable == GREEN_LAGRANGE_STRAIN_TENSOR_FIBER) {
const std::size_t voigt_size = this->GetStrainSize();
const std::size_t voigt_size = GetStrainSize();
Copy link
Member

Choose a reason for hiding this comment

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

The same for the every GetStrainSize

Comment on lines 1689 to 1692
KRATOS_ERROR_IF(VoigtSize != mpMatrixConstitutiveLaw->GetStrainSize()) << "The Strain size of the mpMatrixConstitutiveLaw is not consistent with the Srial Parallel Rule of Mixtures..." << std::endl;
KRATOS_ERROR_IF(VoigtSize != mpFiberConstitutiveLaw->GetStrainSize()) << "The Strain size of the mpFiberConstitutiveLaw is not consistent with the Srial Parallel Rule of Mixtures..." << std::endl;
KRATOS_ERROR_IF(mpMatrixConstitutiveLaw->WorkingSpaceDimension() != mpFiberConstitutiveLaw->WorkingSpaceDimension()) << "The WorkingSpaceDimension of the fiber and matrix mismatch..." << std::endl;
KRATOS_ERROR_IF(mpMatrixConstitutiveLaw->GetStrainSize() != mpFiberConstitutiveLaw->GetStrainSize()) << "The GetStrainSize of the fiber and matrix mismatch..." << std::endl;
Copy link
Member

Choose a reason for hiding this comment

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

As in the other example, Add the sizes in the error message

@@ -47,10 +47,13 @@ namespace Kratos
/**
* @class SerialParallelRuleOfMixturesLaw
* @ingroup StructuralMechanicsApplication
* @brief This CL implements the serial-parallel rule of mixtures developed by F.Rastellini
* @brief This CL implements the serial-parallel rule of mixtures detailed in Cornejo et al. "Methodology for the analysis of post-tensioned structures using a constitutive serial-parallel rule of mixtures"
Copy link
Member

Choose a reason for hiding this comment

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

<3

Copy link
Member

Choose a reason for hiding this comment

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

(It's a heart)

};

/**
* @brief Voigt tensor size:
*/
SizeType GetStrainSize() const override
{
return 6;
return VoigtSize;
Copy link
Member

Choose a reason for hiding this comment

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

I would keep the methods of course, but in code use directly the static sizes.

Copy link
Member

@loumalouomega loumalouomega left a comment

Choose a reason for hiding this comment

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

Comments

@AlejandroCornejo AlejandroCornejo merged commit 9e9f133 into master Jan 9, 2025
11 checks passed
@AlejandroCornejo AlejandroCornejo deleted the serial-parallel-rom-in-2d branch January 9, 2025 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants