DPF API in C#: ansys_unit_system_id values / custom unit system before h5 serialisation?

Fran.Rourke
Fran.Rourke Member Posts: 2 **

Hello,

When I am using a hdf5dpf_generate_result_file() operator, I can provide an id for the unit system via:

var h5WriteOperator = new hdf5dpf_generate_result_file();
h5WriteOperator.inputs.ansys_unit_system_id.Connect(id);

where id is some integer. I can't seem to find anywhere a list of the available systems and what id they correspond to, could you point me in the right direction please?

My own investigation, by varying this id, and then getting the unit system from the ResultInfo when reading a file back in, yielded the following:

There are some repeats, which I've tabbed out. I found that setting the id = 3, or id > 16 gives the following error:

Setting id = 4 actually causes a stack overflow to occur:

h5WriteOperator.inputs.ansys_unit_system_id.Connect(4);
h5WriteOperator.Connect(4, "V");
h5WriteOperator.Connect(5, velocityFieldsContainer);
h5WriteOperator.Run();

--> Stack Overflow.

Is there any way I can set up a custom unit system and connect this to the hdf5dpf_generate_result_file() operator before serialisation? For my application I just need to make sure the length and force units are set correctly before the file is serialised.

Many thanks,
Fran Rourke

Tagged:

Answers

  • AlexGh
    AlexGh Member Posts: 23
    10 Comments First Answer Name Dropper
    **

    For my application I just need to make sure the length and force units are set correctly before the file is serialised.

    Hi Fran!
    I suggest performing the conversion of values into the required unit system using UnitsManager (Ans.Core.dll).

    var l_mm = Ansys.Core.Units.UnitsManager.ConvertUnit(node.X, "m", "mm");
    Or check out this function
    UnitsManager.ConvertToUnitSystem