Model
FEModel
Bases: _FEMeshMixin, _FEAssignMixin, _FELoadsMixin, _FEGeometryMixin
Finite-element model builder backed by GMSH and exported to Midas MGT.
FEModel wraps a GMSH session and adds a structural-analysis layer on
top: materials, cross-section shapes, load cases, distributed and
concentrated loads, nodal springs, Winkler supports, temperature loads,
and physical-group management. After the model is assembled it can be
exported to the Midas GEN .mgt text format via :meth:save.
Typical workflow::
model = FEModel(descr="My bridge", modelName="bridge")
model.addMaterialToLibrary(1, modulus=210000.0, poisson=0.3, name="Steel")
model.addSectionShape(1, name="HEB300", tp=ShapesEnum.SHAPE_RECT, dim=[0.3, 0.3])
n1 = model.addNode(...)
f1 = model.addFrame(...)
model.addLoadCase("LC1", tp="D", descr="Dead load")
model.addFrameLoad("LC1", tagFrame=f1, tp="force", GCZ1=[0.0, -10.0])
model.save("bridge.mgt")
Note
Only one GMSH model can be active at a time within a process.
Use :meth:addModel / :meth:setCurrentModel to switch contexts.
__init__(descr='', modelName='default')
Initialize the FEM model and the underlying GMSH session.
Starts the GMSH library, creates an OCC (OpenCASCADE) geometry kernel, and registers the first model. Internal dictionaries for load cases, loads, combinations, supports, springs, materials, and section shapes are all created empty (or with a default rect section assigned as id=1).
Note
Default local axes for beam elements (Strand7 convention): If the beam is parallel to the global Z axis the 2-direction is always in the positive global Y direction. Otherwise the 2-direction is given by the cross product of the global Z axis and the N1→N2 vector; the 3-direction runs from N1 to N2, and the 1-direction completes the right-hand system.
Default local axes for plate elements (Strand7 convention): For a quadrilateral the positive local x joins the mid-sides of (N1,N4) and (N2,N3); for a triangle it goes from N1 to the midpoint of (N2,N3). Positive local y is perpendicular to local x, directed away from side (N1,N2), lying in the plate plane. Positive local z is normal to the plate surface completing the right-hand system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
descr
|
str
|
Human-readable description of the model. |
''
|
modelName
|
str
|
Name used to identify the GMSH model; also stored as the first entry in the internal models list. |
'default'
|
addModel(name)
Add a new GMSH model and register it in the session.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Non-empty unique name for the new model. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|
bool
|
is empty or already registered. |
getCad()
Return the underlying OpenCASCADE (OCC) geometry kernel instance.
Returns:
| Type | Description |
|---|---|
|
The |
getModeler()
staticmethod
Main object that shapes geometry and mesh
Returns:
| Type | Description |
|---|---|
|
A gmsh modeler |
getModels()
Return the list of GMSH model names registered in this session.
Returns:
| Type | Description |
|---|---|
List[str]
|
A list of model name strings in the order they were added, |
List[str]
|
starting with the name passed to |
save(fileName, fileType='.msh')
Save the model to file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fileName
|
str
|
Output file path without extension. |
required |
fileType
|
str
|
File format extension. Supported values:
|
'.msh'
|
Note
All mesh elements are saved regardless of physical group membership
(Mesh.SaveAll is set to 1 before writing).
setCurrentModel(name)
Switch the active GMSH model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of a previously registered model. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|
bool
|
if name is not registered. |