marc doesn't need error prone setup_code any more, moved Marc includes from code/include to lib/includeMarc

DAMASK_marcXXXX.f90 now is not a copy any more but contains one definition and an include statement

setup_code of spectral solver is now replaced by the standard 1) configure 2) make 3) make install
This commit is contained in:
Martin Diehl 2013-04-22 14:41:33 +00:00
parent a7706090d2
commit 8da7544978
17 changed files with 46 additions and 121 deletions

View File

@ -44,6 +44,8 @@
!> @details - concom: lovl, inc
!> @details - creeps: timinc
!--------------------------------------------------------------------------------------------------
#define QUOTE(x) #x
#define PASTE(x,y) x ## y
#ifndef INT
#define INT 4
@ -266,8 +268,9 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, &
!--------------------------------------------------------------------------------------------------
! Marc common blocks are in fixed format so they have to be reformated to free format (f90)
! Beware of changes in newer Marc versions
include "include/concom%%MARCVERSION%%" ! concom is needed for inc, lovl
include "include/creeps%%MARCVERSION%%" ! creeps is needed for timinc (time increment)
#include QUOTE(PASTE(../lib/MarcInclude/concom,Marc4DAMASK)) ! concom is needed for inc, lovl
#include QUOTE(PASTE(../lib/MarcInclude/creeps,Marc4DAMASK)) ! creeps is needed for timinc (time increment)
logical :: cutBack
real(pReal), dimension(6) :: stress

3
code/DAMASK_marc2010.f90 Normal file
View File

@ -0,0 +1,3 @@
#define Marc4DAMASK 2010
#include "DAMASK_marc.f90"

2
code/DAMASK_marc2011.f90 Normal file
View File

@ -0,0 +1,2 @@
#define Marc4DAMASK 2011
#include "DAMASK_marc.f90"

2
code/DAMASK_marc2012.f90 Normal file
View File

@ -0,0 +1,2 @@
#define Marc4DAMASK 2012
#include "DAMASK_marc.f90"

View File

@ -467,3 +467,7 @@ clean:
@rm -rf *.o
@rm -rf *.mod
@rm -rf *.exe
install:
@./setup/symlink_Code.py

