KratosMultiphysics / Kratos

Kratos Multiphysics (A.K.A Kratos) is a framework for building parallel multi-disciplinary simulation software. Modularity, extensibility and HPC are the main objectives. Kratos has BSD license and is written in C++ with extensive Python interface.
https://kratosmultiphysics.github.io/Kratos/
Other
1.02k stars 244 forks source link

StructuralMechanicsApplication - CL - Strain computation #1652

Closed PhilippeBussetta closed 6 years ago

PhilippeBussetta commented 6 years ago

In the elastic_isotropic_3d.cpp of StructuralMechanicsApplication I don't understand well why the deformation gradient F is tested -- line 84. I think that lines 84-87 are not necessary because the strain are computed line 73 or given by the element.

In addition I don't understand well the flag COMPUTE_CONSTITUTIVE_TENSOR If the flag is False, we assume that the value of C is already computed? Thus we have to use the old value to compute the stress ? C is computed if the flag is True-- line 79 as well False -- line 297.

PhilippeBussetta commented 6 years ago

@KratosMultiphysics/structural-mechanics COMPUTE_CONSTITUTIVE_TENSOR could be managed by the integration scheme?

RiccardoRossi commented 6 years ago

I agree with you. Those lines are unnecessary (and actually wrong, in the case of USE_ELEMENT_PROVIDED_STRAIN=True). I think this should be implemented as something like (a better error message is ok)

if(Options.IsNot( ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN ))
{
    KRATOS_DEBUG_ERROR_IF_NOT(rValues.IsSetDeformationGradientF()) << "Element does not provide strain, hence F has to be provide. This is not the case"
    CalculateCauchyGreenStrain(rValues, StrainVector);
}

and then by reoving the lines you posted.

I don't follow you on your second comment

PhilippeBussetta commented 6 years ago

The COMPUTE_CONSTITUTIVE_TENSOR is used to save time regarding the computation of the tensor or to save memory? When is False, we assume that C is already computed or we have to compute the stress without saving C?

RiccardoRossi commented 6 years ago

the elasticity tensor C := diff(sigma)/d(strain)

computing it is often difficult (not for a linear law obviously). for this reason if one wants to do explicit, only computing the stresses is needed (without having to compute C). The flag is designed to allow this possibility

RiccardoRossi commented 6 years ago

I mean, for a well implemented linear law, the stress should be implemented WITHOUT REQUIRING ALLOCATING C.

I am pretty sure i originally implemented that this way. It is not currently like this in the code, but this is definitely a performance bug

PhilippeBussetta commented 6 years ago

I agree with you, computing C is not easy in nonlinear CL, so some time one want use the tensor from the previous step to save CPU time. For example the integration scheme can put the flag True in the first iteration then False during n iteration. To use the same tangent stiffness matrix during few iteration.

RiccardoRossi commented 6 years ago

Hi @PhilippeBussetta however take into account that you cannot store the C (at least in general) since doing so implies storing 36 doubles per gauss point, which is A LOT.

if you want to reuse the same stiffness matrix, the strategy should take care of this (in principle it is able to do that)

PhilippeBussetta commented 6 years ago

@RiccardoRossi , I understand, the flag is just use at the material level, at gauss point

RiccardoRossi commented 6 years ago

i am closing this since i believe a conclusion is reached. please reopen if needed