GiDInterface
GiDInterface copied to clipboard
Export model files in MPa unit system
I generally use the SI-derived engineering MPa unit system, i.e. millimeter, tonne, second, newton, megapascal, etc. In the past I have used a workaround, which requires changing the material files after writing the Kratos model files. This is a bit of pain, especially for my students who are beginning with GiD-Kratos.
Is it possible to do this in a more "native" way? I have found the file .../GiDx64/gid-14.1.10d/scripts/customLib/customLib/units.xml but to be honest do not really see the workflow on how the MDPA and StructuralMaterials.py files are written in regard to the units.
Any help here would be much appreciated!
Hi @e-dub .
The Kratos problemtype defines the unit system that it's going to be written in it's spd / xml files, and allows the user to use another unit system in the interface. For example, in this structural app 2D example, the units for the module of the line load by default are N/m, so this is what is expected to be written in the json file.
The default units are defined in the condition:

The gui shows the default unit

And that is what we get printed in the Project parameters.json file

If the user changes the units in the GUI:

It is converted automatically to respect the unit system the application needs.

in this case, the default unit was N/m and the user changed to N/mm, so the writing process convert the 70 N/mm the user selected to 70000 N/m the application expects. This is how it works, you can still use the unit system you need (Even change to Imperial system 😢 ) as a user, and the program will convert it to the units expected by the kratos application.
You can change the units of the mesh (mdpa) in the Units section of the tree.
By default set to m
Will generate this mdpa:

And by changing it to mm:
This conversion is done, so mdpa looks like:

I don't know if this solves your questions. The only I can add to this is that you are not alone in this issue (see #394) .
Many thanks @jginternational for the fast and detailed answer!
Summarized, I want to avoid the automatic translation to SI and keep the Kratos model in MPa units, i.e. nodes in mm.
If I understood this correctly, I would have to change all the XML files, e.g. in .../GiDInterface/kratos.gid/apps/Structural/xml/, to implement such a change. Is there an easier way to avoid the automatic translation to SI in GiD?
Take into account that a kratos model is "unitless". It just need to be coherent. In the user interface, we have them to help, but the input files are unitless.
I don't really understand what do you need. Do you need that the default units in the interface are MPa instead on Pa, and mm instead of m? Do you need to choose the 'units' written in the input files, so if the user says that a pressure is 5MPa in the json you see a 5 instead of 5000 ?
You can check this branch, and play with the bottom section of the tree -> Write units https://github.com/KratosMultiphysics/GiDInterface/tree/unit-system
Wow that was quick! Respect!
For not understanding, you got it quite good :wink: ! I probably was not clear, sorry. Summarized: Of course the solver is blind to units and the consistent unit system represents a simple scaling of the model. Basically, I want to choose the consistent unit system that is written to the model. Currently, this is SI; I want to write everything in the MPa consistent unit system, i.e. mm, tonne, s, N, MPa, etc.
I tested the branch with a simple structural model and the mesh "stays" in mm. The material model is though written in SI. I saw your changes and tried to do the same for the material, but I am not smart enough :wink:...yet
I got a chance to look at this again today. The MDPA "keeps" mm only if I change the mesh to m. E.g.: I set the mesh units to mm, build a structural model (a simple rectangle with 10x5), and write units set to mm, it still gives unfortunately me 0.01 in the MDPA file.
I could the Young's modulus is properly scaled with changing line 61 of WriteMaterials.tcl
set value [gid_groups_conds::convert_value_to_default $valueNode]
to
set value [gid_groups_conds::convert_value_to_active $valueNode]
For density, I did not find t/mm³ so this was not possible. On one side, it seems normal to me to have my models in the MPa unit system, but it seems like a pain to change this so this is possible. What do you say?
I need to think about it this weekend, but it's a pain and can bring future problems
Yeah, totally understand! If it is still not clear, we can have a quick call early next week. Thanks for your time, much appreciated!