28
code/configure vendored Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env python
import os,re,subprocess
import damask
damaskEnv = damask.Environment('../') # script location relative to root
baseDir = damaskEnv.relPath('code/')
# changing dirs and compiler in makefile
compiler ={True:'ifort',False:'gfortran'}[\
subprocess.call(['which', 'ifort'],\
stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0]
makefile = open(os.path.join(baseDir,'Makefile'))
content = makefile.readlines()
makefile.close()
makefile = open(os.path.join(baseDir,'Makefile'),'w')
for line in content:
m = re.match(r'(FFTW|IMKL|ACML|LAPACK)ROOT\s*\?=\s*',line)
c = re.match(r'F90\s*\?=\s*',line)
if m:
if m.group(1).lower() in damaskEnv.pathInfo:
substitution = damaskEnv.pathInfo[m.group(1).lower()]
else:
substitution = ''
line = '%sROOT ?= %s\n'%(m.group(1),substitution)
if c:
line = 'F90? = %s\n'%compiler
makefile.write(line)
makefile.close()

View File

@ -187,9 +187,7 @@ subroutine constitutive_init
case default
knownPlasticity = .false.
end select
write(fileunit,*)
write(fileunit,'(a)') '['//trim(phase_name(p))//']'
write(fileunit,*)
write(fileunit,'(\,a,\)') '['//trim(phase_name(p))//']'
if (knownPlasticity) then
write(fileunit,'(a)') '(plasticity)'//char(9)//trim(phase_plasticity(p))
do e = 1_pInt,phase_Noutput(p)

View File

@ -1,49 +0,0 @@
#!/usr/bin/env python
import os,string,subprocess
from optparse import OptionParser, OptionGroup, Option, SUPPRESS_HELP
import damask
# -----------------------------
class extendedOption(Option):
# -----------------------------
# used for definition of new option parser action 'extend', which enables to take multiple option arguments
# taken from online tutorial http://docs.python.org/library/optparse.html
ACTIONS = Option.ACTIONS + ("extend",)
STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",)
TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",)
ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extend",)
def take_action(self, action, dest, opt, value, values, parser):
if action == "extend":
lvalue = value.split(",")
values.ensure_value(dest, []).extend(lvalue)
else:
Option.take_action(self, action, dest, opt, value, values, parser)
parser = OptionParser(option_class=extendedOption, usage='%prog [options] datafile[s]', description = """
Writes version specific files for different MARC releases, adjustes the make file for the spectral solver and optionally compiles the spectral solver
""" + string.replace('$Id$','\n','\\n')
)
parser.add_option('-o', '--options', dest='makeOptions', action='extend', type='string', \
metavar="KEY=VALUE", \
help='comma-separated list of options passed to Makefile when compiling spectral code')
parser.set_defaults(makeOptions = ['F90='+{True:'ifort',False:'gfortran'}[\
subprocess.call(['which', 'ifort'],\
stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0]])
(options, args) = parser.parse_args()
damaskEnv = damask.Environment('../../') # script location relative to root
baseDir = damaskEnv.relPath('code/')
# compiling spectral code
print 'base directory:', baseDir
os.system('make --directory %s clean'%(baseDir))
print 'make options:',' '.join(options.makeOptions)
os.system('make --directory %s %s'%(baseDir,' '.join(options.makeOptions)))

View File

@ -1,46 +0,0 @@
#!/usr/bin/env python
import os,re
import damask
architectures = {
'marc': {
'parent': 'DAMASK_marc.f90',
'versions' : ['%%MARCVERSION%%','2010','2011','2012'],
},
}
damaskEnv = damask.Environment('../../') # script location relative to root
baseDir = damaskEnv.relPath('code/')
for arch in architectures:
me = architectures[arch]
try:
parentFile = open(baseDir+os.sep+me['parent'])
parentContent = parentFile.readlines()
parentFile.close()
except IOError:
print 'unable to open',me['parent']
continue
for version in me['versions'][1:]:
childFile = open(baseDir+os.sep+version.join(os.path.splitext(me['parent'])),'w')
for line in parentContent:
childFile.write(line.replace(me['versions'][0],version))
childFile.close()
# changing dirs in makefile
makefile = open(os.path.join(baseDir,'Makefile'))
content = makefile.readlines()
makefile.close()
makefile = open(os.path.join(baseDir,'Makefile'),'w')
for line in content:
m = re.match(r'(FFTW|IMKL|ACML|LAPACK)ROOT\s*\?=',line)
if m:
if m.group(1).lower() in damaskEnv.pathInfo:
substitution = damaskEnv.pathInfo[m.group(1).lower()]
else:
substitution = ''
line = '%sROOT ?= %s\n'%(m.group(1),substitution)
makefile.write(line)
makefile.close()

View File

@ -1,20 +0,0 @@
#!/usr/bin/env sh
${DAMASK_ROOT}/code/setup/modify_Files.py
#remove -c or --compile from args an in case call compile spectral solver
compile=0
myArgs=''
for args
do
if [ "$args" = "-c" -o "$args" = "--compile" ]
then compile=1
else
myArgs="$myArgs $args"
fi
done
echo $myArgs
if [ "$compile" = 1 ]
then echo 'Compiling spectral solver'
${DAMASK_ROOT}/code/setup/compile_SpectralSolver.py $myArgs
fi
${DAMASK_ROOT}/code/setup/symlink_Code.py

View File

@ -31,7 +31,7 @@ fortCmd = "ifort"
# -integer-size 32 -DINT=4 assume size of integer to be 4 bytes, matches our definition of pInt
compile_fortran = (fortCmd + " -c -fPIC -auto " +
"-I%I -free -O1 -fpp -openmp " +
"-I%I -I../lib -free -O1 -fpp -openmp " +
"-ftz -diag-disable 5268 " +
"-implicitnone -assume byterecl " +
"-real-size 64 -integer-size 32 -DFLOAT=8 -DINT=4")