From fd9b760c13b1e5640f47d4e073737b4f22573bd9 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 19 Sep 2016 08:47:19 +0200 Subject: [PATCH 01/10] parameters not needed --- .../Phase_Phenopowerlaw_Aluminum.config | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/examples/ConfigFiles/Phase_Phenopowerlaw_Aluminum.config b/examples/ConfigFiles/Phase_Phenopowerlaw_Aluminum.config index 8fa58557a..63ec8f3c8 100644 --- a/examples/ConfigFiles/Phase_Phenopowerlaw_Aluminum.config +++ b/examples/ConfigFiles/Phase_Phenopowerlaw_Aluminum.config @@ -7,11 +7,6 @@ plasticity phenopowerlaw (output) resolvedstress_slip (output) accumulated_shear_slip (output) totalshear -(output) resistance_twin -(output) shearrate_twin -(output) resolvedstress_twin -(output) accumulated_shear_twin -(output) totalvolfrac_twin lattice_structure fcc Nslip 12 # per family @@ -26,19 +21,6 @@ n_slip 20 tau0_slip 31e6 # per family tausat_slip 63e6 # per family a_slip 2.25 -gdot0_twin 0.001 -n_twin 20 -tau0_twin 31e6 # per family -s_pr 0 # push-up factor for slip saturation due to twinning -twin_b 0 -twin_c 0 -twin_d 0 -twin_e 0 h0_slipslip 75e6 -h0_twinslip 0 -h0_twintwin 0 interaction_slipslip 1 1 1.4 1.4 1.4 1.4 -interaction_sliptwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -interaction_twinslip 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -interaction_twintwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 atol_resistance 1 From 2ad867a41015ba5ba782203e57ce930ee05c218f Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 19 Sep 2016 21:19:30 +0200 Subject: [PATCH 02/10] removed dependend variables --- .../Phase_Nonlocal_Aluminum.config | 32 ------------------- .../ConfigFiles/Phase_Nonlocal_Nickel.config | 20 ------------ 2 files changed, 52 deletions(-) mode change 100755 => 100644 examples/ConfigFiles/Phase_Nonlocal_Nickel.config diff --git a/examples/ConfigFiles/Phase_Nonlocal_Aluminum.config b/examples/ConfigFiles/Phase_Nonlocal_Aluminum.config index b805f09be..6406a47c0 100644 --- a/examples/ConfigFiles/Phase_Nonlocal_Aluminum.config +++ b/examples/ConfigFiles/Phase_Nonlocal_Aluminum.config @@ -8,32 +8,20 @@ plasticity nonlocal (output) rho_edge (output) rho_screw (output) rho_sgl -(output) rho_sgl_edge (output) rho_sgl_edge_pos (output) rho_sgl_edge_neg -(output) rho_sgl_screw (output) rho_sgl_screw_pos (output) rho_sgl_screw_neg -(output) rho_sgl_mobile -(output) rho_sgl_edge_mobile (output) rho_sgl_edge_pos_mobile (output) rho_sgl_edge_neg_mobile -(output) rho_sgl_screw_mobile (output) rho_sgl_screw_pos_mobile (output) rho_sgl_screw_neg_mobile -(output) rho_sgl_immobile -(output) rho_sgl_edge_immobile (output) rho_sgl_edge_pos_immobile (output) rho_sgl_edge_neg_immobile -(output) rho_sgl_screw_immobile (output) rho_sgl_screw_pos_immobile (output) rho_sgl_screw_neg_immobile -(output) rho_dip (output) rho_dip_edge (output) rho_dip_screw -(output) excess_rho -(output) excess_rho_edge -(output) excess_rho_screw (output) rho_forest (output) delta (output) delta_sgl @@ -47,10 +35,8 @@ plasticity nonlocal (output) rho_dot_sgl (output) rho_dot_sgl_mobile (output) rho_dot_dip -(output) rho_dot_gen (output) rho_dot_gen_edge (output) rho_dot_gen_screw -(output) rho_dot_sgl2dip (output) rho_dot_sgl2dip_edge (output) rho_dot_sgl2dip_screw (output) rho_dot_ann_ath @@ -66,24 +52,6 @@ plasticity nonlocal (output) velocity_edge_neg (output) velocity_screw_pos (output) velocity_screw_neg -(output) slipdirection.x -(output) slipdirection.y -(output) slipdirection.z -(output) slipnormal.x -(output) slipnormal.y -(output) slipnormal.z -(output) fluxDensity_edge_pos.x -(output) fluxDensity_edge_pos.y -(output) fluxDensity_edge_pos.z -(output) fluxDensity_edge_neg.x -(output) fluxDensity_edge_neg.y -(output) fluxDensity_edge_neg.z -(output) fluxDensity_screw_pos.x -(output) fluxDensity_screw_pos.y -(output) fluxDensity_screw_pos.z -(output) fluxDensity_screw_neg.x -(output) fluxDensity_screw_neg.y -(output) fluxDensity_screw_neg.z (output) maximumDipoleHeight_edge (output) maximumDipoleHeight_screw (output) accumulated_shear diff --git a/examples/ConfigFiles/Phase_Nonlocal_Nickel.config b/examples/ConfigFiles/Phase_Nonlocal_Nickel.config old mode 100755 new mode 100644 index 4d4c2d1df..3420b4246 --- a/examples/ConfigFiles/Phase_Nonlocal_Nickel.config +++ b/examples/ConfigFiles/Phase_Nonlocal_Nickel.config @@ -14,8 +14,6 @@ plasticity nonlocal (output) rho_dip_edge (output) rho_dip_screw (output) rho_forest -(output) excess_rho_edge -(output) excess_rho_screw (output) accumulatedshear (output) shearrate (output) resolvedstress @@ -30,24 +28,6 @@ plasticity nonlocal (output) rho_dot_edgejogs (output) rho_dot_flux_edge (output) rho_dot_flux_screw -(output) slipdirection.x -(output) slipdirection.y -(output) slipdirection.z -(output) slipnormal.x -(output) slipnormal.y -(output) slipnormal.z -(output) fluxdensity_edge_pos.x -(output) fluxdensity_edge_pos.y -(output) fluxdensity_edge_pos.z -(output) fluxdensity_edge_neg.x -(output) fluxdensity_edge_neg.y -(output) fluxdensity_edge_neg.z -(output) fluxdensity_screw_pos.x -(output) fluxdensity_screw_pos.y -(output) fluxdensity_screw_pos.z -(output) fluxdensity_screw_neg.x -(output) fluxdensity_screw_neg.y -(output) fluxdensity_screw_neg.z lattice_structure fcc Nslip 12 # number of slip systems per family From 03aebdf958908e43fdddda42d2e99ca4af92d546 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 20 Sep 2016 07:08:31 +0200 Subject: [PATCH 03/10] using standard function from C to determine hostname (no export of variable needed, name can be either HOST or HOSTNAME). fixed path separator as '/' --- code/C_routines.c | 23 ++++- code/spectral_interface.f90 | 178 ++++++++++++++---------------------- code/system_routines.f90 | 40 +++++++- 3 files changed, 124 insertions(+), 117 deletions(-) diff --git a/code/C_routines.c b/code/C_routines.c index 7be6264d7..5bc09745f 100644 --- a/code/C_routines.c +++ b/code/C_routines.c @@ -9,6 +9,14 @@ /* http://stackoverflow.com/questions/30279228/is-there-an-alternative-to-getcwd-in-fortran-2003-2008 */ +int isdirectory_c(const char *dir){ + struct stat statbuf; + if(stat(dir, &statbuf) != 0) + return 0; + return S_ISDIR(statbuf.st_mode); +} + + void getcurrentworkdir_c(char cwd[], int *stat ){ char cwd_tmp[1024]; if(getcwd(cwd_tmp, sizeof(cwd_tmp)) == cwd_tmp){ @@ -20,9 +28,14 @@ void getcurrentworkdir_c(char cwd[], int *stat ){ } } -int isdirectory_c(const char *dir){ - struct stat statbuf; - if(stat(dir, &statbuf) != 0) - return 0; - return S_ISDIR(statbuf.st_mode); + +void gethostname_c(char hostname[], int *stat ){ + char hostname_tmp[1024]; + if(gethostname(hostname_tmp, sizeof(hostname_tmp)) == 0){ + strcpy(hostname,hostname_tmp); + *stat = 0; + } + else{ + *stat = 1; + } } diff --git a/code/spectral_interface.f90 b/code/spectral_interface.f90 index d49a54411..cc68e94b5 100644 --- a/code/spectral_interface.f90 +++ b/code/spectral_interface.f90 @@ -1,5 +1,3 @@ -!-------------------------------------------------------------------------------------------------- -!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH !> @brief Interfacing between the spectral solver and the material subroutines provided !! by DAMASK @@ -20,6 +18,7 @@ module DAMASK_interface geometryFile = '', & !< parameter given for geometry file loadCaseFile = '' !< parameter given for load case file character(len=1024), private :: workingDirectory !< accessed by getSolverWorkingDirectoryName for compatibility reasons + character, private,parameter :: pathSep = '/' public :: & getSolverWorkingDirectoryName, & @@ -31,7 +30,6 @@ module DAMASK_interface getLoadCaseFile, & rectifyPath, & makeRelativePath, & - getPathSep, & IIO_stringValue, & IIO_intValue, & IIO_lc, & @@ -44,6 +42,8 @@ contains !-------------------------------------------------------------------------------------------------- subroutine DAMASK_interface_init() use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment) + use system_routines, only: & + getHostName implicit none character(len=1024) :: & @@ -64,6 +64,7 @@ subroutine DAMASK_interface_init() integer, dimension(8) :: & dateAndTime ! type default integer PetscErrorCode :: ierr + logical :: error external :: & quit,& MPI_Comm_rank,& @@ -116,54 +117,52 @@ subroutine DAMASK_interface_init() tag = IIO_lc(IIO_stringValue(commandLine,chunkPos,i)) ! extract key select case(tag) case ('-h','--help') - mainProcess2: if (worldrank == 0) then - write(6,'(a)') ' #######################################################################' - write(6,'(a)') ' DAMASK_spectral:' - write(6,'(a)') ' The spectral method boundary value problem solver for' - write(6,'(a)') ' the Düsseldorf Advanced Material Simulation Kit' - write(6,'(a,/)')' #######################################################################' - write(6,'(a,/)')' Valid command line switches:' - write(6,'(a)') ' --geom (-g, --geometry)' - write(6,'(a)') ' --load (-l, --loadcase)' - write(6,'(a)') ' --workingdir (-w, --wd, --workingdirectory, -d, --directory)' - write(6,'(a)') ' --restart (-r, --rs)' - write(6,'(a)') ' --help (-h)' - write(6,'(/,a)')' -----------------------------------------------------------------------' - write(6,'(a)') ' Mandatory arguments:' - write(6,'(/,a)')' --geom PathToGeomFile/NameOfGeom.geom' - write(6,'(a)') ' Specifies the location of the geometry definition file,' - write(6,'(a)') ' if no extension is given, .geom will be appended.' - write(6,'(a)') ' "PathToGeomFile" will be the working directory if not specified' - write(6,'(a)') ' via --workingdir.' - write(6,'(a)') ' Make sure the file "material.config" exists in the working' - write(6,'(a)') ' directory.' - write(6,'(a)') ' For further configuration place "numerics.config"' - write(6,'(a)')' and "numerics.config" in that directory.' - write(6,'(/,a)')' --load PathToLoadFile/NameOfLoadFile.load' - write(6,'(a)') ' Specifies the location of the load case definition file,' - write(6,'(a)') ' if no extension is given, .load will be appended.' - write(6,'(/,a)')' -----------------------------------------------------------------------' - write(6,'(a)') ' Optional arguments:' - write(6,'(/,a)')' --workingdirectory PathToWorkingDirectory' - write(6,'(a)') ' Specifies the working directory and overwrites the default' - write(6,'(a)') ' "PathToGeomFile".' - write(6,'(a)') ' Make sure the file "material.config" exists in the working' - write(6,'(a)') ' directory.' - write(6,'(a)') ' For further configuration place "numerics.config"' - write(6,'(a)')' and "numerics.config" in that directory.' - write(6,'(/,a)')' --restart XX' - write(6,'(a)') ' Reads in total increment No. XX-1 and continues to' - write(6,'(a)') ' calculate total increment No. XX.' - write(6,'(a)') ' Appends to existing results file ' - write(6,'(a)') ' "NameOfGeom_NameOfLoadFile.spectralOut".' - write(6,'(a)') ' Works only if the restart information for total increment' - write(6,'(a)') ' No. XX-1 is available in the working directory.' - write(6,'(/,a)')' -----------------------------------------------------------------------' - write(6,'(a)') ' Help:' - write(6,'(/,a)')' --help' - write(6,'(a,/)')' Prints this message and exits' - call quit(0_pInt) ! normal Termination - endif mainProcess2 + write(6,'(a)') ' #######################################################################' + write(6,'(a)') ' DAMASK_spectral:' + write(6,'(a)') ' The spectral method boundary value problem solver for' + write(6,'(a)') ' the Düsseldorf Advanced Material Simulation Kit' + write(6,'(a,/)')' #######################################################################' + write(6,'(a,/)')' Valid command line switches:' + write(6,'(a)') ' --geom (-g, --geometry)' + write(6,'(a)') ' --load (-l, --loadcase)' + write(6,'(a)') ' --workingdir (-w, --wd, --workingdirectory, -d, --directory)' + write(6,'(a)') ' --restart (-r, --rs)' + write(6,'(a)') ' --help (-h)' + write(6,'(/,a)')' -----------------------------------------------------------------------' + write(6,'(a)') ' Mandatory arguments:' + write(6,'(/,a)')' --geom PathToGeomFile/NameOfGeom.geom' + write(6,'(a)') ' Specifies the location of the geometry definition file,' + write(6,'(a)') ' if no extension is given, .geom will be appended.' + write(6,'(a)') ' "PathToGeomFile" will be the working directory if not specified' + write(6,'(a)') ' via --workingdir.' + write(6,'(a)') ' Make sure the file "material.config" exists in the working' + write(6,'(a)') ' directory.' + write(6,'(a)') ' For further configuration place "numerics.config"' + write(6,'(a)')' and "numerics.config" in that directory.' + write(6,'(/,a)')' --load PathToLoadFile/NameOfLoadFile.load' + write(6,'(a)') ' Specifies the location of the load case definition file,' + write(6,'(a)') ' if no extension is given, .load will be appended.' + write(6,'(/,a)')' -----------------------------------------------------------------------' + write(6,'(a)') ' Optional arguments:' + write(6,'(/,a)')' --workingdirectory PathToWorkingDirectory' + write(6,'(a)') ' Specifies the working directory and overwrites the default' + write(6,'(a)') ' "PathToGeomFile".' + write(6,'(a)') ' Make sure the file "material.config" exists in the working' + write(6,'(a)') ' directory.' + write(6,'(a)') ' For further configuration place "numerics.config"' + write(6,'(a)')' and "numerics.config" in that directory.' + write(6,'(/,a)')' --restart XX' + write(6,'(a)') ' Reads in total increment No. XX-1 and continues to' + write(6,'(a)') ' calculate total increment No. XX.' + write(6,'(a)') ' Appends to existing results file ' + write(6,'(a)') ' "NameOfGeom_NameOfLoadFile.spectralOut".' + write(6,'(a)') ' Works only if the restart information for total increment' + write(6,'(a)') ' No. XX-1 is available in the working directory.' + write(6,'(/,a)')' -----------------------------------------------------------------------' + write(6,'(a)') ' Help:' + write(6,'(/,a)')' --help' + write(6,'(a,/)')' Prints this message and exits' + call quit(0_pInt) ! normal Termination case ('-l', '--load', '--loadcase') loadcaseArg = IIO_stringValue(commandLine,chunkPos,i+1_pInt) case ('-g', '--geom', '--geometry') @@ -185,25 +184,23 @@ subroutine DAMASK_interface_init() geometryFile = getGeometryFile(geometryArg) loadCaseFile = getLoadCaseFile(loadCaseArg) - call get_environment_variable('HOSTNAME',hostName) call get_environment_variable('USER',userName) - mainProcess3: if (worldrank == 0) then - write(6,'(a,a)') ' Host name: ', trim(hostName) - write(6,'(a,a)') ' User name: ', trim(userName) - write(6,'(a,a)') ' Path separator: ', getPathSep() - write(6,'(a,a)') ' Command line call: ', trim(commandLine) - if (len(trim(workingDirArg))>0) & - write(6,'(a,a)') ' Working dir argument: ', trim(workingDirArg) - write(6,'(a,a)') ' Geometry argument: ', trim(geometryArg) - write(6,'(a,a)') ' Loadcase argument: ', trim(loadcaseArg) - write(6,'(a,a)') ' Working directory: ', trim(getSolverWorkingDirectoryName()) - write(6,'(a,a)') ' Geometry file: ', trim(geometryFile) - write(6,'(a,a)') ' Loadcase file: ', trim(loadCaseFile) - write(6,'(a,a)') ' Solver job name: ', trim(getSolverJobName()) - if (SpectralRestartInc > 1_pInt) & - write(6,'(a,i6.6)') ' Restart at increment: ', spectralRestartInc - write(6,'(a,l1,/)') ' Append to result file: ', appendToOutFile - endif mainProcess3 + error = getHostName(hostName) + write(6,'(a,a)') ' Host name: ', trim(hostName) + write(6,'(a,a)') ' User name: ', trim(userName) + write(6,'(a,a)') ' Path separator: ', pathSep + write(6,'(a,a)') ' Command line call: ', trim(commandLine) + if (len(trim(workingDirArg))>0) & + write(6,'(a,a)') ' Working dir argument: ', trim(workingDirArg) + write(6,'(a,a)') ' Geometry argument: ', trim(geometryArg) + write(6,'(a,a)') ' Loadcase argument: ', trim(loadcaseArg) + write(6,'(a,a)') ' Working directory: ', trim(getSolverWorkingDirectoryName()) + write(6,'(a,a)') ' Geometry file: ', trim(geometryFile) + write(6,'(a,a)') ' Loadcase file: ', trim(loadCaseFile) + write(6,'(a,a)') ' Solver job name: ', trim(getSolverJobName()) + if (SpectralRestartInc > 1_pInt) & + write(6,'(a,i6.6)') ' Restart at increment: ', spectralRestartInc + write(6,'(a,l1,/)') ' Append to result file: ', appendToOutFile end subroutine DAMASK_interface_init @@ -222,11 +219,9 @@ character(len=1024) function storeWorkingDirectory(workingDirectoryArg,geometryA character(len=*), intent(in) :: workingDirectoryArg !< working directory argument character(len=*), intent(in) :: geometryArg !< geometry argument character(len=1024) :: cwd - character :: pathSep logical :: error external :: quit - pathSep = getPathSep() wdGiven: if (len(workingDirectoryArg)>0) then absolutePath: if (workingDirectoryArg(1:1) == pathSep) then storeWorkingDirectory = workingDirectoryArg @@ -262,6 +257,7 @@ end function storeWorkingDirectory character(len=1024) function getSolverWorkingDirectoryName() implicit none + getSolverWorkingDirectoryName = workingDirectory end function getSolverWorkingDirectoryName @@ -274,10 +270,8 @@ character(len=1024) function getSolverJobName() implicit none integer :: posExt,posSep - character :: pathSep character(len=1024) :: tempString - pathSep = getPathSep() tempString = geometryFile posExt = scan(tempString,'.',back=.true.) @@ -308,11 +302,9 @@ character(len=1024) function getGeometryFile(geometryParameter) cwd integer :: posExt, posSep logical :: error - character :: pathSep external :: quit getGeometryFile = geometryParameter - pathSep = getPathSep() posExt = scan(getGeometryFile,'.',back=.true.) posSep = scan(getGeometryFile,pathSep,back=.true.) @@ -344,11 +336,9 @@ character(len=1024) function getLoadCaseFile(loadCaseParameter) cwd integer :: posExt, posSep logical :: error - character :: pathSep external :: quit getLoadCaseFile = loadcaseParameter - pathSep = getPathSep() posExt = scan(getLoadCaseFile,'.',back=.true.) posSep = scan(getLoadCaseFile,pathSep,back=.true.) @@ -374,11 +364,8 @@ function rectifyPath(path) implicit none character(len=*) :: path character(len=len_trim(path)) :: rectifyPath - character :: pathSep integer :: i,j,k,l ! no pInt - pathSep = getPathSep() - !-------------------------------------------------------------------------------------------------- ! remove /./ from path l = len_trim(path) @@ -415,10 +402,8 @@ character(len=1024) function makeRelativePath(a,b) implicit none character (len=*) :: a,b - character :: pathSep integer :: i,posLastCommonSlash,remainingSlashes !no pInt - pathSep = getPathSep() posLastCommonSlash = 0 remainingSlashes = 0 @@ -434,35 +419,6 @@ character(len=1024) function makeRelativePath(a,b) end function makeRelativePath -!-------------------------------------------------------------------------------------------------- -!> @brief counting / and \ in $PATH System variable the character occuring more often is assumed -! to be the path separator -!-------------------------------------------------------------------------------------------------- -character function getPathSep() - - implicit none - character(len=2048) :: & - path - integer(pInt) :: & - backslash = 0_pInt, & - slash = 0_pInt - integer :: i - - call get_environment_variable('PATH',path) - do i=1, len(trim(path)) - if (path(i:i)=='/') slash = slash + 1_pInt - if (path(i:i)=='\') backslash = backslash + 1_pInt - enddo - - if (backslash>slash) then - getPathSep = '\' - else - getPathSep = '/' - endif - -end function getPathSep - - !-------------------------------------------------------------------------------------------------- !> @brief taken from IO, check IO_stringValue for documentation !-------------------------------------------------------------------------------------------------- diff --git a/code/system_routines.f90 b/code/system_routines.f90 index ab1aae03f..07e12a20b 100644 --- a/code/system_routines.f90 +++ b/code/system_routines.f90 @@ -9,7 +9,8 @@ module system_routines public :: & isDirectory, & - getCWD + getCWD, & + getHostName interface @@ -29,6 +30,14 @@ interface integer(C_INT),intent(out) :: stat end subroutine getCurrentWorkDir_C + subroutine getHostName_C(str, stat) bind(C) + use, intrinsic :: ISO_C_Binding, only: & + C_INT, & + C_CHAR + character(kind=C_CHAR), dimension(1024), intent(out) :: str ! C string is an array + integer(C_INT),intent(out) :: stat + end subroutine getHostName_C + end interface @@ -85,5 +94,34 @@ logical function getCWD(str) end function getCWD + +!-------------------------------------------------------------------------------------------------- +!> @brief gets the current host name +!-------------------------------------------------------------------------------------------------- +logical function getHostName(str) + use, intrinsic :: ISO_C_Binding, only: & + C_INT, & + C_CHAR, & + C_NULL_CHAR + + implicit none + character(len=*), intent(out) :: str + character(kind=C_CHAR), dimension(1024) :: strFixedLength ! C string is an array + integer(C_INT) :: stat + integer :: i + + str = repeat('',len(str)) + call getHostName_C(strFixedLength,stat) + do i=1,1024 ! copy array components until Null string is found + if (strFixedLength(i) /= C_NULL_CHAR) then + str(i:i)=strFixedLength(i) + else + exit + endif + enddo + getHostName=merge(.True.,.False.,stat /= 0_C_INT) + +end function getHostName + end module system_routines From e5ba50808057ae65117e32ed7c74a35edfb1090e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 20 Sep 2016 07:10:07 +0200 Subject: [PATCH 04/10] added funtionality to run selected test only and functionality to show available tests --- lib/damask/test/test.py | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/lib/damask/test/test.py b/lib/damask/test/test.py index db58fd4a5..5a06939c6 100644 --- a/lib/damask/test/test.py +++ b/lib/damask/test/test.py @@ -23,6 +23,8 @@ class Test(): 'keep': False, 'accept': False, 'updateRequest': False, + 'show': False, + 'select': None, } for arg in defaults.keys(): setattr(self,arg,kwargs.get(arg) if kwargs.get(arg) else defaults[arg]) @@ -58,10 +60,18 @@ class Test(): action = "store_true", dest = "accept", help = "calculate results but always consider test as successfull") - + self.parser.add_option("-l", "--list", + action = "store_true", + dest = "show", + help = "show all test variants and do no calculation") + self.parser.add_option("-s", "--select", + dest = "select", + help = "run test of given name only") self.parser.set_defaults(keep = self.keep, accept = self.accept, update = self.updateRequest, + show = self.show, + select = self.select, ) @@ -73,21 +83,26 @@ class Test(): self.prepareAll() for variant,name in enumerate(self.variants): - try: - if not self.options.keep: - self.prepare(variant) - self.run(variant) + if self.options.show: + logging.critical('{}: {}'.format(variant,name)) + elif self.options.select is not None and name != self.options.select: + pass + else: + try: + if not self.options.keep: + self.prepare(variant) + self.run(variant) - self.postprocess(variant) + self.postprocess(variant) - if self.options.update: - if self.update(variant) != 0: logging.critical('update for "{}" failed.'.format(name)) - elif not (self.options.accept or self.compare(variant)): # no update, do comparison - return variant+1 # return culprit + if self.options.update: + if self.update(variant) != 0: logging.critical('update for "{}" failed.'.format(name)) + elif not (self.options.accept or self.compare(variant)): # no update, do comparison + return variant+1 # return culprit - except Exception as e : - logging.critical('exception during variant execution: {}'.format(e)) - return variant+1 # return culprit + except Exception as e : + logging.critical('exception during variant execution: {}'.format(e)) + return variant+1 # return culprit return 0 def feasible(self): From d0ea692cf2d6823e9324838b3390e39b881c8cba Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 20 Sep 2016 21:38:18 +0200 Subject: [PATCH 05/10] fix for 03aebdf958908e43fdddda42d2e99ca4af92d546 --- code/spectral_interface.f90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/spectral_interface.f90 b/code/spectral_interface.f90 index cc68e94b5..85ba30c51 100644 --- a/code/spectral_interface.f90 +++ b/code/spectral_interface.f90 @@ -1,3 +1,5 @@ +!-------------------------------------------------------------------------------------------------- +!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH !> @brief Interfacing between the spectral solver and the material subroutines provided !! by DAMASK From ff13925afa4012f93e3658fe960e615316e01122 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 21 Sep 2016 06:28:24 +0200 Subject: [PATCH 06/10] documented and simplified --- code/IO.f90 | 2 -- code/math.f90 | 36 ++++++++++++++---------------------- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/code/IO.f90 b/code/IO.f90 index f5db5c1f1..060fcf01f 100644 --- a/code/IO.f90 +++ b/code/IO.f90 @@ -1568,8 +1568,6 @@ subroutine IO_error(error_ID,el,ip,g,ext_msg) msg = 'math_check: R*v == q*v failed' case (410_pInt) msg = 'eigenvalues computation error' - case (450_pInt) - msg = 'unknown symmetry type specified' !------------------------------------------------------------------------------------------------- ! homogenization errors diff --git a/code/math.f90 b/code/math.f90 index d6d26a75d..315da2642 100644 --- a/code/math.f90 +++ b/code/math.f90 @@ -1450,7 +1450,7 @@ pure function math_EulerToQ(eulerangles) cos(halfangles(1)-halfangles(3)) * s, & sin(halfangles(1)-halfangles(3)) * s, & sin(halfangles(1)+halfangles(3)) * c ] - math_EulerToQ = math_qConj(math_EulerToQ) ! convert to passive rotation + math_EulerToQ = math_qConj(math_EulerToQ) ! convert to passive rotation end function math_EulerToQ @@ -1508,7 +1508,7 @@ pure function math_EulerAxisAngleToR(axis,omega) real(pReal), dimension(3), intent(in) :: axis real(pReal), intent(in) :: omega - math_EulerAxisAngleToR = transpose(math_axisAngleToR(axis,omega)) ! convert to passive rotation + math_EulerAxisAngleToR = transpose(math_axisAngleToR(axis,omega)) ! convert to passive rotation end function math_EulerAxisAngleToR @@ -1527,7 +1527,7 @@ pure function math_EulerAxisAngleToQ(axis,omega) real(pReal), dimension(3), intent(in) :: axis real(pReal), intent(in) :: omega - math_EulerAxisAngleToQ = math_qConj(math_axisAngleToQ(axis,omega)) ! convert to passive rotation + math_EulerAxisAngleToQ = math_qConj(math_axisAngleToQ(axis,omega)) ! convert to passive rotation end function math_EulerAxisAngleToQ @@ -1550,7 +1550,7 @@ pure function math_axisAngleToQ(axis,omega) norm = sqrt(math_mul3x3(axis,axis)) rotation: if (norm > 1.0e-8_pReal) then - axisNrm = axis/norm ! normalize axis to be sure + axisNrm = axis/norm ! normalize axis to be sure math_axisAngleToQ = [cos(0.5_pReal*omega), sin(0.5_pReal*omega) * axisNrm(1:3)] else rotation math_axisAngleToQ = [1.0_pReal,0.0_pReal,0.0_pReal,0.0_pReal] @@ -1864,37 +1864,29 @@ end function math_sampleGaussVar !-------------------------------------------------------------------------------------------------- -!> @brief symmetrically equivalent Euler angles for given sample symmetry 1:triclinic, 2:monoclinic, 4:orthotropic +!> @brief symmetrically equivalent Euler angles for given sample symmetry +!> @detail 1 (equivalent to != 2 and !=4):triclinic, 2:monoclinic, 4:orthotropic !-------------------------------------------------------------------------------------------------- pure function math_symmetricEulers(sym,Euler) implicit none - integer(pInt), intent(in) :: sym + integer(pInt), intent(in) :: sym !< symmetry Class real(pReal), dimension(3), intent(in) :: Euler real(pReal), dimension(3,3) :: math_symmetricEulers - integer(pInt) :: i,j - math_symmetricEulers(1,1) = PI+Euler(1) - math_symmetricEulers(2,1) = Euler(2) - math_symmetricEulers(3,1) = Euler(3) + math_symmetricEulers = transpose(reshape([PI+Euler(1), PI-Euler(1), 2.0_pReal*PI-Euler(1), & + Euler(2), PI-Euler(2), PI -Euler(2), & + Euler(3), PI+Euler(3), PI +Euler(3)],[3,3])) ! transpose is needed to have symbolic notation instead of column-major - math_symmetricEulers(1,2) = PI-Euler(1) - math_symmetricEulers(2,2) = PI-Euler(2) - math_symmetricEulers(3,2) = PI+Euler(3) - - math_symmetricEulers(1,3) = 2.0_pReal*PI-Euler(1) - math_symmetricEulers(2,3) = PI-Euler(2) - math_symmetricEulers(3,3) = PI+Euler(3) - - forall (i=1_pInt:3_pInt,j=1_pInt:3_pInt) math_symmetricEulers(j,i) = modulo(math_symmetricEulers(j,i),2.0_pReal*pi) + math_symmetricEulers = modulo(math_symmetricEulers,2.0_pReal*pi) select case (sym) - case (4_pInt) ! all done + case (4_pInt) ! orthotropic: all done - case (2_pInt) ! return only first + case (2_pInt) ! monoclinic: return only first math_symmetricEulers(1:3,2:3) = 0.0_pReal - case default ! return blank + case default ! triclinic: return blank math_symmetricEulers = 0.0_pReal end select From 25103205a8e86bd9cf5aadb2812ac151e0498431 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 21 Sep 2016 22:01:16 +0200 Subject: [PATCH 07/10] bug fix, adjust to options change of vtk_addXXXData --- processing/pre/geom_check.sh | 2 +- processing/pre/seeds_check.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/processing/pre/geom_check.sh b/processing/pre/geom_check.sh index 1eb85913c..5a39d4fc7 100755 --- a/processing/pre/geom_check.sh +++ b/processing/pre/geom_check.sh @@ -11,7 +11,7 @@ do < $geom \ | \ vtk_addRectilinearGridData \ - --scalar microstructure \ + --data microstructure \ --inplace \ --vtk ${geom%.*}.vtk rm ${geom%.*}.vtk diff --git a/processing/pre/seeds_check.sh b/processing/pre/seeds_check.sh index f24cd1c64..9bc054406 100755 --- a/processing/pre/seeds_check.sh +++ b/processing/pre/seeds_check.sh @@ -5,7 +5,7 @@ do vtk_pointcloud $seeds vtk_addPointcloudData $seeds \ - --scalar microstructure,weight \ + --data microstructure,weight \ --inplace \ --vtk ${seeds%.*}.vtp \ From 9f08258e05d2424fd33989bad2575dc7f7f946d0 Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 26 Sep 2016 16:34:07 +0200 Subject: [PATCH 08/10] updated version information after successful test of v2.0.1-150-g5345b42 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 85c030ae0..37c33ab3c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.1-148-gfb23c49 +v2.0.1-150-g5345b42 From 1d06e82700fef86b8f8c2c63b6c3ec1fba28a989 Mon Sep 17 00:00:00 2001 From: Aritra Chakraborty Date: Mon, 26 Sep 2016 16:30:50 -0400 Subject: [PATCH 09/10] grain circumference identification fixed right most path selection criteria for grain circumference --- .../pre/patchFromReconstructedBoundaries.py | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/processing/pre/patchFromReconstructedBoundaries.py b/processing/pre/patchFromReconstructedBoundaries.py index e4ec9ef42..572c929fa 100755 --- a/processing/pre/patchFromReconstructedBoundaries.py +++ b/processing/pre/patchFromReconstructedBoundaries.py @@ -270,7 +270,6 @@ def rcbParser(content,M,size,tolerance,idcolumn,segmentcolumn): myWalk = point['segments'].pop() grainLegs = [myWalk] myEnd = segments[myWalk][1 if segments[myWalk][0] == myStart else 0] - while (myEnd != pointId): myV = [points[myEnd]['coords'][0]-points[myStart]['coords'][0], points[myEnd]['coords'][1]-points[myStart]['coords'][1]] @@ -281,18 +280,18 @@ def rcbParser(content,M,size,tolerance,idcolumn,segmentcolumn): if peek == myWalk: continue # do not go back same path peekEnd = segments[peek][1 if segments[peek][0] == myEnd else 0] - peekV = [points[myEnd]['coords'][0]-points[peekEnd]['coords'][0], - points[myEnd]['coords'][1]-points[peekEnd]['coords'][1]] + peekV = [points[peekEnd]['coords'][0]-points[myEnd]['coords'][0], + points[peekEnd]['coords'][1]-points[myEnd]['coords'][1]] peekLen = math.sqrt(peekV[0]**2+peekV[1]**2) if peekLen == 0.0: damask.util.croak('peeklen is zero: peek point {}'.format(peek)) crossproduct = (myV[0]*peekV[1] - myV[1]*peekV[0])/myLen/peekLen dotproduct = (myV[0]*peekV[0] + myV[1]*peekV[1])/myLen/peekLen - innerAngle = crossproduct*(dotproduct+1.0) + innerAngle = math.copysign(1.0,crossproduct)*(dotproduct-1.0) if innerAngle >= best['product']: # takes sharpest left turn best['product'] = innerAngle best['peek'] = peek best['point'] = peekEnd - + innerAngleSum += best['product'] myWalk = best['peek'] myStart = myEnd @@ -301,7 +300,7 @@ def rcbParser(content,M,size,tolerance,idcolumn,segmentcolumn): if myWalk in points[myStart]['segments']: points[myStart]['segments'].remove(myWalk) else: - damask.utilcroak('{} not in segments of point {}'.format(myWalk,myStart)) + damask.util.croak('{} not in segments of point {}'.format(myWalk,myStart)) grainDraw.append(points[myStart]['coords']) grainLegs.append(myWalk) @@ -311,7 +310,6 @@ def rcbParser(content,M,size,tolerance,idcolumn,segmentcolumn): else: grains['box'] = grainLegs - # build overall data structure rcData = {'dimension':[dX,dY], @@ -772,8 +770,8 @@ def fftbuild(rcData,height,xframe,yframe,resolution,extrusion): 'dimension':(xsize,ysize,zsize)} frameindex=len(rcData['grain'])+1 # calculate frame index as largest grain index plus one - dx = xsize/(xres+1) # calculate step sizes - dy = ysize/(yres+1) + dx = xsize/(xres) # calculate step sizes + dy = ysize/(yres) grainpoints = [] for segments in rcData['grain']: # get segments of each grain @@ -788,11 +786,10 @@ def fftbuild(rcData,height,xframe,yframe,resolution,extrusion): grainpoints.append([]) # start out blank for current grain for p in sorted(points, key=points.get): # loop thru set of sorted points grainpoints[-1].append([rcData['point'][p][0],rcData['point'][p][1]]) # append x,y of point - bestGuess = 0 # assume grain 0 as best guess for i in range(int(xres*yres)): # walk through all points in xy plane xtest = -xframe+((i%xres)+0.5)*dx # calculate coordinates - ytest = -yframe+(int(i/xres)+0.5)*dy + ytest = -yframe+((i//xres)+0.5)*dy if(xtest < 0 or xtest > maxX): # check wether part of frame if( ytest < 0 or ytest > maxY): # part of edges fftdata['fftpoints'].append(frameindex+2) # append frameindex to result array @@ -944,8 +941,8 @@ if 'spectral' in options.output: geomFile = open(myName+'_'+str(int(fftdata['resolution'][0]))+'.geom','w') # open geom file for writing geomFile.write('3\theader\n') # write header info - geomFile.write('resolution a %i b %i c %i\n'%(fftdata['resolution'])) # resolution - geomFile.write('dimension x %f y %f z %f\n'%(fftdata['dimension'])) # size + geomFile.write('grid a %i b %i c %i\n'%(fftdata['resolution'])) # grid resolution + geomFile.write('size x %f y %f z %f\n'%(fftdata['dimension'])) # size geomFile.write('homogenization 1\n') # homogenization for z in xrange(fftdata['resolution'][2]): # z repetions for y in xrange(fftdata['resolution'][1]): # each x-row separately From 0ffd74d53680ab15d04ae1ad02b63d7514fc4ea8 Mon Sep 17 00:00:00 2001 From: Aritra Chakraborty Date: Mon, 26 Sep 2016 16:32:39 -0400 Subject: [PATCH 10/10] correct flag "data" for updated vtk_addRectilinearGridData --- processing/pre/geom_check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processing/pre/geom_check.sh b/processing/pre/geom_check.sh index 1eb85913c..5a39d4fc7 100755 --- a/processing/pre/geom_check.sh +++ b/processing/pre/geom_check.sh @@ -11,7 +11,7 @@ do < $geom \ | \ vtk_addRectilinearGridData \ - --scalar microstructure \ + --data microstructure \ --inplace \ --vtk ${geom%.*}.vtk rm ${geom%.*}.vtk