How to read a mdpa file
The mdpa file can store most of the data stored in a ModelPart. The detailed description of the mdpa format can be found in Input Data. The ModelPartIO class (and its derivatives) are in charge of reading a mdpa file and transfer its data to the ModePart.
In python one should first create a ModelPartIO object by calling its constructor and passing the input file path/name without the .mdpa extension:
model_part_io_structure = ModelPartIO("path/to/file/example")
the file name is used without the .mdpa extension!
Then use this io object to read the file and store the mesh and data in ModelPart:
It is important to mention that in the above example two default flags are being passed to the constructor, equivalent to:
model_part_io_structure = ModelPartIO("path/to/file/example",IO.READ|IO.NOT_IGNORE_VARIABLES_ERROR)
which is for reading the mdpa and NOT to ignore the error when a nodal variable is not added as solution step data in the node. The latter option can be changed to 'ignore' as follows:
model_part_io_structure = ModelPartIO("path/to/file/example",IO.READ|IO.IGNORE_VARIABLES_ERROR)