Problem on ogstools 0.4.0

Dear all,

Recently I install the new ogstools (version: 0.4.0), and try to convert my .msh file to .vtu files. However, even though I use the keywords -r -k, the MaterialIDs in the .vtu files will not be renumbered. Whats more, the embedded line elements will cause errors like ValueError: Incompatible cell data. Cell block 0 ('line') has length 804, but corresponding cell data item has length 805.. My .geo and .msh file is attatched.

I will really appreciate if someone could help. Thanks.
hydraulicfracturing.zip (508.1 KB)

Hi Augustus,
I am sorry that you have a problem with ogstools.
Are you sure that you need the -k flag? Your msh file converts fine with just -r flag. In most cases you don’t need it and it will be removed in future release.
Thank you very much for reporting this problem!
Best,
Feliks

1 Like

Thank you, Feliks. It actually can work without -k flag. However the MaterialID of the domain will not be renumbered from 0. Is it a bug of the new version of ogstools? Since the practice on ogstools 0.1.0 on my PC is OK.
Best,
Hanzhang

Are you sure you used the flag -r? Without it the MaterialIDs will NOT be renumbered.

So, calling msh2vtu this way:

msh2vtu hydraulicfracturing.msh 

will give you vtu file hydraulicfracturing_domain.vtu in which MaterialIDs will be equal to 11.

If you use -r flag (like reindex/renumber):

msh2vtu -r hydraulicfracturing.msh  

MaterialIDs in hydraulicfracturing_domain.vtu will be set to 0.

This is how it works on my machine and it is the expected behaviour.

Best,
Feliks

1 Like

Hi, Feliks. Thank you for the reply. I have tried both commands, but the -r flag seems not working with ogstools 0.4.0 on my machine. The output logs with and without -r flag are the same. They give

(base) han@LAPTOP-14QO8OUG:/mnt/d/OGS_models$ msh2vtu hydraulicfracturing.msh
INFO:root:Output: hydraulicfracturing

INFO:root:Original mesh (read)
INFO:root:<meshio mesh object>
  Number of points: 40806
  Number of cells:
    line: 805
    quad: 40401
  Cell data: gmsh:physical, gmsh:geometrical
  Field data: left, right, top, bottom, injection, square
INFO:root:Detected mesh dimension: 2
INFO:root:##
WARNING:root:There are nodes out of the domain mesh. If ogs option is set, then no bulk_node_id can be assigned to these nodes.
INFO:root:Domain mesh (written)
INFO:root:40804 points in 3 dimensions
INFO:root:cells: 40401 quad
INFO:root:point_data=['original_node_number']
INFO:root:cell_data=['MaterialIDs']
INFO:root:cell_sets=[]
INFO:root:##
INFO:root:Points not connected with domain cells:
INFO:root:[4, 5]
WARNING:root:1 boundary_cells don't belong to any domain cell!
INFO:root:Boundary mesh (written)
INFO:root:804 points in 3 dimensions
INFO:root:cells: 804 line
INFO:root:point_data=['bulk_node_ids']
INFO:root:cell_data=['bulk_elem_ids']
INFO:root:cell_sets=[]
INFO:root:##
INFO:root:Submesh left (written)
INFO:root:202 points in 3 dimensions
INFO:root:cells: 201 line
INFO:root:point_data=['bulk_node_ids']
INFO:root:cell_data=['bulk_elem_ids']
INFO:root:cell_sets=[]
INFO:root:##
INFO:root:Submesh right (written)
INFO:root:202 points in 3 dimensions
INFO:root:cells: 201 line
INFO:root:point_data=['bulk_node_ids']
INFO:root:cell_data=['bulk_elem_ids']
INFO:root:cell_sets=[]
INFO:root:##
INFO:root:Submesh top (written)
INFO:root:202 points in 3 dimensions
INFO:root:cells: 201 line
INFO:root:point_data=['bulk_node_ids']
INFO:root:cell_data=['bulk_elem_ids']
INFO:root:cell_sets=[]
INFO:root:##
INFO:root:Submesh bottom (written)
INFO:root:202 points in 3 dimensions
INFO:root:cells: 201 line
INFO:root:point_data=['bulk_node_ids']
INFO:root:cell_data=['bulk_elem_ids']
INFO:root:cell_sets=[]
INFO:root:##
WARNING:root:1 boundary_cells don't belong to any domain cell!
INFO:root:In physical group injection are bulk_elem_ids not uniquely defined, e.g. for cells of boundary dimension inside the domain, and thus not written. If bulk_elem_ids should be written for a physical group, then make sure all its cells of boundary dimension are located at the boundary.
INFO:root:Submesh injection (written)
INFO:root:2 points in 3 dimensions
INFO:root:cells: 1 line
INFO:root:point_data=['bulk_node_ids']
INFO:root:cell_data=[]
INFO:root:cell_sets=[]
INFO:root:##
INFO:root:Submesh square (written)
INFO:root:40804 points in 3 dimensions
INFO:root:cells: 40401 quad
INFO:root:point_data=['bulk_node_ids']
INFO:root:cell_data=['MaterialIDs']
INFO:root:cell_sets=[]
INFO:root:##

and

(base) han@LAPTOP-14QO8OUG:/mnt/d/OGS_models$ msh2vtu -r hydraulicfracturing.msh
INFO:root:Output: hydraulicfracturing

INFO:root:Original mesh (read)
INFO:root:<meshio mesh object>
  Number of points: 40806
  Number of cells:
    line: 805
    quad: 40401
  Cell data: gmsh:physical, gmsh:geometrical
  Field data: left, right, top, bottom, injection, square
INFO:root:Detected mesh dimension: 2
INFO:root:##
WARNING:root:There are nodes out of the domain mesh. If ogs option is set, then no bulk_node_id can be assigned to these nodes.
INFO:root:Domain mesh (written)
INFO:root:40804 points in 3 dimensions
INFO:root:cells: 40401 quad
INFO:root:point_data=['original_node_number']
INFO:root:cell_data=['MaterialIDs']
INFO:root:cell_sets=[]
INFO:root:##
INFO:root:Points not connected with domain cells:
INFO:root:[4, 5]
WARNING:root:1 boundary_cells don't belong to any domain cell!
INFO:root:Boundary mesh (written)
INFO:root:804 points in 3 dimensions
INFO:root:cells: 804 line
INFO:root:point_data=['bulk_node_ids']
INFO:root:cell_data=['bulk_elem_ids']
INFO:root:cell_sets=[]
INFO:root:##
INFO:root:Submesh left (written)
INFO:root:202 points in 3 dimensions
INFO:root:cells: 201 line
INFO:root:point_data=['bulk_node_ids']
INFO:root:cell_data=['bulk_elem_ids']
INFO:root:cell_sets=[]
INFO:root:##
INFO:root:Submesh right (written)
INFO:root:202 points in 3 dimensions
INFO:root:cells: 201 line
INFO:root:point_data=['bulk_node_ids']
INFO:root:cell_data=['bulk_elem_ids']
INFO:root:cell_sets=[]
INFO:root:##
INFO:root:Submesh top (written)
INFO:root:202 points in 3 dimensions
INFO:root:cells: 201 line
INFO:root:point_data=['bulk_node_ids']
INFO:root:cell_data=['bulk_elem_ids']
INFO:root:cell_sets=[]
INFO:root:##
INFO:root:Submesh bottom (written)
INFO:root:202 points in 3 dimensions
INFO:root:cells: 201 line
INFO:root:point_data=['bulk_node_ids']
INFO:root:cell_data=['bulk_elem_ids']
INFO:root:cell_sets=[]
INFO:root:##
WARNING:root:1 boundary_cells don't belong to any domain cell!
INFO:root:In physical group injection are bulk_elem_ids not uniquely defined, e.g. for cells of boundary dimension inside the domain, and thus not written. If bulk_elem_ids should be written for a physical group, then make sure all its cells of boundary dimension are located at the boundary.
INFO:root:Submesh injection (written)
INFO:root:2 points in 3 dimensions
INFO:root:cells: 1 line
INFO:root:point_data=['bulk_node_ids']
INFO:root:cell_data=[]
INFO:root:cell_sets=[]
INFO:root:##
INFO:root:Submesh square (written)
INFO:root:40804 points in 3 dimensions
INFO:root:cells: 40401 quad
INFO:root:point_data=['bulk_node_ids']
INFO:root:cell_data=['MaterialIDs']
INFO:root:cell_sets=[]
INFO:root:##

Both of the commands will not renumber the MaterialIDs. It is confusing.

Best,
Hanzhang

I see. I am sorry, indeed there is a bug in version 0.4.0 (and possibly previous ones). It was fixed here. Unfortunately, this fix isn’t included in version 0.4.0.

You can either switch to the development branch (clone the OGSTools repo and follow this guide to install it) or wait for the next release.

1 Like

Thank you, Feliks. I will try another branch.