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] Implementing fatigue data container #11494

Merged
merged 9 commits into from
Aug 23, 2023
Merged

[CLApp] Implementing fatigue data container #11494

merged 9 commits into from
Aug 23, 2023

Conversation

atfard
Copy link
Contributor

@atfard atfard commented Aug 21, 2023

📝 Description
In this PR, a fatigue data container has been added. Using this class, it would be much easier to incorporate fatigue calculations in other constitutive laws.
@SergioJimenezReyes @lagoncalvesjr @balcayde @lgratiela

const Vector& r_aux_stresses = mPreviousStresses;
rFatigueVariables.PreviousStresses[1] = CurrentStress;
rFatigueVariables.PreviousStresses[0] = r_aux_stresses[1];
// mPreviousStresses = rFatigueVariables.PreviousStresses;
Copy link
Member

Choose a reason for hiding this comment

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

Leftover?

bool DamageActivation;
};

HCFDataContainer()
Copy link
Member

Choose a reason for hiding this comment

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

Remove the tabulation

ConstitutiveLaw::Parameters rValues = ConstitutiveLaw::Parameters();
public:

struct FatigueVariables {
Copy link
Member

Choose a reason for hiding this comment

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

Every variable must be saved in every GP, there are not common values that can be stored in properties?

Copy link
Member

Choose a reason for hiding this comment

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

I agree, some double values can be recomuted, not being necessary to be stored

Copy link
Contributor Author

Choose a reason for hiding this comment

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

these are all fatigue variables which have been gathered in one place. Not all of them are stored but the remaining ones are necessary for calculations.


///@name Member Variables
///@{
double mMaxStress = 0.0;
Copy link
Member

Choose a reason for hiding this comment

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

Idem, a lot of variables, it is required for every GP?

Copy link
Member

Choose a reason for hiding this comment

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

After checking the HCF CL, yes, it needs tracking of many things...

Copy link
Member

Choose a reason for hiding this comment

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

BTW, the member variables should be in the private section of the class

Copy link
Contributor Author

Choose a reason for hiding this comment

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

solved

double Alphat = 0.0;
double PreviousReversionFactor = 0.0;
double ReversionFactor = 0.0;
bool AdnvanceStrategyApplied;
Copy link
Member

Choose a reason for hiding this comment

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

there is a typo here

rFatigueVariables.MinIndicator);
const Vector& r_aux_stresses = mPreviousStresses;
rFatigueVariables.PreviousStresses[1] = CurrentStress;
rFatigueVariables.PreviousStresses[0] = r_aux_stresses[1];
Copy link
Member

Choose a reason for hiding this comment

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

Where is the r_aux_stresses ? This cannot compile

Copy link
Member

Choose a reason for hiding this comment

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

sorry I did not read it right, it is okkey


