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
|
||||
|
||||
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',
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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 __init__(self,version=float(damask.Environment().options['MARC_VERSION'])):
|
||||
"""
|
||||
Create a Marc solver object.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
version : float
|
||||
Marc version
|
||||
|
||||
"""
|
||||
self.solver ='Marc'
|
||||
self.version = float(damask.environment.Environment().options['MARC_VERSION'])
|
||||
|
||||
|
||||
#--------------------------
|
||||
def version(self):
|
||||
import damask.environment
|
||||
def libraryPath(self):
|
||||
|
||||
return damask.environment.Environment().options['MARC_VERSION']
|
||||
path_MSC = damask.environment.Environment().options['MSC_ROOT']
|
||||
path_lib = '{}/mentat{}/shlib/linux64'.format(path_MSC,self.version)
|
||||
|
||||
return path_lib if os.path.exists(path_lib) else ''
|
||||
|
||||
|
||||
#--------------------------
|
||||
def libraryPath(self,release = ''):
|
||||
import os,damask.environment
|
||||
def toolsPath(self):
|
||||
|
||||
MSCpath = damask.environment.Environment().options['MSC_ROOT']
|
||||
if len(release) == 0: release = self.version()
|
||||
path_MSC = damask.environment.Environment().options['MSC_ROOT']
|
||||
path_tools = '{}/marc{}/tools'.format(path_MSC,self.version)
|
||||
|
||||
path = '{}/mentat{}/shlib/linux64'.format(MSCpath,release)
|
||||
|
||||
return path if os.path.exists(path) else ''
|
||||
|
||||
|
||||
#--------------------------
|
||||
def toolsPath(self,release = ''):
|
||||
import os,damask.environment
|
||||
|
||||
MSCpath = damask.environment.Environment().options['MSC_ROOT']
|
||||
if len(release) == 0: release = self.version()
|
||||
|
||||
path = '%s/marc%s/tools'%(MSCpath,release)
|
||||
|
||||
return path if os.path.exists(path) else ''
|
||||
return path_tools if os.path.exists(path_tools) 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'
|
||||
|
||||
|
|
Loading…
Reference in New Issue