Using Python with FLAC3D
This section gives an example of using a Python program to interact with FLAC3D. In this example we create a simple FLAC3D model and use Python to apply boundary conditions and explore the model response.
First we import the itasca
and module with the import
statement. The itasca
module defines the interaction between
Python and FLAC3D. We import the itasca
module as the shortened
name it
.
import itasca as it
it.command("""
program load module 'zone'
program load guimodule 'zone'
program load module 'body'
program load guimodule 'body'
program load module 'extruder'
program load guimodule 'extruder'
program load module 'sel'
program load module 'zonesel'
program load module 'selpython'
program load module 'wallsel'
program load guimodule 'sel'
program load module 'pfcsel'
program load module 'rblocksel'
program load module 'dfnzone'
program load module 'ballzone'
program load module 'zonepython'
program load module 'wallzone'
""")
We are going to create some zones to show features of the Python scripting.
These commands create zones and set some properties. The triple quotes are used to define a multi-line string.
it.command("""
model new
model large-strain off
zone create brick size 10 10 10
zone cmodel assign elastic
zone property density 2950 young 12e9 poisson 0.25
cycle 1
""")
Was this helpful? ... | Itasca Software © 2024, Itasca | Updated: Dec 19, 2024 |