2014-06-24 21:02:42 +05:30
|
|
|
# -*- coding: UTF-8 no BOM -*-
|
|
|
|
|
|
|
|
from .solver import Solver
|
2016-07-15 20:23:57 +05:30
|
|
|
import damask
|
2014-06-24 21:02:42 +05:30
|
|
|
|
|
|
|
class Abaqus(Solver):
|
|
|
|
|
2016-03-02 03:32:47 +05:30
|
|
|
def __init__(self,version='',solver=''): # example version string: 6.12-2, solver: std or exp
|
2014-06-24 21:02:42 +05:30
|
|
|
self.solver='Abaqus'
|
|
|
|
if version =='':
|
2016-07-14 19:42:05 +05:30
|
|
|
version = damask.Environment().options['ABAQUS_VERSION']
|
2014-06-24 21:02:42 +05:30
|
|
|
else:
|
|
|
|
self.version = version
|
|
|
|
|
2014-06-25 14:02:33 +05:30
|
|
|
if solver.lower() in ['','std','standard']:
|
|
|
|
self.solver = 'std'
|
|
|
|
elif solver.lower() in ['exp','explicit']:
|
|
|
|
self.solver = 'exp'
|
2014-06-24 21:02:42 +05:30
|
|
|
else:
|
2014-06-25 14:02:33 +05:30
|
|
|
raise Exception('unknown Abaqus solver %'%solver)
|
2014-06-24 21:02:42 +05:30
|
|
|
|
|
|
|
def return_run_command(self,model):
|
|
|
|
import subprocess
|
|
|
|
import re
|
|
|
|
env=damask.Environment()
|
|
|
|
shortVersion = re.sub('[\.,-]', '',self.version)
|
|
|
|
try:
|
|
|
|
cmd='abq'+shortVersion
|
2014-06-25 14:02:33 +05:30
|
|
|
subprocess.check_output(['abq'+shortVersion,'information=release'])
|
|
|
|
except OSError: # link to abqXXX not existing
|
2014-06-24 21:02:42 +05:30
|
|
|
cmd='abaqus'
|
2014-06-25 14:02:33 +05:30
|
|
|
process = subprocess.Popen(['abaqus','information=release'],stdout = subprocess.PIPE,stderr = subprocess.PIPE)
|
|
|
|
detectedVersion = process.stdout.readlines()[1].split()[1]
|
|
|
|
if self.version != detectedVersion:
|
|
|
|
raise Exception('found Abaqus version %s, but requested %s'%(detectedVersion,self.version))
|
|
|
|
return '%s -job %s -user %s/code/DAMASK_abaqus_%s interactive'%(cmd,model,env.rootDir(),self.solver)
|