update for solver wrappers
This commit is contained in:
parent
fea16327ac
commit
a073f36471
2
PRIVATE
2
PRIVATE
|
@ -1 +1 @@
|
||||||
Subproject commit 18a976753be06aca6e15f580998e713daa08bb41
|
Subproject commit 18f48307ad5dd27702bc1443e3faf2bf652edccf
|
|
@ -3,14 +3,7 @@ import math
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
class Color():
|
class Color():
|
||||||
"""
|
"""Color representation in and conversion between different color-spaces."""
|
||||||
Color representation in and conversion between different color-spaces.
|
|
||||||
|
|
||||||
Public Methods
|
|
||||||
--------------
|
|
||||||
convertTo
|
|
||||||
expressAs
|
|
||||||
"""
|
|
||||||
|
|
||||||
__slots__ = [
|
__slots__ = [
|
||||||
'model',
|
'model',
|
||||||
|
|
|
@ -1,17 +1,24 @@
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
import subprocess
|
||||||
|
|
||||||
from .solver import Solver
|
from .solver import Solver
|
||||||
import damask
|
import damask
|
||||||
import subprocess
|
|
||||||
|
|
||||||
class Abaqus(Solver):
|
class Abaqus(Solver):
|
||||||
|
"""Wrapper to run DAMASK with Abaqus."""
|
||||||
|
|
||||||
def __init__(self,version=''): # example version string: 2017
|
def __init__(self,version=int(damask.Environment().options['ABAQUS_VERSION'])):
|
||||||
self.solver='Abaqus'
|
"""
|
||||||
if version =='':
|
Create a Abaqus solver object.
|
||||||
version = damask.Environment().options['ABAQUS_VERSION']
|
|
||||||
else:
|
Parameters
|
||||||
self.version = version
|
----------
|
||||||
|
version : integer
|
||||||
|
Abaqus version
|
||||||
|
|
||||||
|
"""
|
||||||
|
self.solver ='Abaqus'
|
||||||
|
self.version = int(version)
|
||||||
|
|
||||||
def return_run_command(self,model):
|
def return_run_command(self,model):
|
||||||
env=damask.Environment()
|
env=damask.Environment()
|
||||||
|
@ -21,7 +28,7 @@ class Abaqus(Solver):
|
||||||
except OSError: # link to abqXXX not existing
|
except OSError: # link to abqXXX not existing
|
||||||
cmd='abaqus'
|
cmd='abaqus'
|
||||||
process = subprocess.Popen(['abaqus','information=release'],stdout = subprocess.PIPE,stderr = subprocess.PIPE)
|
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:
|
if self.version != detectedVersion:
|
||||||
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,env.rootDir())
|
return '{} -job {} -user {}/src/DAMASK_abaqus interactive'.format(cmd,model,env.rootDir())
|
||||||
|
|
|
@ -1,49 +1,47 @@
|
||||||
# -*- coding: UTF-8 no BOM -*-
|
import os
|
||||||
|
import subprocess
|
||||||
|
import shlex
|
||||||
|
|
||||||
from .solver import Solver
|
from .solver import Solver
|
||||||
|
import damask
|
||||||
|
|
||||||
class Marc(Solver):
|
class Marc(Solver):
|
||||||
|
"""Wrapper to run DAMASK with MSCMarc."""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self,version=float(damask.Environment().options['MARC_VERSION'])):
|
||||||
self.solver = 'Marc'
|
"""
|
||||||
|
Create a Marc solver object.
|
||||||
|
|
||||||
#--------------------------
|
|
||||||
def version(self):
|
|
||||||
import damask.environment
|
|
||||||
|
|
||||||
return damask.environment.Environment().options['MARC_VERSION']
|
|
||||||
|
|
||||||
|
|
||||||
#--------------------------
|
Parameters
|
||||||
def libraryPath(self,release = ''):
|
----------
|
||||||
import os,damask.environment
|
version : float
|
||||||
|
Marc version
|
||||||
|
|
||||||
MSCpath = damask.environment.Environment().options['MSC_ROOT']
|
"""
|
||||||
if len(release) == 0: release = self.version()
|
self.solver ='Marc'
|
||||||
|
self.version = float(damask.environment.Environment().options['MARC_VERSION'])
|
||||||
path = '{}/mentat{}/shlib/linux64'.format(MSCpath,release)
|
|
||||||
|
|
||||||
return path if os.path.exists(path) else ''
|
|
||||||
|
|
||||||
|
|
||||||
#--------------------------
|
#--------------------------
|
||||||
def toolsPath(self,release = ''):
|
def libraryPath(self):
|
||||||
import os,damask.environment
|
|
||||||
|
|
||||||
MSCpath = damask.environment.Environment().options['MSC_ROOT']
|
path_MSC = damask.environment.Environment().options['MSC_ROOT']
|
||||||
if len(release) == 0: release = self.version()
|
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,
|
def submit_job(self,
|
||||||
release = '',
|
|
||||||
model = 'model',
|
model = 'model',
|
||||||
job = 'job1',
|
job = 'job1',
|
||||||
logfile = None,
|
logfile = None,
|
||||||
|
@ -51,25 +49,22 @@ class Marc(Solver):
|
||||||
optimization ='',
|
optimization ='',
|
||||||
):
|
):
|
||||||
|
|
||||||
import os,damask.environment
|
|
||||||
import subprocess,shlex
|
|
||||||
|
|
||||||
if len(release) == 0: release = self.version()
|
|
||||||
damaskEnv = damask.environment.Environment()
|
damaskEnv = damask.environment.Environment()
|
||||||
|
|
||||||
user = 'not found'
|
user = 'not found'
|
||||||
|
|
||||||
if compile:
|
if compile:
|
||||||
if os.path.isfile(os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc{}.f90'.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(release))
|
user = os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc{}'.format(self.version))
|
||||||
else:
|
else:
|
||||||
if os.path.isfile(os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc{}.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(release))
|
user = os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc{}'.format(self.version))
|
||||||
|
|
||||||
# Define options [see Marc Installation and Operation Guide, pp 23]
|
# Define options [see Marc Installation and Operation Guide, pp 23]
|
||||||
script = 'run_damask_{}mp'.format(optimization)
|
script = 'run_damask_{}mp'.format(optimization)
|
||||||
|
|
||||||
cmd = os.path.join(self.toolsPath(release),script) + \
|
cmd = os.path.join(self.toolsPath(),script) + \
|
||||||
' -jid ' + model + '_' + job + \
|
' -jid ' + model + '_' + job + \
|
||||||
' -nprocd 1 -autorst 0 -ci n -cr n -dcoup 0 -b no -v no'
|
' -nprocd 1 -autorst 0 -ci n -cr n -dcoup 0 -b no -v no'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue