KratosMultiphysics / GiDInterface

The graphical user interface of Kratos for GiD. Featuring CFD, CSM, DEM, PFEM, etc
Other
30 stars 16 forks source link

[MPM] Create Initial Conditions associated to the Material_domain model part #968

Open lauramoremar opened 4 months ago

lauramoremar commented 4 months ago

Hi,

I am trying to incorporate the Initial Condition in the Interface for the MPM app. Usually, the conditions are created over the Background_Grid, but for the Initial Condition I will need to impose it in a submodel part that belongs to the Material_domain and I am not sure how to do it.

In my branch MPM/laura I have incorporate the new option, that looks like that:

Screenshot from 2024-02-20 10-53-52

and it write the condition properly in the .json. Everything works well except the model_part_name.

"initial_conditions_processes" : [{
            "python_module" : "assign_initial_condition_to_particle_process",
            "kratos_module" : "KratosMultiphysics.ParticleMechanicsApplication",
            "process_name"  : "AssignInitialConditionToParticleProcess",
            "Parameters"    : {
                "model_part_name" : "Background_Grid.0",
                "variable_name"   : "MP_VELOCITY",
                "component"       : ["1.667*z",0.0,0.0]
            }
        }]

In this case, we need to write a submodel_part from the Material_Domain (for example), "model_part_name" : "Parts_Material_domain_Column".

I attach here one small case with the proper setting (it works well using my branch). twist2.gid.zip

Thank you very much in advance

jginternational commented 4 months ago

Hi @lauramoremar Check the modifications I've pushed to your branch.

Here https://github.com/KratosMultiphysics/GiDInterface/commit/9c31e35542d603183b97b00918a570bc5c2e6547 we are printing the submodelpart in the mdpa

Here https://github.com/KratosMultiphysics/GiDInterface/commit/2c0555c2ee972697d8ea681f9f79e9e1581a38e7?diff=split&w=1 we set the proper model_part_name

lauramoremar commented 4 months ago

Hi @jginternational , thank you very much!! It is exactly I wanted to do! :) I was checking all the changes, and I have found that in the .mdpa file, only the Nodes are writen for the new submodel part, but not the elements...

Should I include something additionally in the proc MPM::write::writeSubmodelparts { type } as you have done in 9c31e35 ?

Thank you again

jginternational commented 4 months ago

@lauramoremar mmm... There was a decision at the begining of the kratos GiD problemtype project that said that the initial conditions were nodal.

If we want the nodes AND the contitions, we have to move them to the Conditions section, but they will be NOT initial :( As long as MPM app is not using Intervals, I don't see a clear solution

lauramoremar commented 4 months ago

Ok, I get it, @jginternational, thank you! It is true that for the case of the MPM app the initial conditions should be applied over the material points and not over the nodes, and for doing that, as far I know, we need the info over the Elements.

I will think about the solution these days :)

lauramoremar commented 4 months ago

Hi @jginternational ,

We think that there are two problems, one related to the interface and the other to the write process.

In the case of the MPM we need to impose the initial condition to the material points. Therefore we need to select the submodel part created for the material domain. For example in the next figure there are two material domains (Sand and Steel), and the initial condition only should be applied to one or both the material domains. So, we don't need to create new submodel parts, but only to associate the initial condition to one of the submodel parts created before. For this reason we don't need the bottoms that allows to select points, lines or surfaces, and in the .mpda file we don't need to print anything related to this condition (nodes, elements,...).

Screenshot from 2024-02-27 16-40-52

On the other hand, for the .json we need:

"initial_conditions_processes" : [{
          "python_module" : "assign_initial_condition_to_particle_process",
          "kratos_module" : "KratosMultiphysics.ParticleMechanicsApplication",
          "process_name"  : "AssignInitialConditionToParticleProcess",
          "Parameters"    : {
              "model_part_name" : "Initial_MPM_Material.Parts_Material_domain_Sand",
              "variable_name"   : "MP_VELOCITY",
              "component"       : ["1.667*z",0.0,0.0]
          }
      }]

where, as you can see, the model part name is the same of the model part domain.

Do you think that is possible to do something similar?

I attach a working example with the .json and the .mpda files that we would like to obtain when imposing the initial condition to one of the material domains (in the case the Sand domain). ball.gid.zip

Thank you very much!! :)

jginternational commented 4 months ago

Ok, at this moment we have something similar to what you need. It's the "geometry" feature in the MDPA input file. Check the FLUID app

It means that, instead of writing elements, conditions and so, we print the gid groups as they are, and the element or condition are asigned in the json file, using an orquestrator

This means that the same group will be writen only once, and used in several points of the tree. It was introduced here https://github.com/KratosMultiphysics/GiDInterface/pull/951

We can not prevent the user to select a group or another when creating new initial conditions BUT we can "validate" and print warnings to the user, so if a new group or a wrong group is selected, we can display a message with the information BEFORE writing the MDPA file.

This may be strange. Maybe I can create a branch from here to show you