Create model from imported mesh#
OpenFDEM supports users to import standard mesh files such as .inp
files, .msh
files, and .geo
files to run the model.
This example will review how to setup a uniaxial compressive test example with output from Gmsh
software.
Runtime: < 10 min on i9 8-core Windows 10 Machine
Expected tutorial output (visualized in ParaView
):
Note
OpenFDEM supports four main mesh pre-processing approaches:
A user defined command in OpenFDEM to create mesh automatically
Importing a
.geo
fileImporting a
.msh
fileMesh developed from other commercial softwares, including
.inp
,.dxf
,.fdem
,.tess
(for grain-based model only) and.jpg
(for grain-based module and DFN module only).
1 Tutorial Prerequistes#
The following files are needed to follow along the tutorial:
Job-3.inp (click to download from GitHub)
2 Codes#
1. OpenFDEM supports various common mesh file format such as .inp
files, .msh
files, and .geo
files. In this example,
“Job-3.inp” file in the folder will be imported to the model, which has the same mesh as the first unconfined compression
test example.
of.import "Job-3.inp"
Given input file was exported from ABAQUS without assigning groups, so users need to group elements manually here.
of.group.element 'up' range box.in [-35e-3 35e-3 50e-3 55e-3]
of.group.element 'rock' range box.in [-35e-3 35e-3 -50e-3 50e-3]
of.group.element 'down' range box.in [-35e-3 35e-3 -55e-3 -50e-3]
3 Full Script#
UCS_test_Gmsh.of (click to download from GitHub)
# initialization, this command is to clear the memory in your last run, it is not
# mandatory but strongly recommend.
of.new
# Set the path folder of your output results, //result// in the same path of your input
# file will be created by default
of.set.result "result"
# Set the interval of logging in the log file, 2000 is by default, not mandatory
of.log.interval 2000
# Set the number of cores you want to use, the parallization will be automatically turned
# on when you use the following command, otherwise the serilization will be used by
# default
of.set.omp 15
###################################### create mesh #######################################
# Openfdem supports import common mesh files such as .inp .msh .geo and others
of.import "Job-3.inp"
# Given input file was exported from ABAQUS without assigning groups, so users need to
# group elements manually here.
of.group.element 'up' range box.in [-35e-3 35e-3 50e-3 55e-3]
of.group.element 'rock' range box.in [-35e-3 35e-3 -50e-3 50e-3]
of.group.element 'down' range box.in [-35e-3 35e-3 -55e-3 -50e-3]
# Insert the cohesive elements.
of.mesh.insert 'rock'
################################# assign material parameters ##############################
# Assign material for matrix.
of.mat.element 'default' elastic den 2700 E 30e9 v 0.3 damp 2.0
# Assign rigid material to the two plattens
of.mat.element 'up' rigid den 2700
of.mat.element 'down' rigid den 2700
# assign material for CZM
of.mat.cohesive 'default' EM ten 1e6 coh 3e6 fric 0.3 GI 10 GII 50
# assign materials for contacts
of.mat.contact 'default' MC fric 0.3
##################################### create groups #######################################
# OpenFDEM can manually group the nodes, elements, cohesive elements and edges by using the
# region of box, circle and plane.
of.group.nodal.from.element 'up' 'up'
of.group.nodal.from.element 'down' 'down'
################################### assign boundaries #####################################
# boundaries can be assigned after you define the groups
of.boundary.nodal.velocity 'up' x 0.0 y -0.05 r 0.0
of.boundary.nodal.velocity 'down' x 0.0 y 0.05 r 0.0
####################################### set output ########################################
# Set the interval of writing ParaView results.
of.history.pv.interval 5000
# Output all results by default.
of.history.pv.field default
of.history.pv.fracture default
##################################### execute model #######################################
# Manually set the timestep to overwirte the default timestep suggested by the program.
# It is not recommended to manually increase the size of timesteps unless the user has
# enough understanding of the calculation process.
of.timestep fix 5e-9
# to excuate the model
of.step 500000
# finalize the model and clear the memory
of.finalize