diff --git a/PRIVATE b/PRIVATE index 18a976753..18f48307a 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 18a976753be06aca6e15f580998e713daa08bb41 +Subproject commit 18f48307ad5dd27702bc1443e3faf2bf652edccf diff --git a/python/damask/colormaps.py b/python/damask/colormaps.py index 832171cd3..b38d47070 100644 --- a/python/damask/colormaps.py +++ b/python/damask/colormaps.py @@ -3,14 +3,7 @@ import math import numpy as np class Color(): - """ - Color representation in and conversion between different color-spaces. - - Public Methods - -------------- - convertTo - expressAs - """ + """Color representation in and conversion between different color-spaces.""" __slots__ = [ 'model', diff --git a/python/damask/solver/abaqus.py b/python/damask/solver/abaqus.py index 22dbab045..693ec1360 100644 --- a/python/damask/solver/abaqus.py +++ b/python/damask/solver/abaqus.py @@ -1,17 +1,24 @@ -# -*- coding: UTF-8 no BOM -*- +import subprocess from .solver import Solver import damask -import subprocess + class Abaqus(Solver): + """Wrapper to run DAMASK with Abaqus.""" - def __init__(self,version=''): # example version string: 2017 - self.solver='Abaqus' - if version =='': - version = damask.Environment().options['ABAQUS_VERSION'] - else: - self.version = version + def __init__(self,version=int(damask.Environment().options['ABAQUS_VERSION'])): + """ + Create a Abaqus solver object. + + Parameters + ---------- + version : integer + Abaqus version + + """ + self.solver ='Abaqus' + self.version = int(version) def return_run_command(self,model): env=damask.Environment() @@ -21,7 +28,7 @@ class Abaqus(Solver): except OSError: # link to abqXXX not existing cmd='abaqus' process = subprocess.Popen(['abaqus','information=release'],stdout = subprocess.PIPE,stderr = subprocess.PIPE) - detectedVersion = process.stdout.readlines()[1].split()[1].decode('utf-8') + detectedVersion = int(process.stdout.readlines()[1].split()[1].decode('utf-8')) if self.version != detectedVersion: raise Exception('found Abaqus version {}, but requested {}'.format(detectedVersion,self.version)) return '{} -job {} -user {}/src/DAMASK_abaqus interactive'.format(cmd,model,env.rootDir()) diff --git a/python/damask/solver/marc.py b/python/damask/solver/marc.py index 9f63ab205..ca4ed3461 100644 --- a/python/damask/solver/marc.py +++ b/python/damask/solver/marc.py @@ -1,49 +1,47 @@ -# -*- coding: UTF-8 no BOM -*- - +import os +import subprocess +import shlex from .solver import Solver - +import damask class Marc(Solver): + """Wrapper to run DAMASK with MSCMarc.""" - def __init__(self): - self.solver = 'Marc' - - -#-------------------------- - def version(self): - import damask.environment - - return damask.environment.Environment().options['MARC_VERSION'] - + def __init__(self,version=float(damask.Environment().options['MARC_VERSION'])): + """ + Create a Marc solver object. -#-------------------------- - def libraryPath(self,release = ''): - import os,damask.environment + Parameters + ---------- + version : float + Marc version - MSCpath = damask.environment.Environment().options['MSC_ROOT'] - if len(release) == 0: release = self.version() - - path = '{}/mentat{}/shlib/linux64'.format(MSCpath,release) - - return path if os.path.exists(path) else '' + """ + self.solver ='Marc' + self.version = float(damask.environment.Environment().options['MARC_VERSION']) #-------------------------- - def toolsPath(self,release = ''): - import os,damask.environment + def libraryPath(self): - MSCpath = damask.environment.Environment().options['MSC_ROOT'] - if len(release) == 0: release = self.version() + path_MSC = damask.environment.Environment().options['MSC_ROOT'] + path_lib = '{}/mentat{}/shlib/linux64'.format(path_MSC,self.version) - path = '%s/marc%s/tools'%(MSCpath,release) + return path_lib if os.path.exists(path_lib) else '' + + +#-------------------------- + def toolsPath(self): + + path_MSC = damask.environment.Environment().options['MSC_ROOT'] + path_tools = '{}/marc{}/tools'.format(path_MSC,self.version) + + return path_tools if os.path.exists(path_tools) else '' - return path if os.path.exists(path) else '' - #-------------------------- def submit_job(self, - release = '', model = 'model', job = 'job1', logfile = None, @@ -51,25 +49,22 @@ class Marc(Solver): optimization ='', ): - import os,damask.environment - import subprocess,shlex - - if len(release) == 0: release = self.version() + damaskEnv = damask.environment.Environment() user = 'not found' if compile: - if os.path.isfile(os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc{}.f90'.format(release))): - user = os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc{}'.format(release)) + if os.path.isfile(os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc{}.f90'.format(self.version))): + user = os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc{}'.format(self.version)) else: - if os.path.isfile(os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc{}.marc'.format(release))): - user = os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc{}'.format(release)) + if os.path.isfile(os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc{}.marc'.format(self.version))): + user = os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc{}'.format(self.version)) # Define options [see Marc Installation and Operation Guide, pp 23] script = 'run_damask_{}mp'.format(optimization) - cmd = os.path.join(self.toolsPath(release),script) + \ + cmd = os.path.join(self.toolsPath(),script) + \ ' -jid ' + model + '_' + job + \ ' -nprocd 1 -autorst 0 -ci n -cr n -dcoup 0 -b no -v no'