How to read a mdpa file

From KratosWiki
Revision as of 07:07, 5 May 2015 by Salva (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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")

Warn_icon.gif Note:

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)
Personal tools