included definitions of "material" and "geometry" properties after mesh generation...

This commit is contained in:
Philip Eisenlohr 2010-10-26 13:45:23 +00:00
parent 62d06001ea
commit 5be6604fd6
1 changed files with 59 additions and 20 deletions

View File

@ -9,22 +9,7 @@ releases = {'2010':['linux64',''],
'2005r3':[''],
}
file = open('%s/../MSCpath'%os.path.dirname(sys.argv[0]))
MSCpath = os.path.normpath(file.readline().strip())
file.close()
for release,subdirs in sorted(releases.items(),reverse=True):
for subdir in subdirs:
libPath = '%s/mentat%s/shlib/%s'%(MSCpath,release,subdir)
if os.path.exists(libPath):
sys.path.append(libPath)
break
else:
continue
break
from py_mentat import *
# ----------------------- FUNCTIONS ----------------------------
def outMentat(cmd,locals):
if cmd[0:3] == '(!)':
@ -55,7 +40,7 @@ def output(cmds,locals,dest):
{\
'Mentat': outMentat,\
'Stdout': outStdout,\
}[dest](cmd,locals)
}[dest](str(cmd),locals)
return
@ -86,7 +71,7 @@ def mesh(N,d):
"%f %f %f"%(-d[0],d[1],d[2]),
"%f %f %f"%(-d[0],d[1],0.0),
"*add_elements",
"1 2 3 4 5 6 7 8",
range(1,9),
"*sub_divisions",
"%i %i %i"%(N[2],N[1],N[0]),
"*subdivide_elements",
@ -104,6 +89,34 @@ def mesh(N,d):
]
def material():
cmds = [\
"*new_mater standard",
"*mater_option general:state:solid",
"*mater_option structural:type:hypo_ealst",
"*mater_name",
"hypela2",
"*add_mater_elements",
"all_existing",
"*geometry_type mech_three_solid",
"*geometry_option red_integ_capacity:on",
"*add_geometry_elements",
"all_existing",
]
return cmds
def geometry():
cmds = [\
"*geometry_type mech_three_solid",
"*geometry_option red_integ_capacity:on",
"*add_geometry_elements",
"all_existing",
]
return cmds
def initial_conditions(N,data):
elements = []
@ -135,14 +148,14 @@ def initial_conditions(N,data):
"*icond_param_value state_var_id 3",
"*icond_dof_value var %i"%(grain+1),
"*add_icond_elements",
map(str,elementList),
elementList,
"#",
])
return cmds
# ----------------------- MAIN -------------------------------
parser = OptionParser()
parser.add_option("-p", "--port", type="int",\
dest="port",\
@ -157,6 +170,29 @@ parser.add_option("-N", "--subdivisions", type="int", nargs=3,\
parser.set_defaults(d = (16,16,16))
parser.set_defaults(N = (16,16,16))
try:
file = open('%s/../MSCpath'%os.path.dirname(sys.argv[0]))
MSCpath = os.path.normpath(file.readline().strip())
file.close()
except:
MSCpath = '/msc'
for release,subdirs in sorted(releases.items(),reverse=True):
for subdir in subdirs:
libPath = '%s/mentat%s/shlib/%s'%(MSCpath,release,subdir)
if os.path.exists(libPath):
sys.path.append(libPath)
break
else:
continue
break
try:
from py_mentat import *
except:
print('error: no valid Mentat release found in %s'%MSCpath)
sys.exit(-1)
(options, args) = parser.parse_args()
if not os.path.isfile(args[0]):
@ -169,6 +205,8 @@ file.close()
cmds = [\
init(),
mesh(options.N,options.d),
material(),
geometry(),
initial_conditions(options.N,content),
]
@ -179,3 +217,4 @@ if (options.port != None):
py_disconnect()
else:
output(cmds,outputLocals,'Stdout')