How to read a mdpa file

From KratosWiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "The mdpa file can store most of the data stored in a ModelPart. The detail description of the mdpa format can be found in Input Data. The ModelPartIO class (and its derivativ...")
 
m
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
The mdpa file can store most of the data stored in a ModelPart. The detail 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.  
+
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 extionsion''':
+
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")
 
  model_part_io_structure = ModelPartIO("path/to/file/example")
Line 16: Line 16:
  
  
It is important to mention that in the above example two default flags are passing to the constructor which is equivalent to:
+
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)
 
  model_part_io_structure = ModelPartIO("path/to/file/example",IO.READ|IO.NOT_IGNORE_VARIABLES_ERROR)
  
which is for read the mdpa and to NOT ignore the error when a nodal variable is not added as solution step data in the node. The latter option can be change to ignore as follow:
+
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)
 
  model_part_io_structure = ModelPartIO("path/to/file/example",IO.READ|IO.IGNORE_VARIABLES_ERROR)

Latest revision as of 07:07, 5 May 2015

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:

model_part_io_structure.ReadModelPart(structure_model_part)


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
Categories