default abaqus is used if version matches or is undefined

other changes do not alter behavior, just cleaning
This commit is contained in:
Martin Diehl 2020-01-14 09:15:38 +01:00
parent af42eae9c1
commit 9509f1bae1
2 changed files with 5 additions and 11 deletions

View File

@ -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.
@ -20,9 +20,6 @@ class Abaqus(Solver):
self.solver = 'Abaqus' self.solver = 'Abaqus'
try: try:
self.version = int(version) self.version = int(version)
except TypeError:
try:
self.version = int(damask.Environment().options['ABAQUS_VERSION'])
except TypeError: except TypeError:
self.version = -1 self.version = -1
@ -34,6 +31,6 @@ class Abaqus(Solver):
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())

View File

@ -22,9 +22,6 @@ class Marc(Solver):
self.solver = 'Marc' self.solver = 'Marc'
try: try:
self.version = int(version) self.version = int(version)
except TypeError:
try:
self.version = int(damask.Environment().options['MARC_VERSION'])
except TypeError: except TypeError:
self.version = -1 self.version = -1