KPoisson.mdpa

From KratosWiki
Jump to: navigation, search

Transferring GiD input data to Kratos input data files

The new input format requires only one file with .mdpa extension (see Input Data ). This format is more user friendly in case something has to be changed using a text editor.

We'll need to create our input file containing the materials, nodes, elements, Boundary conditions and Loads. Here's a simple example that is self explanatory:

example.mdpa

Begin ModelPartData
//  VARIABLE_NAME value
End ModelPartData

//we start by looping only in the materials used, GID does this automatically
Begin Properties 1            
DUMMY_MATERIAL 1.0
End Properties

Begin Nodes
      1         0.15421        -2.88256         0.00000                               
      2        -3.37484        -2.88256         0.00000                               
      3         0.15421         2.12337         0.00000                               
      4        -3.37484         2.12337         0.00000                               
      5        -6.90389        -2.88256         0.00000                               
      6        -6.90389         2.12337         0.00000                               
      7       -10.43295        -2.88256         0.00000                               
      8       -10.43295         2.12337         0.00000                               
      9       -13.96200        -2.88256         0.00000                               
     10       -13.96200         2.12337         0.00000                               
End Nodes
 
Begin Elements Poisson2D
 1 1 3 4 1
 2 1 6 8 5
 3 1 9 7 8
 4 1 5 2 4
 5 1 2 1 4
 6 1 4 6 5
 7 1 8 10 9
 8 1 7 5 8
End Elements
 
Begin NodalData DUMMY_UNKNOWN          //be careful, variables are case sensitive!
9     1    0              
10   1    0              
End NodalData

Begin NodalData DUMMY_POINT_SOURCE              //now we loop the loads
1    0    453534                      
3    0    453534                      
End NodalData


GID will create the .mdpa starting from a .bas file. In our case we'll name it Kpoisson.mdpa.bas . This file will have the instructions to write Kratos' input file. The commands to tell GID what to do are quite simple and begin with a *, the words not used by the commands will be printed directly in the created file. A manual can be downloaded from this link <http://gid.cimne.upc.es/>.

01_kPoisson.mdpa.bas

Begin ModelPartData
//  VARIABLE_NAME value
End ModelPartData

//we start by looping only in the materials used, GID checks that automatically
*loop materials
Begin Properties *matnum()            
DUMMY_MATERIAL *matprop(1)
End Properties
*end

Begin Nodes
*loop nodes
*format "%6i%15.5f%15.5f%15.5f"
 *NodesNum *NodesCoord(1) *NodesCoord(2) *NodesCoord(3)                               
*end
End Nodes

Begin Elements Poisson2D
*loop elems
 *elemsnum *elemsmat *elemsConec
*end elems
End Elements

Begin NodalData DUMMY_UNKNOWN          //be careful, variables are case sensitive!
*Set cond Point_Fix_Value *nodes
*Add cond Line_Fix_Value *nodes
*loop nodes  *OnlyInCond
*NodesNum 1 *cond(1,int)              
*end
End NodalData

Using *Set cond and *Add cond and later *OnlyInCond creates a loop only on the restricted nodes. The same commands are used for the loads:

Begin NodalData DUMMY_POINT_SOURCE              //now we loop the loads
*Set cond Point_Dummy_Load *nodes
*loop nodes  *OnlyInCond
*NodesNum    0    *cond(1)                      
*end nodes
End NodalData

When creating the input files starting from the .bas files, GID will not read the .mdpa extension between the dots (it is only used for the user's clarity) . It simply starts with kPoisson.bas, naming it example.dat and then proceeds to create the others ommiting the "01_" and adding -1 at the end, -2 for the next and so on. The .bat file will be in charge of deleting the ones from the last run and renaming the new ones properly. example.dat will contain the python commands and therefore we'll have to change the extension later to .py . This file also executes the python script at the end:

kPoisson.bat

#!/bin/csh -f
#    OutputFile: $2/$1.info
#    ErrorFile: $2/$1.err
#delete previous files
rm $2/$1.mdpa
rm $2/$1.py
mv $2/$1.dat $2/$1.py
mv $2/$1-1.dat $2/$1.mdpa
python $2/$1.py >$2/$1.log
Personal tools
Categories