Python Script Tutorial: Using Kratos Solvers

From KratosWiki
Revision as of 18:29, 9 May 2012 by Jcotela (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In this tutorial, we will solve a structural problem using the example input file from Python Script Tutorial: Reading ModelPart From Input File


We provide an inital script using the concepts introduced in the previous sections of this tutorial

from KratosMultiphysics import * from KratosMultiphysics.StructuralApplication import *

structure_model_part = ModelPart("StructurePart") structure_model_part.SetBufferSize(1)

structure_model_part.AddNodalSolutionStepVariable(DISPLACEMENT) structure_model_part.AddNodalSolutionStepVariable(FORCE)

model_part_io_structure = ModelPartIO("example")


  1. Wiki, ch 3
  1. Creating GidIO

gid_mode = GiDPostMode.GiD_PostBinary # or GiDPostMode.GiD_PostAscii use_multi_file = MultiFileFlag.MultipleFiles # or MultiFileFlag.SingleFile deformed_mesh_flag = WriteDeformedMeshFlag.WriteDeformed # or WriteDeformedMeshFlag.WriteUndeformed write_conditions = WriteConditionsFlag.WriteElementsOnly # or WriteConditionsFlag.WriteConditions gid_io = GidIO("test",gid_mode,use_multi_file,deformed_mesh_flag, write_conditions)

gid_io.InitializeMesh( 0.0 ) gid_io.WriteMesh( structure_model_part.GetMesh() ) # I CHANGED THIS! gid_io.FinalizeMesh()

for node in structure_model_part.Nodes:

Personal tools