improved abaqus test structure

This commit is contained in:
Martin Diehl 2014-06-24 15:32:42 +00:00
parent 18b1245874
commit 930cd0f3ac
2 changed files with 45 additions and 0 deletions

View File

@ -5,3 +5,4 @@
from .solver import Solver # only one class
from .spectral import Spectral # only one class
from .marc import Marc # only one class
from .abaqus import Abaqus # only one class

View File

@ -0,0 +1,44 @@
# -*- coding: UTF-8 no BOM -*-
# $Id$
from .solver import Solver
class Abaqus(Solver):
def __init__(self,version='',method=''):
self.solver='Abaqus'
if version =='':
self.version = version
cmd = "abaqus information=release"
import subprocess
process = subprocess.Popen(cmd,stdout = subprocess.PIPE,stderr = subprocess.PIPE,shell=True)
self.version = process.stdout.readlines()[1].split()[1]
else:
self.version = version
if method.lower() in ['','std','standard']:
self.method = 'std'
elif method.lower() in ['exp','explicit']:
self.method = 'exp'
else:
self.method = 'chose either std or exp'
def return_run_command(self,model):
import subprocess
import re
import damask
env=damask.Environment()
shortVersion = re.sub('[\.,-]', '',self.version)
try:
subprocess.Popen(['abq'+shortVersion,'information=release'])
cmd='abq'+shortVersion
except subprocess.CalledProcessError:
process = subprocess.Popen(cmd,stdout = subprocess.PIPE,stderr = subprocess.PIPE,shell=True)
cmd='abaqus'
if self.version != process.stdout.readlines()[1].split()[1]: raise Exception
return '%s -job %s -user %s/code/DAMASK_abaqus_%s interactive'%(cmd,model,env.rootDir(),self.method)