示例#1
0
# engngModel
problem = liboofem.linearStatic(nSteps=3, outFile="test2.out")

# domain (if no engngModel specified to domain, it is asigned to the last one created)
domain = liboofem.domain(1,
                         1,
                         problem,
                         liboofem.domainType._2dBeamMode,
                         tstep_all=True,
                         dofman_all=True,
                         element_all=True)
problem.setDomain(1, domain)
vtkxmlModule = liboofem.vtkxml(1,
                               problem,
                               tstep_all=True,
                               vars=[1, 4],
                               primvars=[1])

# time functions (time functions parameter f(t) has to be written as f_t - due to the parenthesis, otherwise all kw keys match oofem input file ones)
# if no domain specified, ltf is asigned to the last one created (valid for all FEMComponents classes)
# if no number is specified, domain.umberOfLoadTimeFunctions+1 is used (valid for all FEMComponents classes, e.g. domain.numberOfElements+1 is used for elements instead ot numberOfLoadTimeFunctions)
ltf1 = liboofem.peakFunction(1, domain, t=1, f_t=1)
ltf2 = liboofem.peakFunction(2, domain, t=2, f_t=1)
ltf3 = liboofem.peakFunction(3, domain, t=3, f_t=1)
ltfs = (ltf1, ltf2, ltf3)

# boundary conditions
# loadTimeFunction parameter can be specified as int value or as LoadTimeFunction itself (valid for all objects with giveNumber() method)
bc1 = liboofem.boundaryCondition(1,
                                 domain,
示例#2
0
                              outFile="/tmp/multi1_oofem.out")

# domain
domain = liboofem.domain(1,
                         1,
                         problem,
                         liboofem.domainType._3dMode,
                         tstep_step=10000,
                         dofman_all=True,
                         element_all=True)
problem.setDomain(1, domain, True)

# vtkxml
vtkxmlModule = liboofem.vtkxml(1,
                               problem,
                               tstep_step=10000,
                               vars=[1, 4],
                               primvars=[1],
                               cellvars=[47])
exportModuleManager = problem.giveExportModuleManager()
exportModuleManager.resizeModules(1)
exportModuleManager.setModule(1, vtkxmlModule)

# boundary condition and time function
ltf = liboofem.loadTimeFunction("pieceWiseLinFunction",
                                1,
                                nSteps=2,
                                t=(0, 2e-1),
                                f_t=(0, 1))
bcs = [
    liboofem.boundaryCondition(i + 1,
                               domain,
示例#3
0
文件: test2.py 项目: Micket/oofem
############################################################
#
# Beam structure example from OOFEM documentation
# built from python
#
############################################################
import liboofem

# engngModel
problem = liboofem.linearStatic(nSteps=3, outFile="test2.out")

# domain (if no engngModel specified to domain, it is asigned to the last one created)
domain = liboofem.domain(1, 1, problem, liboofem.domainType._2dBeamMode, tstep_all=True, dofman_all=True, element_all=True)
problem.setDomain(1, domain, True)
vtkxmlModule = liboofem.vtkxml(1,problem,tstep_all=True,vars=[1,4],primvars=[1])


# time functions (time functions parameter f(t) has to be written as f_t - due to the parenthesis, otherwise all kw keys match oofem input file ones)
# if no domain specified, ltf is asigned to the last one created (valid for all FEMComponents classes)
# if no number is specified, domain.umberOfLoadTimeFunctions+1 is used (valid for all FEMComponents classes, e.g. domain.numberOfElements+1 is used for elements instead ot numberOfLoadTimeFunctions)
ltf1 = liboofem.peakFunction(1, domain, t=1, f_t=1)
ltf2 = liboofem.peakFunction(2, domain, t=2, f_t=1)
ltf3 = liboofem.peakFunction(3, domain, t=3, f_t=1)
ltfs = (ltf1, ltf2, ltf3)

# boundary conditions
# loadTimeFunction parameter can be specified as int value or as LoadTimeFunction itself (valid for all objects with giveNumber() method)
bc1   = liboofem.boundaryCondition(    1, domain, loadTimeFunction=1,    prescribedValue=0.0)
bc2   = liboofem.boundaryCondition(    2, domain, loadTimeFunction=2,    prescribedValue=-.006e-3)
eLoad = liboofem.constantEdgeLoad(     3, domain, loadTimeFunction=1, components=(0.,10.,0.), loadType=3, ndofs=3)
nLoad = liboofem.nodalLoad(            4, domain, loadTimeFunction=1,    components=(-18.,24.,0.))