Kratos icon indicating copy to clipboard operation
Kratos copied to clipboard

[StructuralMechanicsApplication] Fix Lumped factors in Massmatrix for solids

Open loumalouomega opened this issue 4 years ago • 19 comments

Description Fix #8457. Computes just once the lumping factors. NOTE: I think that this could be an issue with imposed displacement, in any case the lumping factors can still be computed in an external process

Changelog

  • Added variable LUMPING_FACTORS
  • Compute factors just once

loumalouomega avatar Mar 10 '21 18:03 loumalouomega

IMO the element should be in charge of this

If you see my first commits, I tried to be computed by the element all the time, but the method is const, so I cannot do a SetValue without doing an evil const_cast

loumalouomega avatar Mar 11 '21 10:03 loumalouomega

Then, do you allow me to const_cast?

El vie., 12 mar. 2021 13:48, Philipp Bucher @.***> escribió:

@.**** commented on this pull request.

In applications/StructuralMechanicsApplication/custom_elements/base_solid_element.cpp https://github.com/KratosMultiphysics/Kratos/pull/8462#discussion_r593147729 :

@@ -1696,8 +1696,13 @@ void BaseSolidElement::CalculateLumpedMassVector( // LUMPED MASS MATRIX const double total_mass = GetGeometry().DomainSize() * density * thickness;

  • Vector lumping_factors;
  • lumping_factors = GetGeometry().LumpingFactors( lumping_factors );
  • Vector lumping_factors(number_of_nodes);
  • if (this->Has(LUMPING_FACTORS)) {
  •    lumping_factors = this->GetValue(LUMPING_FACTORS);
    
  • } else {
  •    lumping_factors = GetGeometry().LumpingFactors( lumping_factors );
    
  •    this->SetValue(LUMPING_FACTORS, lumping_factors);
    

well the element shouldnt set it if it would set it here the first time it is called it wouldn't work in restarts

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/KratosMultiphysics/Kratos/pull/8462#discussion_r593147729, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYQZAGTKROSYQ3XJACZGZLTDIESLANCNFSM4Y6SA2ZA .

loumalouomega avatar Mar 12 '21 13:03 loumalouomega

Then, do you allow me to const_cast?

No, I mean it would anyway not work, as in restart the configuration in the first timestep is anyway no longer the reference config

philbucher avatar Mar 12 '21 13:03 philbucher

Then, do you allow me to const_cast?

No, I mean it would anyway not work, as in restart the configuration in the first timestep is anyway no longer the reference config

The restart saves the values of the DataValueContainer?, because if it is saved, it will be saved together with the rest of values

loumalouomega avatar Mar 12 '21 16:03 loumalouomega

Then, do you allow me to const_cast?

No, I mean it would anyway not work, as in restart the configuration in the first timestep is anyway no longer the reference config

The restart saves the values of the DataValueContainer?, because if it is saved, it will be saved together with the rest of values

Yes but then we could directly store them as members without the overhear of the DVC

philbucher avatar Mar 15 '21 08:03 philbucher

which is not what we want, but for now I don't know a better solution hence I wanted to discuss it in the KTC first before making a decision here

philbucher avatar Mar 15 '21 08:03 philbucher

which is not what we want, but for now I don't know a better solution hence I wanted to discuss it in the KTC first before making a decision here

well, but not all the problems require the lumped factors. We can use a pointer which requires an additional double of storage by default

loumalouomega avatar Mar 15 '21 08:03 loumalouomega

which is not what we want, but for now I don't know a better solution hence I wanted to discuss it in the KTC first before making a decision here

Any news?

loumalouomega avatar Jun 02 '21 14:06 loumalouomega

which is not what we want, but for now I don't know a better solution hence I wanted to discuss it in the KTC first before making a decision here

Any news?

Ping

loumalouomega avatar Aug 31 '21 14:08 loumalouomega

unfortunately no news yet

philbucher avatar Sep 22 '21 12:09 philbucher

unfortunately no news yet

And now?

loumalouomega avatar Dec 23 '21 09:12 loumalouomega

still the original issue is not solved that we need a way to compute things on the initial configurations

ping @KratosMultiphysics/technical-committee

philbucher avatar Dec 27 '21 12:12 philbucher

still the original issue is not solved that we need a way to compute things on the initial configurations

Okay, can be solved, but this problem existed before this PR already

loumalouomega avatar Jan 06 '22 16:01 loumalouomega

we cannot accept this change as it would imply storing on every element the lumping fasctors, which would imply storing a vector on every element.

the geometry has a function lumping factors that can be called. For low order elements (triangles or tets) it is cheap...not so for other kind of elements, still i think it is better to recompute than to store it

I think, the important question is @KlausBSautter (this fixes #8457) if this is for explicit simulation, because in that case we have the tradeoff between computing each time (expensive in explicit) or storing more memory. Depending on that, we will need to discuss

loumalouomega avatar Apr 29 '22 12:04 loumalouomega

we cannot accept this change as it would imply storing on every element the lumping fasctors, which would imply storing a vector on every element. the geometry has a function lumping factors that can be called. For low order elements (triangles or tets) it is cheap...not so for other kind of elements, still i think it is better to recompute than to store it

I think, the important question is @KlausBSautter (this fixes #8457) if this is for explicit simulation, because in that case we have the tradeoff between computing each time (expensive in explicit) or storing more memory. Depending on that, we will need to discuss

Ping @KlausBSautter

loumalouomega avatar May 05 '22 16:05 loumalouomega

It is basically for both implicit and explicit, it does not matter. In the mebrane_element.cpp file for quads I calculate det(J) everytime based on the reference coordinates X0. So I implicitly went for the more expensive choice of recalculating the lumping factors. I dont think this will cause an overhead, will it? Maybe for very large models

KlausBSautter avatar May 06 '22 07:05 KlausBSautter

It is basically for both implicit and explicit, it does not matter. In the mebrane_element.cpp file for quads I calculate det(J) everytime based on the reference coordinates X0. So I implicitly went for the more expensive choice of recalculating the lumping factors. I dont think this will cause an overhead, will it? Maybe for very large models

The calculation for implicit simulation will be an overhead, but is preferable to memory consumption. But for explicit I think this is a no-go, it will make simulation incredibly expensive. Ping @RiccardoRossi

loumalouomega avatar May 06 '22 07:05 loumalouomega

that is why I always use triangles :D

KlausBSautter avatar May 06 '22 08:05 KlausBSautter

Do I understand correctly, that we prefer an incorrect implementation because of performance for explicit simulation in the expense of a correct implementation?

mpentek avatar Aug 04 '22 07:08 mpentek