default abaqus is used if version matches or is undefined
other changes do not alter behavior, just cleaning
This commit is contained in:
parent
af42eae9c1
commit
9509f1bae1
|
@ -7,7 +7,7 @@ import damask
|
||||||
class Abaqus(Solver):
|
class Abaqus(Solver):
|
||||||
"""Wrapper to run DAMASK with Abaqus."""
|
"""Wrapper to run DAMASK with Abaqus."""
|
||||||
|
|
||||||
def __init__(self,version=None):
|
def __init__(self,version=damask.Environment().options['ABAQUS_VERSION']):
|
||||||
"""
|
"""
|
||||||
Create a Abaqus solver object.
|
Create a Abaqus solver object.
|
||||||
|
|
||||||
|
@ -21,19 +21,16 @@ class Abaqus(Solver):
|
||||||
try:
|
try:
|
||||||
self.version = int(version)
|
self.version = int(version)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
try:
|
self.version = -1
|
||||||
self.version = int(damask.Environment().options['ABAQUS_VERSION'])
|
|
||||||
except TypeError:
|
|
||||||
self.version = -1
|
|
||||||
|
|
||||||
def return_run_command(self,model):
|
def return_run_command(self,model):
|
||||||
try:
|
try:
|
||||||
cmd = 'abq{}'.format(self.version)
|
cmd = 'abq{}'.format(self.version)
|
||||||
subprocess.check_output([cmd,'information=release'])
|
subprocess.check_output([cmd,'information=release'])
|
||||||
except OSError: # link to abqXXX not existing
|
except OSError: # link to abqXXX not existing
|
||||||
cmd = 'abaqus'
|
cmd = 'abaqus'
|
||||||
process = subprocess.Popen([cmd,'information=release'],stdout = subprocess.PIPE,stderr = subprocess.PIPE)
|
process = subprocess.Popen([cmd,'information=release'],stdout = subprocess.PIPE,stderr = subprocess.PIPE)
|
||||||
detectedVersion = int(process.stdout.readlines()[1].split()[1].decode('utf-8'))
|
detectedVersion = int(process.stdout.readlines()[1].split()[1].decode('utf-8'))
|
||||||
if self.version != detectedVersion:
|
if self.version not in [detectedVersion,-1]:
|
||||||
raise Exception('found Abaqus version {}, but requested {}'.format(detectedVersion,self.version))
|
raise Exception('found Abaqus version {}, but requested {}'.format(detectedVersion,self.version))
|
||||||
return '{} -job {} -user {}/src/DAMASK_abaqus interactive'.format(cmd,model,damask.Environment().rootDir())
|
return '{} -job {} -user {}/src/DAMASK_abaqus interactive'.format(cmd,model,damask.Environment().rootDir())
|
||||||
|
|
|
@ -23,10 +23,7 @@ class Marc(Solver):
|
||||||
try:
|
try:
|
||||||
self.version = int(version)
|
self.version = int(version)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
try:
|
self.version = -1
|
||||||
self.version = int(damask.Environment().options['MARC_VERSION'])
|
|
||||||
except TypeError:
|
|
||||||
self.version = -1
|
|
||||||
|
|
||||||
|
|
||||||
#--------------------------
|
#--------------------------
|
||||||
|
|
Loading…
Reference in New Issue