void CalculateFatigueReductionFactorAndWohlerStress(const Properties& rMaterialParameters, HCFDataContainer::FatigueVariables &rFatigueVariables)
{
HighCycleFatigueLawIntegrator<6>::CalculateFatigueReductionFactorAndWohlerStress(rMaterialParameters,
Copy link
Member

Choose a reason for hiding this comment

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

We should separate this file into .cpp and .h

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


CalculateFatigueParameters(rMaterialProperties, rFatigueVariables);

double betaf = rMaterialProperties[HIGH_CYCLE_FATIGUE_COEFFICIENTS][4];
Copy link
Member

Choose a reason for hiding this comment

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

const?


double betaf = rMaterialProperties[HIGH_CYCLE_FATIGUE_COEFFICIENTS][4];

if (std::abs(rFatigueVariables.MinStress) < 0.001) {
Copy link
Member

Choose a reason for hiding this comment

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

we should set this tolerance as a static constexpr double tolerance = 1.0e-3; like we do in the plasticity integrator


CalculateFatigueReductionFactorAndWohlerStress(rMaterialProperties, rFatigueVariables);
}
if (rFatigueVariables.AdnvanceStrategyApplied) {
Copy link
Member

Choose a reason for hiding this comment

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

typo there

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.

Some comments

rFatigueVariables.MinIndicator);
const Vector& r_aux_stresses = mPreviousStresses;
rFatigueVariables.PreviousStresses[1] = CurrentStress;
rFatigueVariables.PreviousStresses[0] = r_aux_stresses[1];
Copy link
Member

Choose a reason for hiding this comment

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

sorry I did not read it right, it is okkey

CalculateFatigueParameters(rMaterialProperties, rFatigueVariables);

const double betaf = rMaterialProperties[HIGH_CYCLE_FATIGUE_COEFFICIENTS][4];
static constexpr double tolerance = 1.0e-3;
Copy link
Member

Choose a reason for hiding this comment

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

This declaration you should do it in the .h file, see plasticity integrator

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

}
rFatigueVariables.MaxStressRelativeError = std::abs((rFatigueVariables.MaxStress - rFatigueVariables.PreviousMaxStress) / rFatigueVariables.MaxStress);

if (!rFatigueVariables.DamageActivation && rFatigueVariables.GlobalNumberOfCycles > 2 && !rFatigueVariables.AdvanceStrategyApplied && (rFatigueVariables.ReversionFactorRelativeError > 0.001 || rFatigueVariables.MaxStressRelativeError > 0.001)) {
Copy link
Member

Choose a reason for hiding this comment

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

What tolerance we use here instead of hardcoding 0.001?


///@name Member Variables
///@{
double mMaxStress = 0.0;
Copy link
Member

Choose a reason for hiding this comment

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

After checking the HCF CL, yes, it needs tracking of many things...


///@name Member Variables
///@{
double mMaxStress = 0.0;
Copy link
Member

Choose a reason for hiding this comment

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

BTW, the member variables should be in the private section of the class

@AlejandroCornejo
Copy link
Member

seems good now @SergioJimenezReyes

Copy link
Member

@AlejandroCornejo AlejandroCornejo left a comment

Choose a reason for hiding this comment

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

my last comments

ConstitutiveLaw::StressVectorType stress_vector,
double uniaxial_stress)
{
double sign_factor = CalculateTensionOrCompressionIdentifier(stress_vector);
Copy link
Member

Choose a reason for hiding this comment

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

const?


CalculateSminAndSmax(uniaxial_stress, rFatigueVariables);

rFatigueVariables.AdvanceStrategyApplied = rCurrentProcessInfo[ADVANCE_STRATEGY_APPLIED];
Copy link
Member

Choose a reason for hiding this comment

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

retrieving something without checking if has been set is dangerous... Think that somebody could use this class without the AITS. I'd use:

``

Suggested change
rFatigueVariables.AdvanceStrategyApplied = rCurrentProcessInfo[ADVANCE_STRATEGY_APPLIED];
rFatigueVariables.AdvanceStrategyApplied = rCurrentProcessInfo.Has(ADVANCE_STRATEGY_APPLIED) ? rCurrentProcessInfo[ADVANCE_STRATEGY_APPLIED : false;

{};

// Defining fatigue methods

Copy link
Member

Choose a reason for hiding this comment

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

BTW I think that we need a new method called Check which ensures that the material properties have the required Fatigue parameters in them.

Copy link
Member

Choose a reason for hiding this comment

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

to be called in the Check from the CL

@atfard
Copy link
Contributor Author

atfard commented Aug 23, 2023

A check method has been added.

uniaxial_stress *= sign_factor;

CalculateSminAndSmax(uniaxial_stress, rFatigueVariables);

rFatigueVariables.AdvanceStrategyApplied = rCurrentProcessInfo[ADVANCE_STRATEGY_APPLIED];
rFatigueVariables.AdvanceStrategyApplied = rCurrentProcessInfo.Has(ADVANCE_STRATEGY_APPLIED) ? rCurrentProcessInfo[ADVANCE_STRATEGY_APPLIED] : false;
rFatigueVariables.DamageActivation = rCurrentProcessInfo[DAMAGE_ACTIVATION];
Copy link
Member

Choose a reason for hiding this comment

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

you should do the same with this one, use Has()

Copy link
Member

Choose a reason for hiding this comment

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

all those variables set by the AITS, we should check because we may not use AITS

Copy link
Member

@AlejandroCornejo AlejandroCornejo left a comment

Choose a reason for hiding this comment

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

nice!

@atfard atfard merged commit 99e9d01 into master Aug 23, 2023
11 checks passed
@atfard atfard deleted the HCFDataContainer branch August 23, 2023 13:45
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.

4 participants