Assertion failed when running pylith_genxdmf

Hi PyLith developers,

Based on an example (2d/gravity/generate_initial_stress.py), I tried to write a python script to calculate principal stresses and directions, and wrote that into the h5 file using h5py. The first time I tried to run pylith_genxdmf on the new h5 file created, I got “RuntimeError: Could not open attribute ‘vector_field_type’ of ‘/cell_fields/sigma1’”. I went back to the python script and added the attributes required (scalar vs. vector, from what I understand). Now when I run pylith_genxdmf, I get the following error:

Assertion failed: (0), function parseVectorFieldString, file …/…/…/pylith-baagaard/example-3d-subduction/libsrc/pylith/topology/FieldBase.cc, line 88.

Abort trap: 6

I can’t figure out the error and why it mentions a file in Brad’s directories.

I’m running pylith-2.2.1rc1-darwin-10.11.6 on MacOS Mojave. Unfortunately I can’t upload the .h5 and .py files through this platform.

Any advice on how to proceed would be most helpful. Thank you.

Cheers,
Sarah

PyLith did not recognize the attribute as a vector field type. Value values are scalar, vector, tensor, other, multi_scalar, multi_vector, multi_tensor, and multi_other. If you still can’t fix the problem, using h5dump to dump out the dataset and attribute information for the data you added and include that in your post.

We will replace the assert() that caught the error with a better error message. When an assert is triggered in prints the file and line where the failure occurred.

Hi Brad,

Thanks for clarifying that the error has something to do with the vector field type attribute. I originally defined the attribute using:

dataset_sigma.attrs[‘vector_field_type’] = “tensor”

but (as outputted from h5dump) that resulted to:

ATTRIBUTE “vector_field_type” {
DATATYPE H5T_STRING {
STRSIZE H5T_VARIABLE;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
(0): “tensor”
}
}

The issue seems to be STRSIZE, since all the other existing attribute datatypes had a number value for STRSIZE instead of H5T_VARIABLE.

When I instead defined the attribute using:

dataset_sigma.attrs.create(name=‘vector_field_type’,data=“tensor”)

the STRSIZE now says 6, and pylith_genxdmf now works fine. Just leaving this info here in case anybody runs into a similar problem.

Cheers,
Sarah

Thanks for reporting what worked! I have added this to the PyLith issues on GitHub (https://github.com/geodynamics/pylith/issues/86) so that we will remember to look into this further (when we have some time) to see if we can make the Xdmf code more robust.