Generators
Relevant module: edelweissfe.config.generators
Mesh generators are used to create meshes, using different methods.
Keyword: *generator
*modelGenerator, generator=theGeneratorType, name=myGeneratorName
multiple lines of defintion ...
multiple lines of defintion ...
multiple lines of defintion ...
boxgen
- A 3D box mesh generator
Relevant module edelweissfe.generators.boxgen
A mesh generator for cuboid geometries and structured hex meshes:
__ __ __ __
/__/__/__/__/| A back
/__/__/__/__/ | | top /
/__/__/__/__/ /| | lY | /
|__|__|__|__|//| | nY elements |/
y |__|__|__|__|//| | left----/----right
| |__|__|__|__|//| V /|
|___x |__|__|__|__|//| / / |
/ |__|__|__|__|// / lZ / bottom
z |__|__|__|__|/ / nZ elements front
<----lX----->
nX elements
nSets, elSets, surface : ‘name’_left, _right, _bottom, _top, _front, _back, _all, elSets : ‘name’_centralFrontToBack, _shearBandFrontToBack, _shearBandCenterFrontToBack are automatically generated
*job, name=job, domain=3d, solver=NIST
*modelGenerator, generator=boxGen, name=gen
nX =4
nY =8
nZ =2
lX =20
lY =40
lZ =1
elType =C3D20R
Option |
Description |
---|---|
x0 |
(optional) origin at x axis |
y0 |
(optional) origin at y axis |
z0 |
(optional) origin at z axis |
lX |
(optional) length of the body along x axis |
lY |
(optional) length of the body along y axis |
lZ |
(optional) length of the body along z axis |
nX |
(optional) number of elements along x |
nY |
(optional) number of elements along y |
nZ |
(optional) number of elements along z |
elType |
type of element |
testfiles/BoxGen/test.inp
*material, name=LinearElastic, id=myMaterial
**Isotropic
**E nu
1.8e4, 0.22
*job, name=job, domain=3d
*solver, solver=NISTParallel, name=theSolver
*modelGenerator, generator=boxGen, name=gen
nX =4
nY =8
nZ =2
lX =20
lY =40
lZ =1
elType =C3D20R
*output, type=meshdatatofile, name=meshdata
filename=myExportedMesh.inc
*modelGenerator, generator=findClosestNode, name=gen2
location='0, 0, 0'
storeIn=origin
*section, name=section1, material=myMaterial, type=solid
all
*fieldOutput
create=perNode, elSet=all, field=displacement, result=U, name=displacement
create=perElement, elSet=all, result=strain, name=strain, quadraturePoint=0:8, f(x)='np.mean(x,axis=1)'
create=perElement, elSet=all, result=stress, name=stress, quadraturePoint=0:8, f(x)='np.mean(x,axis=1)'
*output, type=ensight, name=test
create=perNode, fieldOutput=displacement
create=perElement, fieldOutput=stress
create=perElement, fieldOutput=strain
configuration, overwrite=yes
*output, type=monitor
*step, solver=theSolver, maxInc=1e0, minInc=1e0, maxNumInc=100, maxIter=25, stepLength=1
dirichlet, name=x0u, nSet=gen_left, field=displacement, 1=0.
dirichlet, name=y0u, nSet=gen_bottom, field=displacement, 2=0.
dirichlet, name=z0u, nSet=gen_back, field=displacement, 3=0.
dirichlet, name=y1u, nSet=gen_top, field=displacement, 2=-5.
planerectquad
- A 2D plane rectangular mesh generator
Relevant module edelweissfe.generators.planerectquad
A mesh generator, for rectangular geometries and structured quad meshes:
<-----l----->
nX elements
__ __ __ __
|__|__|__|__| A
|__|__|__|__| |
|__|__|__|__| | h
|__|__|__|__| | nY elements
| |__|__|__|__| |
| |__|__|__|__| V
x0|_____
y0
nSets, elSets, surface : ‘name’_top, _bottom, _left, _right, … are automatically generated
Datalines:
Option |
Description |
---|---|
x0 |
(optional) origin at x axis |
y0 |
(optional) origin at y axis |
h |
(optional) height of the body |
l |
(optional) length of the body |
nX |
(optional) number of elements along x |
nY |
(optional) number of elements along y |
elType |
type of element |
testfiles/NodeForces/test.inp
*material, name=VonMises, id=mat
210000, 0.3, 550, 1000, 200, 1400
*section, name=section1, thickness=1.0, material=mat, type=plane
all
*job, name=cps4job, domain=2d
*solver, solver=NIST, name=theSolver
*modelGenerator, generator=planeRectQuad, name=gen
x0=0, l=50
y0=0, h=100
elType=CPS4
nX=10
nY=10
*fieldOutput
create=perNode, nSet=gen_bottom, result=P, field=displacement, name=RF
create=perNode, elSet=all, field=displacement, result=U, name=displacement
*output, type=monitor
fieldOutput=RF, f(x)='mean(x[:,1])'
*output, type=ensight, name=esExport
create=perNode, fieldOutput=displacement
configuration, overwrite=yes
*step, maxInc=1e-1, minInc=1e-8, maxNumInc=50, maxIter=25, stepLength=100, solver=theSolver
dirichlet, name=bottom, nSet=gen_bottom, field=displacement, 2=0, 1=0
nodeforces, name=cloadTop, nSet=gen_top, field=displacement, 2=-50
*step, maxInc=1e-1, minInc=1e-8, maxNumInc=1000, maxIter=25, stepLength=100, solver=theSolver
nodeforces, name=cloadTop, nSet=gen_top, 2=-10, f(t)=sin(t*2*pi)
*step, maxInc=1e-1, minInc=1e-8, maxNumInc=1000, maxIter=25, stepLength=100, solver=theSolver
nodeforces, name=cloadTop, nSet=gen_top, 2=+50, f(t)=t
cubit
- A cubit mesh generator
Relevant module edelweissfe.generators.cubit
Interface to Cubit. Generate mesh using Cubit .jou files.
Option |
Description |
---|---|
cubitCmd |
(Optional) Cubit executable; default=cubit |
jouFile |
Path to Cubit journal (.jou) file |
outFile |
(Optional) path to output file; default=mesh.inc |
vars |
(Optional) APREPRO variables as string ‘…’ of comma-separated <key>=<value> pairs |
elType |
Specify element type for all sections |
elTypePerBlock |
Specify element type for each section as string ‘…’ of comma-separated <key>=<value> pairs |
overwrite |
(Optional) overwrite existing outFiles; default=False |
runCubit |
(Optional) run Cubit GUI for debugging purposes; default=False |
silent |
(Optional) hide Cubit output; default=False |
testfiles/CubitGen/test.inp
*material, name=LINEARELASTIC, id=mat1
35000, 0.2
*material, name=LINEARELASTIC, id=mat2
3000, 0.49
*modelGenerator, generator=cubit, name=gen
**cubitCmd = singularity exec <pathToImage>.smg coreform_cubit
cubitCmd = cubit
jouFile = journal.jou
APREPROVars = 'Lx=4, Ly=2, Lz=5'
elTypePerBlock = 'block1=C3D8, block2=C3D8'
silent
** runCubit = True
** overwrite = False
*section, name=section1, material=mat1, type=solid
block1
*section, name=section2, material=mat2, type=solid
block2
*job, name=set_def, domain=3d
*solver, solver=NISTParallel, name=theSolver
*fieldOutput
create=perNode, elSet=all, name=displacement, field=displacement, result=U
create=perElement, elSet=all, name=stress, result=stress, quadraturePoint=0:8, f(x)='np.mean(x,axis=1)'
create=perElement, elSet=all, name=strain, result=strain, quadraturePoint=0:8, f(x)='np.mean(x,axis=1)'
*output, type=ensight, name=esExport
create=perNode, fieldOutput=displacement
create=perElement, fieldOutput=stress
create=perElement, fieldOutput=strain
configuration, overwrite=yes
*step, solver=theSolver, maxInc=5e-1, minInc=1e-8, maxNumInc=1000, maxIter=25, stepLength=1
dirichlet, name=bot, nSet=n_bot, field=displacement, 1=0., 2=0., 3=0.
dirichlet, name=top, nSet=n_top, field=displacement, 1=0., 2=-1., 3=0.
findclosestnode
- Find the closest node
Relevant module edelweissfe.generators.findclosestnode
Find the node closest to a given spatial position, and store it in an existing or new node set.
Option |
Description |
---|---|
location |
The location of the node |
storeIn |
Store in this node set |
executepythoncode
- Script model generation using Python
Relevant module edelweissfe.generators.executepythoncode
Directly execute Python code to create the model tree.
Option |
Description |
---|
testfiles/PythonCodeModelGeneration/test.inp
*modelGenerator, generator=planeRectQuad, name=gen
elType=CPS8R
nX=20
nY=20
l=100
h=100
*modelGenerator, generator=executePythonCode, name=gen-2, executeAfterManualGeneration=True
** we find all nodes at 50% of the height
from edelweissfe.sets.nodeset import NodeSet
model.nodeSets['center_horizontal'] = NodeSet('center_horizontal', [n for n in model.nodes.values()
if abs( n.coordinates[1] - 50.0 ) <= 1e-12 ])
*material, name=linearelastic, id=linearelastic
30000.0, 0.15
*section, name=section1, thickness=1.0, material=linearelastic, type=plane
all
*job, name=myJob, domain=2d
*solver, solver=NIST, name=theSolver
*fieldOutput
create=perNode, name=displacement, elSet=all, field=displacement, result=U,
create=perNode, name=RF, nSet=gen_bottom, field=displacement, result=P,
create=perElement, name=stress, elSet=all, result=stress, quadraturePoint=0:4, f(x)='mean(x, axis=1)'
create=perElement, name=strain, elSet=all, result=strain, quadraturePoint=0:4, f(x)='mean(x, axis=1)'
*output, type=monitor, name=theMonitor
fieldOutput = RF, f(x) = 'sum ( x, axis=0 )'
*output, type=ensight, name=ensightExport
create=perNode, fieldOutput=displacement
create=perElement, fieldOutput=stress
create=perElement, fieldOutput=strain
configuration, overwrite=yes
*step, solver=theSolver, maxInc=1e-1, minInc=1e-5, maxNumInc=1000, maxIter=25, stepLength=1
options, category=NISTSolver, extrapolation=linear
dirichlet, name=bottom, nSet=gen_bottom, field=displacement, 1=0.0, 2=0.0
dirichlet, name=load, nSet=center_horizontal, field=displacement, 1=5.0, 2=5.0