From 87608b6ed0998ffef23cf0d169314b2c7f429159 Mon Sep 17 00:00:00 2001 From: Sharan Date: Sat, 19 Mar 2022 20:49:33 +0100 Subject: [PATCH 001/142] missing docstring --- python/damask/_grid.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/python/damask/_grid.py b/python/damask/_grid.py index 1b184d6e7..a863afa7d 100644 --- a/python/damask/_grid.py +++ b/python/damask/_grid.py @@ -34,8 +34,8 @@ class Grid: material: np.ndarray, size: FloatSequence, origin: FloatSequence = np.zeros(3), - comments: Union[str, Sequence[str]] = None, - initial_conditions = None): + initial_conditions = None, + comments: Union[str, Sequence[str]] = None): """ New geometry definition for grid solvers. @@ -48,6 +48,8 @@ class Grid: Physical size of grid in meter. origin : sequence of float, len (3), optional Coordinates of grid origin in meter. Defaults to [0.0,0.0,0.0]. + initial_conditions : dictionary, optional + Labels and values of the inital conditions at each material point. comments : (list of) str, optional Comments, e.g. history of operations. @@ -55,8 +57,8 @@ class Grid: self.material = material self.size = size # type: ignore self.origin = origin # type: ignore - self.comments = [] if comments is None else comments # type: ignore self.ic = initial_conditions if initial_conditions is not None else {} + self.comments = [] if comments is None else comments # type: ignore def __repr__(self) -> str: """Give short human-readable summary.""" From 7f23f7b5b63ae971bd37eb9dfb212380d11b4c7e Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 24 Mar 2022 17:22:18 -0400 Subject: [PATCH 002/142] added IC setter/getter; explicit init of returned Grids --- python/damask/_grid.py | 73 +++++++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 23 deletions(-) diff --git a/python/damask/_grid.py b/python/damask/_grid.py index a863afa7d..7fc303d16 100644 --- a/python/damask/_grid.py +++ b/python/damask/_grid.py @@ -4,7 +4,7 @@ import warnings import multiprocessing as mp from functools import partial import typing -from typing import Union, Optional, TextIO, List, Sequence +from typing import Union, Optional, TextIO, List, Sequence, Dict from pathlib import Path import numpy as np @@ -34,7 +34,7 @@ class Grid: material: np.ndarray, size: FloatSequence, origin: FloatSequence = np.zeros(3), - initial_conditions = None, + initial_conditions: Dict[str,np.ndarray] = None, comments: Union[str, Sequence[str]] = None): """ New geometry definition for grid solvers. @@ -55,10 +55,10 @@ class Grid: """ self.material = material - self.size = size # type: ignore - self.origin = origin # type: ignore - self.ic = initial_conditions if initial_conditions is not None else {} - self.comments = [] if comments is None else comments # type: ignore + self.size = size # type: ignore + self.origin = origin # type: ignore + self.initial_conditions = {} if initial_conditions is None else initial_conditions + self.comments = [] if comments is None else comments # type: ignore def __repr__(self) -> str: """Give short human-readable summary.""" @@ -71,7 +71,7 @@ class Grid: f'origin: {util.srepr(self.origin," ")} m', f'# materials: {mat_N}' + ('' if mat_min == 0 and mat_max+1 == mat_N else f' (min: {mat_min}, max: {mat_max})') - ]+(['initial_conditions:']+[f' - {f}' for f in self.ic.keys()] if self.ic else [])) + ]+(['initial_conditions:']+[f' - {f}' for f in self.initial_conditions] if self.initial_conditions else [])) def __copy__(self) -> 'Grid': @@ -146,6 +146,19 @@ class Grid: self._origin = np.array(origin) + @property + def initial_conditions(self) -> Dict[str,np.ndarray]: + """Fields of initial conditions.""" + return self._ic + + @initial_conditions.setter + def initial_conditions(self, + ic: Dict[str,np.ndarray]): + if not isinstance(ic,dict): + raise TypeError('initial conditions is not a dictionary') + + self._ic = ic + @property def comments(self) -> List[str]: """Comments, e.g. history of operations.""" @@ -195,11 +208,12 @@ class Grid: return Grid(material = v.get('material').reshape(cells,order='F'), size = bbox[1] - bbox[0], origin = bbox[0], + initial_conditions = ic, comments = comments, - initial_conditions = ic) + ) - @typing. no_type_check + @typing.no_type_check @staticmethod def load_ASCII(fname)-> 'Grid': """ @@ -269,7 +283,10 @@ class Grid: if not np.any(np.mod(material,1) != 0.0): # no float present material = material.astype(int) - (1 if material.min() > 0 else 0) - return Grid(material.reshape(cells,order='F'),size,origin,comments) + return Grid(material = material.reshape(cells,order='F'), + size = size, + origin = origin, + comments = comments) @staticmethod @@ -306,9 +323,11 @@ class Grid: cells = np.array(v.vtk_data.GetDimensions())-1 bbox = np.array(v.vtk_data.GetBounds()).reshape(3,2).T - return Grid(v.get('MaterialId').reshape(cells,order='F').astype('int32',casting='unsafe') - 1, - bbox[1] - bbox[0], bbox[0], - util.execution_stamp('Grid','load_Neper')) + return Grid(material = v.get('MaterialId').reshape(cells,order='F').astype('int32',casting='unsafe') - 1, + size = bbox[1] - bbox[0], + origin = bbox[0], + comments = util.execution_stamp('Grid','load_Neper'), + ) @staticmethod @@ -371,7 +390,11 @@ class Grid: else: ma = f['/'.join([b,c,feature_IDs])][()].flatten() - return Grid(ma.reshape(cells,order='F'),size,origin,util.execution_stamp('Grid','load_DREAM3D')) + return Grid(material = ma.reshape(cells,order='F'), + size = size, + origin = origin, + comments = util.execution_stamp('Grid','load_DREAM3D'), + ) @staticmethod @@ -406,7 +429,11 @@ class Grid: ma = np.arange(cells.prod()) if len(unique) == cells.prod() else \ np.arange(unique.size)[np.argsort(pd.unique(unique_inverse))][unique_inverse] - return Grid(ma.reshape(cells,order='F'),size,origin,util.execution_stamp('Grid','from_table')) + return Grid(material = ma.reshape(cells,order='F'), + size = size, + origin = origin, + comments = util.execution_stamp('Grid','from_table'), + ) @staticmethod @@ -665,7 +692,7 @@ class Grid: """ v = VTK.from_image_data(self.cells,self.size,self.origin)\ .add('material',self.material.flatten(order='F')) - for label,data in self.ic.items(): + for label,data in self.initial_conditions.items(): v = v.add(label,data.flatten(order='F')) v.comments = self.comments @@ -929,13 +956,13 @@ class Grid: """ return Grid(material = ndimage.interpolation.zoom( - self.material, - cells/self.cells, - output=self.material.dtype, - order=0, - mode='wrap' if periodic else 'nearest', - prefilter=False - ), + self.material, + cells/self.cells, + output=self.material.dtype, + order=0, + mode='wrap' if periodic else 'nearest', + prefilter=False + ), size = self.size, origin = self.origin, comments = self.comments+[util.execution_stamp('Grid','scale')], From 3cceffccb5a9955f26b7e9fea184e3444f936f24 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 25 Mar 2022 09:42:44 -0400 Subject: [PATCH 003/142] use updated .ic->.initial_conditions tests --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 459326e98..baf29e653 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 459326e9840c843ade72b04cf28e50889c9779f1 +Subproject commit baf29e6530eb10083642fd02d4ec59a1c6586591 From 84ac4266065128e79613e485633beca321517a87 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 1 Apr 2022 18:04:50 -0400 Subject: [PATCH 004/142] additional property shows integer list --- python/damask/_result.py | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index f3b649a30..fcfb44ecb 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -112,10 +112,10 @@ class Result: else: self.add_curl = self.add_divergence = self.add_gradient = None - r=re.compile('increment_[0-9]+') - self.increments = sorted([i for i in f.keys() if r.match(i)],key=util.natural_sort) - self.times = [round(f[i].attrs['t/s'],12) for i in self.increments] - if len(self.increments) == 0: + r = re.compile(r'increment_([0-9]+)') + self.incs = sorted([int(m.group(1)) for i in f.keys() for m in (r.match(i),) if m]) + self.times = [round(f[i].attrs['t/s'],12) for i in self.increments] + if len(self.incs) == 0: raise ValueError('incomplete DADF5 file') self.N_materialpoints, self.N_constituents = np.shape(f['cell_to/phase']) @@ -240,16 +240,16 @@ class Result: return dup - def increments_in_range(self,start,end): + def increments_in_range(self,start=None,end=None): """ Get all increments within a given range. Parameters ---------- - start : int or str - Start increment. - end : int or str - End increment. + start : int or str, optional + Start increment. Defaults to first. + end : int or str, optional + End increment. Defaults to last. Returns ------- @@ -257,12 +257,10 @@ class Result: Increment number of all increments within the given bounds. """ - selected = [] - for i,inc in enumerate([int(i[10:]) for i in self.increments]): - s,e = map(lambda x: int(x[10:] if isinstance(x,str) and x.startswith('inc') else x), (start,end)) - if s <= inc <= e: - selected.append(self.increments[i]) - return selected + s,e = map(lambda x: int(x[10:] if isinstance(x,str) and x.startswith('increment_') else x), + (self.incs[ 0] if start is None else start, + self.incs[-1] if end is None else end)) + return [i for i in self.incs if s <= i <= e] def times_in_range(self,start,end): """ @@ -541,6 +539,11 @@ class Result: print(f'Function {func.__name__} enabled in add_calculation.') + @property + def increments(self): + return list(map(lambda i:f'increment_{i}',self.incs)) + + @property def coordinates0_point(self): """Initial/undeformed cell center coordinates.""" @@ -1602,7 +1605,7 @@ class Result: v.comments = util.execution_stamp('Result','export_VTK') - N_digits = int(np.floor(np.log10(max(1,int(self.increments[-1][10:])))))+1 + N_digits = int(np.floor(np.log10(max(1,self.incs[-1]))))+1 constituents_ = constituents if isinstance(constituents,Iterable) else \ (range(self.N_constituents) if constituents is None else [constituents]) From 00671f943bfe41e77f303238909e14b056dcfbad Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 13 Apr 2022 23:45:14 +0200 Subject: [PATCH 005/142] easier to understand --- src/YAML_types.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/YAML_types.f90 b/src/YAML_types.f90 index d7ca71cbb..c4dcc0a83 100644 --- a/src/YAML_types.f90 +++ b/src/YAML_types.f90 @@ -1348,8 +1348,8 @@ subroutine tList_append(self,node) type(tItem), pointer :: item if (.not. associated(self%first)) then - allocate(self%first) - item => self%first + allocate(item) + self%first => item else item => self%first do while (associated(item%next)) From ca0df3389a96c7d867c0e884128662a3ee9a4c37 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Apr 2022 00:06:54 +0200 Subject: [PATCH 006/142] avoid long pointer transversal --- src/YAML_types.f90 | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/YAML_types.f90 b/src/YAML_types.f90 index c4dcc0a83..b32651905 100644 --- a/src/YAML_types.f90 +++ b/src/YAML_types.f90 @@ -119,7 +119,8 @@ module YAML_types type, extends(tNode), public :: tList - class(tItem), pointer :: first => NULL() + class(tItem), pointer :: first => NULL(), & + last => NULL() contains procedure :: asFormattedString => tList_asFormattedString @@ -1350,13 +1351,11 @@ subroutine tList_append(self,node) if (.not. associated(self%first)) then allocate(item) self%first => item + self%last => item else - item => self%first - do while (associated(item%next)) - item => item%next - enddo - allocate(item%next) - item => item%next + allocate(self%last%next) + item => self%last%next + self%last => item end if item%node => node From 563d566a3f699af85a8fe558ebf7c724d4fd4756 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Apr 2022 01:06:47 +0200 Subject: [PATCH 007/142] made two loops faster the most annoying one is still slow. --- src/YAML_types.f90 | 2 +- src/material.f90 | 50 ++++++++++++++++++++++++++++++---------------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/YAML_types.f90 b/src/YAML_types.f90 index b32651905..857b24bd0 100644 --- a/src/YAML_types.f90 +++ b/src/YAML_types.f90 @@ -145,7 +145,7 @@ module YAML_types end type tDict - type :: tItem + type, public :: tItem character(len=:), allocatable :: key class(tNode), pointer :: node => NULL() class(tItem), pointer :: next => NULL() diff --git a/src/material.f90 b/src/material.f90 index 3ff280b0d..4d6bc361d 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -91,6 +91,7 @@ subroutine parse() homogenizations, & homogenization + class(tItem), pointer :: item integer, dimension(:), allocatable :: & counterPhase, & counterHomogenization @@ -102,6 +103,7 @@ subroutine parse() co, ce, & ma + materials => config_material%get('material') phases => config_material%get('phase') homogenizations => config_material%get('homogenization') @@ -169,17 +171,23 @@ subroutine parse() allocate(material_O_0(materials%length)) allocate(material_F_i_0(materials%length)) - do ma = 1, materials%length - material => materials%get(ma) - constituents => material%get('constituents') - allocate(material_O_0(ma)%data(constituents%length)) - allocate(material_F_i_0(ma)%data(1:3,1:3,constituents%length)) - do co = 1, constituents%length - constituent => constituents%get(co) - call material_O_0(ma)%data(co)%fromQuaternion(constituent%get_as1dFloat('O',requiredSize=4)) - material_F_i_0(ma)%data(1:3,1:3,co) = constituent%get_as2dFloat('F_i',defaultVal=math_I3,requiredShape=[3,3]) - enddo - enddo + ! manual iteration for performance + select type(materials) + class is(tList) + item => materials%first + do ma = 1, materials%length + material => item%node + constituents => material%get('constituents') + allocate(material_O_0(ma)%data(constituents%length)) + allocate(material_F_i_0(ma)%data(1:3,1:3,constituents%length)) + do co = 1, constituents%length + constituent => constituents%get(co) + call material_O_0(ma)%data(co)%fromQuaternion(constituent%get_as1dFloat('O',requiredSize=4)) + material_F_i_0(ma)%data(1:3,1:3,co) = constituent%get_as2dFloat('F_i',defaultVal=math_I3,requiredShape=[3,3]) + end do + item => item%next + end do + end select end subroutine parse @@ -195,17 +203,25 @@ subroutine sanityCheck(materials,homogenizations) class(tNode), pointer :: material, & homogenization, & constituents + class(tItem), pointer :: item integer :: m + if (maxval(discretization_materialAt) > materials%length) & call IO_error(155,ext_msg='More materials requested than found in material.yaml') - do m = 1, materials%length - material => materials%get(m) - constituents => material%get('constituents') - homogenization => homogenizations%get(material%get_asString('homogenization')) - if (constituents%length /= homogenization%get_asInt('N_constituents')) call IO_error(148) - end do + ! manual iteration for performance + select type(materials) + class is(tList) + item => materials%first + do m = 1, materials%length + material => materials%get(m) + constituents => material%get('constituents') + homogenization => homogenizations%get(material%get_asString('homogenization')) + if (constituents%length /= homogenization%get_asInt('N_constituents')) call IO_error(148) + item => item%next + end do + end select end subroutine sanityCheck From 3309360e4bf96ee32d156b825098b8e573cbea67 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Apr 2022 07:19:56 +0200 Subject: [PATCH 008/142] avoit out of bounds access --- src/YAML_parse.f90 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/YAML_parse.f90 b/src/YAML_parse.f90 index e589758c9..8013089e1 100644 --- a/src/YAML_parse.f90 +++ b/src/YAML_parse.f90 @@ -168,8 +168,11 @@ logical function quotedString(line) character(len=*), intent(in) :: line + quotedString = .false. + if (len(line) == 0) return + if (scan(line(:1),IO_QUOTES) == 1) then quotedString = .true. if(line(len(line):len(line)) /= line(:1)) call IO_error(710,ext_msg=line) From b56176d670d22616ec512e7c0c11326849f8aaf1 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Apr 2022 12:55:11 +0200 Subject: [PATCH 009/142] all YAML related initialization is constant (linear in number of points) --- src/material.f90 | 125 +++++++++++++++++++++-------------------------- 1 file changed, 56 insertions(+), 69 deletions(-) diff --git a/src/material.f90 b/src/material.f90 index 4d6bc361d..40d178540 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -94,7 +94,10 @@ subroutine parse() class(tItem), pointer :: item integer, dimension(:), allocatable :: & counterPhase, & - counterHomogenization + counterHomogenization, & + temp_ho + integer, dimension(:,:), allocatable :: temp_ph + real(pReal), dimension(:,:), allocatable :: temp_v real(pReal) :: v integer :: & @@ -108,8 +111,6 @@ subroutine parse() phases => config_material%get('phase') homogenizations => config_material%get('homogenization') - call sanityCheck(materials, homogenizations) - #if defined (__GFORTRAN__) material_name_phase = getKeys(phases) material_name_homogenization = getKeys(homogenizations) @@ -136,10 +137,56 @@ subroutine parse() allocate(material_v(homogenization_maxNconstituents,discretization_Ncells),source=0.0_pReal) - do el = 1, discretization_Nelems - material => materials%get(discretization_materialAt(el)) + allocate(material_O_0(materials%length)) + allocate(material_F_i_0(materials%length)) + + select type(materials) + + class is(tList) + + if (maxval(discretization_materialAt) > materials%length) & + call IO_error(155,ext_msg='More materials requested than found in material.yaml') + + allocate(temp_ho(materials%length)) + allocate(temp_ph(materials%length,homogenization_maxNconstituents),source=-1) + allocate(temp_v(materials%length,homogenization_maxNconstituents),source=0.0_pReal) + + item => materials%first + do ma = 1, materials%length + material => item%node + temp_ho(ma) = homogenizations%getIndex(material%get_asString('homogenization')) + constituents => material%get('constituents') + + homogenization => homogenizations%get(temp_ho(ma)) + if (constituents%length /= homogenization%get_asInt('N_constituents')) call IO_error(148) + + allocate(material_O_0(ma)%data(constituents%length)) + allocate(material_F_i_0(ma)%data(1:3,1:3,constituents%length)) + + do co = 1, constituents%length + constituent => constituents%get(co) + temp_v(ma,co) = constituent%get_asFloat('v') + temp_ph(ma,co) = phases%getIndex(constituent%get_asString('phase')) + + call material_O_0(ma)%data(co)%fromQuaternion(constituent%get_as1dFloat('O',requiredSize=4)) + material_F_i_0(ma)%data(1:3,1:3,co) = constituent%get_as2dFloat('F_i',defaultVal=math_I3,requiredShape=[3,3]) + + end do + if (dNeq(sum(temp_v(ma,:)),1.0_pReal,1.e-9_pReal)) call IO_error(153,ext_msg='constituent') + + item => item%next + + end do + + end select + + + ! build mappings + do el = 1, discretization_Nelems + + ma = discretization_materialAt(el) + ho = temp_ho(ma) - ho = homogenizations%getIndex(material%get_asString('homogenization')) do ip = 1, discretization_nIPs ce = (el-1)*discretization_nIPs + ip material_homogenizationID(ce) = ho @@ -147,13 +194,11 @@ subroutine parse() material_homogenizationEntry(ce) = counterHomogenization(ho) end do - constituents => material%get('constituents') - do co = 1, constituents%length - constituent => constituents%get(co) + do co = 1, size(temp_ph(ma,:)>0) - v = constituent%get_asFloat('v') + v = temp_v(ma,co) + ph = temp_ph(ma,co) - ph = phases%getIndex(constituent%get_asString('phase')) do ip = 1, discretization_nIPs ce = (el-1)*discretization_nIPs + ip material_phaseID(co,ce) = ph @@ -163,68 +208,10 @@ subroutine parse() end do end do - if (dNeq(sum(material_v(1:constituents%length,ce)),1.0_pReal,1.e-9_pReal)) & - call IO_error(153,ext_msg='constituent') - end do - allocate(material_O_0(materials%length)) - allocate(material_F_i_0(materials%length)) - - ! manual iteration for performance - select type(materials) - class is(tList) - item => materials%first - do ma = 1, materials%length - material => item%node - constituents => material%get('constituents') - allocate(material_O_0(ma)%data(constituents%length)) - allocate(material_F_i_0(ma)%data(1:3,1:3,constituents%length)) - do co = 1, constituents%length - constituent => constituents%get(co) - call material_O_0(ma)%data(co)%fromQuaternion(constituent%get_as1dFloat('O',requiredSize=4)) - material_F_i_0(ma)%data(1:3,1:3,co) = constituent%get_as2dFloat('F_i',defaultVal=math_I3,requiredShape=[3,3]) - end do - item => item%next - end do - end select - end subroutine parse - -!-------------------------------------------------------------------------------------------------- -!> @brief Check if material.yaml is consistent and contains sufficient # of materials -!-------------------------------------------------------------------------------------------------- -subroutine sanityCheck(materials,homogenizations) - - class(tNode), intent(in) :: materials, & - homogenizations - - class(tNode), pointer :: material, & - homogenization, & - constituents - class(tItem), pointer :: item - integer :: m - - - if (maxval(discretization_materialAt) > materials%length) & - call IO_error(155,ext_msg='More materials requested than found in material.yaml') - - ! manual iteration for performance - select type(materials) - class is(tList) - item => materials%first - do m = 1, materials%length - material => materials%get(m) - constituents => material%get('constituents') - homogenization => homogenizations%get(material%get_asString('homogenization')) - if (constituents%length /= homogenization%get_asInt('N_constituents')) call IO_error(148) - item => item%next - end do - end select - -end subroutine sanityCheck - #if defined (__GFORTRAN__) !-------------------------------------------------------------------------------------------------- !> @brief %keys() is broken on gfortran From dbf5ee84cb997febff4a10949c1bfa352e751188 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 14 Apr 2022 20:14:08 +0200 Subject: [PATCH 010/142] better readable --- src/material.f90 | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/material.f90 b/src/material.f90 index 40d178540..7264738e5 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -111,6 +111,10 @@ subroutine parse() phases => config_material%get('phase') homogenizations => config_material%get('homogenization') + + if (maxval(discretization_materialAt) > materials%length) & + call IO_error(155,ext_msg='More materials requested than found in material.yaml') + #if defined (__GFORTRAN__) material_name_phase = getKeys(phases) material_name_homogenization = getKeys(homogenizations) @@ -126,31 +130,20 @@ subroutine parse() end do homogenization_maxNconstituents = maxval(homogenization_Nconstituents) - allocate(counterPhase(phases%length),source=0) - allocate(counterHomogenization(homogenizations%length),source=0) - - allocate(material_homogenizationID(discretization_Ncells),source=0) - allocate(material_homogenizationEntry(discretization_Ncells),source=0) - - allocate(material_phaseID(homogenization_maxNconstituents,discretization_Ncells),source=0) - allocate(material_phaseEntry(homogenization_maxNconstituents,discretization_Ncells),source=0) - allocate(material_v(homogenization_maxNconstituents,discretization_Ncells),source=0.0_pReal) allocate(material_O_0(materials%length)) allocate(material_F_i_0(materials%length)) + allocate(temp_ho(materials%length)) + allocate(temp_ph(materials%length,homogenization_maxNconstituents),source=-1) + allocate(temp_v(materials%length,homogenization_maxNconstituents),source=0.0_pReal) + + ! parse YAML structure select type(materials) class is(tList) - if (maxval(discretization_materialAt) > materials%length) & - call IO_error(155,ext_msg='More materials requested than found in material.yaml') - - allocate(temp_ho(materials%length)) - allocate(temp_ph(materials%length,homogenization_maxNconstituents),source=-1) - allocate(temp_v(materials%length,homogenization_maxNconstituents),source=0.0_pReal) - item => materials%first do ma = 1, materials%length material => item%node @@ -175,12 +168,21 @@ subroutine parse() if (dNeq(sum(temp_v(ma,:)),1.0_pReal,1.e-9_pReal)) call IO_error(153,ext_msg='constituent') item => item%next - end do end select + allocate(counterPhase(phases%length),source=0) + allocate(counterHomogenization(homogenizations%length),source=0) + + allocate(material_homogenizationID(discretization_Ncells),source=0) + allocate(material_homogenizationEntry(discretization_Ncells),source=0) + + allocate(material_phaseID(homogenization_maxNconstituents,discretization_Ncells),source=0) + allocate(material_phaseEntry(homogenization_maxNconstituents,discretization_Ncells),source=0) + + ! build mappings do el = 1, discretization_Nelems @@ -212,6 +214,7 @@ subroutine parse() end subroutine parse + #if defined (__GFORTRAN__) !-------------------------------------------------------------------------------------------------- !> @brief %keys() is broken on gfortran From f11b6f54e55420a75887d4d823c88a075dde2ae1 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 15 Apr 2022 15:35:09 +0200 Subject: [PATCH 011/142] markdown - as for PRIVATE --- README | 13 ------------- README.md | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 13 deletions(-) delete mode 100644 README create mode 100644 README.md diff --git a/README b/README deleted file mode 100644 index 543de378f..000000000 --- a/README +++ /dev/null @@ -1,13 +0,0 @@ -DAMASK - The Düsseldorf Advanced Material Simulation Kit -Visit damask.mpie.de for installation and usage instructions - -CONTACT INFORMATION - -Max-Planck-Institut für Eisenforschung GmbH -Max-Planck-Str. 1 -40237 Düsseldorf -Germany - -damask@mpie.de -https://damask.mpie.de -https://git.damask.mpie.de diff --git a/README.md b/README.md new file mode 100644 index 000000000..a2178e0ab --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# DAMASK - The Düsseldorf Advanced Material Simulation Kit + +Visit [damask.mpie.de](https://damask.mpie.de) for installation and usage instructions + +## Contact Information + +Max-Planck-Institut für Eisenforschung GmbH +Max-Planck-Str. 1 +40237 Düsseldorf +Germany + +damask@mpie.de +https://damask.mpie.de +https://git.damask.mpie.de + From 5f49f38a018971454f4f319aed36ed81a12d1b6b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 15 Apr 2022 15:40:24 +0200 Subject: [PATCH 012/142] nicely formatted readmes --- PRIVATE | 2 +- README.md | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/PRIVATE b/PRIVATE index 459326e98..f6a94aeaa 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 459326e9840c843ade72b04cf28e50889c9779f1 +Subproject commit f6a94aeaaa3a81347821e7a092d43dd04115f5f6 diff --git a/README.md b/README.md index a2178e0ab..5b5edf677 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,12 @@ Visit [damask.mpie.de](https://damask.mpie.de) for installation and usage instru ## Contact Information -Max-Planck-Institut für Eisenforschung GmbH -Max-Planck-Str. 1 -40237 Düsseldorf -Germany +Max-Planck-Institut für Eisenforschung GmbH +Max-Planck-Str. 1 +40237 Düsseldorf +Germany -damask@mpie.de -https://damask.mpie.de -https://git.damask.mpie.de +damask@mpie.de +https://damask.mpie.de +https://git.damask.mpie.de From 51582b80f8882fc9032d90980f94168bec01365e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 15 Apr 2022 15:48:21 +0200 Subject: [PATCH 013/142] don't fail windows is unreliable --- .github/workflows/Python.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/Python.yml b/.github/workflows/Python.yml index ca74c0016..3b6bb0df4 100644 --- a/.github/workflows/Python.yml +++ b/.github/workflows/Python.yml @@ -11,6 +11,7 @@ jobs: matrix: python-version: ['3.8', '3.9'] #, '3.10'] os: [ubuntu-latest, macos-latest, windows-latest] + fail-fast: false steps: - uses: actions/checkout@v2 From 5d99b152eec889030486252988723a3d39a56ee5 Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 15 Apr 2022 21:23:03 +0200 Subject: [PATCH 014/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-206-g51582b80f --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index 946c163c0..7ce9e687d 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha6-202-g87b5097ff +v3.0.0-alpha6-206-g51582b80f From 3cc3229792c82ef496f5bf3c376452a61652584e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 16 Apr 2022 16:19:33 +0200 Subject: [PATCH 015/142] string new line which is added by libfyaml --- src/YAML_parse.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/YAML_parse.f90 b/src/YAML_parse.f90 index 8013089e1..bfce06bc9 100644 --- a/src/YAML_parse.f90 +++ b/src/YAML_parse.f90 @@ -83,7 +83,7 @@ recursive function parse_flow(YAML_flow) result(node) s, & ! start position of dictionary or list d ! position of key: value separator (':') - flow_string = trim(adjustl(YAML_flow(:))) + flow_string = trim(adjustl(YAML_flow)) if (len_trim(flow_string) == 0) then node => emptyDict return @@ -201,7 +201,7 @@ function to_flow(mixed) result(flow) block character(len=strlen,kind=c_char), pointer :: s call c_f_pointer(str_ptr,s) - flow = s + flow = s(:len(s)-1) end block call free_C(str_ptr) From 954a336d92c278227525ee174e25d196f7a328b2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 16 Apr 2022 16:24:29 +0200 Subject: [PATCH 016/142] Fortran side does not support tags (i.e. 'type hints') --- src/C_routines.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/C_routines.c b/src/C_routines.c index 3a1db91a0..a25fde688 100644 --- a/src/C_routines.c +++ b/src/C_routines.c @@ -88,7 +88,7 @@ void inflate_c(const uLong *s_deflated, const uLong *s_inflated, const Byte defl #ifdef FYAML void to_flow_c(char **flow, int* length_flow, const char *mixed){ struct fy_document *fyd = NULL; - enum fy_emitter_cfg_flags emit_flags = FYECF_MODE_FLOW_ONELINE | FYECF_STRIP_LABELS | FYECF_STRIP_DOC; + enum fy_emitter_cfg_flags emit_flags = FYECF_MODE_FLOW_ONELINE | FYECF_STRIP_LABELS | FYECF_STRIP_TAGS |FYECF_STRIP_DOC; fyd = fy_document_build_from_string(NULL, mixed, -1); if (!fyd) { From 808ef139aefc56a530a1bcf6451b8035acf5d3b4 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 18 Apr 2022 13:16:45 +0200 Subject: [PATCH 017/142] avoid code duplication by using assumed rank "(..)" - lack of modern Fortran interface for HDF5 still requires branching to call the same code - not sure how to handle the read function (assumed rank and intent(out) ) does not work together --- src/HDF5_utilities.f90 | 137 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 136 insertions(+), 1 deletion(-) diff --git a/src/HDF5_utilities.f90 b/src/HDF5_utilities.f90 index 93de4053b..86807507b 100644 --- a/src/HDF5_utilities.f90 +++ b/src/HDF5_utilities.f90 @@ -48,6 +48,7 @@ module HDF5_utilities !> @details for parallel IO, all dimension except for the last need to match !-------------------------------------------------------------------------------------------------- interface HDF5_write +#if defined(__GFORTRAN__) && __GNUC__<11 module procedure HDF5_write_real1 module procedure HDF5_write_real2 module procedure HDF5_write_real3 @@ -55,7 +56,6 @@ module HDF5_utilities module procedure HDF5_write_real5 module procedure HDF5_write_real6 module procedure HDF5_write_real7 - module procedure HDF5_write_int1 module procedure HDF5_write_int2 module procedure HDF5_write_int3 @@ -63,6 +63,10 @@ module HDF5_utilities module procedure HDF5_write_int5 module procedure HDF5_write_int6 module procedure HDF5_write_int7 +#else + module procedure HDF5_write_real + module procedure HDF5_write_int +#endif end interface HDF5_write !-------------------------------------------------------------------------------------------------- @@ -1210,6 +1214,7 @@ subroutine HDF5_read_int7(dataset,loc_id,datasetName,parallel) end subroutine HDF5_read_int7 +#if defined(__GFORTRAN__) && __GNUC__<11 !-------------------------------------------------------------------------------------------------- !> @brief write dataset of type real with 1 dimension @@ -1499,6 +1504,71 @@ subroutine HDF5_write_real7(dataset,loc_id,datasetName,parallel) end subroutine HDF5_write_real7 +#else + +!-------------------------------------------------------------------------------------------------- +!> @brief write dataset of type real with 1-7 dimension +!-------------------------------------------------------------------------------------------------- +subroutine HDF5_write_real(dataset,loc_id,datasetName,parallel) + + real(pReal), intent(in), dimension(..) :: dataset !< data written to file + integer(HID_T), intent(in) :: loc_id !< file or group handle + character(len=*), intent(in) :: datasetName !< name of the dataset in the file + logical, intent(in), optional :: parallel !< dataset is distributed over multiple processes + + + integer :: hdferr + integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id + integer(HSIZE_T), dimension(rank(dataset)) :: & + myStart, & + myShape, & !< shape of the dataset (this process) + totalShape !< shape of the dataset (all processes) + +!--------------------------------------------------------------------------------------------------- +! determine shape of dataset + myShape = int(shape(dataset),HSIZE_T) + if (any(myShape(1:size(myShape)-1) == 0)) return !< empty dataset (last dimension can be empty) + + if (present(parallel)) then + call initialize_write(dset_id, filespace_id, memspace_id, plist_id, & + myStart, totalShape,loc_id,myShape,datasetName,H5T_NATIVE_DOUBLE,parallel) + else + call initialize_write(dset_id, filespace_id, memspace_id, plist_id, & + myStart, totalShape,loc_id,myShape,datasetName,H5T_NATIVE_DOUBLE,parallel_default) + end if + + if (product(totalShape) /= 0) then + select rank(dataset) + rank (1) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank (2) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank (3) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank (4) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank (5) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank (6) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank (7) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + end select + if(hdferr < 0) error stop 'HDF5 error' + end if + + call finalize_write(plist_id, dset_id, filespace_id, memspace_id) + +end subroutine HDF5_write_real +#endif + !-------------------------------------------------------------------------------------------------- !> @brief Write dataset of type string (scalar). @@ -1561,6 +1631,7 @@ subroutine HDF5_write_str(dataset,loc_id,datasetName) end subroutine HDF5_write_str +#if defined(__GFORTRAN__) && __GNUC__<11 !-------------------------------------------------------------------------------------------------- !> @brief write dataset of type integer with 1 dimension @@ -1849,6 +1920,70 @@ subroutine HDF5_write_int7(dataset,loc_id,datasetName,parallel) end subroutine HDF5_write_int7 +#else + +!-------------------------------------------------------------------------------------------------- +!> @brief write dataset of type integer with 1-7 dimension +!-------------------------------------------------------------------------------------------------- +subroutine HDF5_write_int(dataset,loc_id,datasetName,parallel) + + integer, intent(in), dimension(..) :: dataset !< data written to file + integer(HID_T), intent(in) :: loc_id !< file or group handle + character(len=*), intent(in) :: datasetName !< name of the dataset in the file + logical, intent(in), optional :: parallel !< dataset is distributed over multiple processes + + + integer :: hdferr + integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id + integer(HSIZE_T), dimension(rank(dataset)) :: & + myStart, & + myShape, & !< shape of the dataset (this process) + totalShape !< shape of the dataset (all processes) + +!--------------------------------------------------------------------------------------------------- +! determine shape of dataset + myShape = int(shape(dataset),HSIZE_T) + if (any(myShape(1:size(myShape)-1) == 0)) return !< empty dataset (last dimension can be empty) + + if (present(parallel)) then + call initialize_write(dset_id, filespace_id, memspace_id, plist_id, & + myStart, totalShape, loc_id,myShape,datasetName,H5T_NATIVE_INTEGER,parallel) + else + call initialize_write(dset_id, filespace_id, memspace_id, plist_id, & + myStart, totalShape, loc_id,myShape,datasetName,H5T_NATIVE_INTEGER,parallel_default) + end if + + if (product(totalShape) /= 0) then + select rank(dataset) + rank(1) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank(2) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank(3) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank(4) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank(5) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank(6) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank(7) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + end select + if(hdferr < 0) error stop 'HDF5 error' + end if + + call finalize_write(plist_id, dset_id, filespace_id, memspace_id) + +end subroutine HDF5_write_int +#endif !-------------------------------------------------------------------------------------------------- !> @brief initialize HDF5 handles, determines global shape and start for parallel read From b796ccb04a3b2e3e0ffac0f74f31d8c5b2ff1553 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 18 Apr 2022 13:18:14 +0200 Subject: [PATCH 018/142] DAMASK requires gfortran >= 9 --- src/rotations.f90 | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/rotations.f90 b/src/rotations.f90 index 53f1fe976..7aa81fcab 100644 --- a/src/rotations.f90 +++ b/src/rotations.f90 @@ -658,11 +658,7 @@ function om2ax(om) result(ax) else call dgeev('N','V',3,om_,3,Wr,Wi,devNull,3,VR,3,work,size(work,1),ierr) if (ierr /= 0) error stop 'LAPACK error' -#if defined(__GFORTRAN__) && __GNUC__<9 - i = maxloc(merge(1,0,cEq(cmplx(Wr,Wi,pReal),cmplx(1.0_pReal,0.0_pReal,pReal),tol=1.0e-14_pReal)),dim=1) -#else i = findloc(cEq(cmplx(Wr,Wi,pReal),cmplx(1.0_pReal,0.0_pReal,pReal),tol=1.0e-14_pReal),.true.,dim=1) !find eigenvalue (1,0) -#endif if (i == 0) error stop 'om2ax conversion failed' ax(1:3) = VR(1:3,i) where ( dNeq0([om(2,3)-om(3,2), om(3,1)-om(1,3), om(1,2)-om(2,1)])) & @@ -1427,10 +1423,6 @@ subroutine selfTest() do i = 1, 20 -#if defined(__GFORTRAN__) && __GNUC__<9 - if(i<7) cycle -#endif - if(i==1) then qu = om2qu(math_I3) elseif(i==2) then From 4a93dbec117cbb0092ddc8f33e1a5cbe00097d2b Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 19 Apr 2022 13:11:40 -0400 Subject: [PATCH 019/142] more descriptive variable names --- src/material.f90 | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/material.f90 b/src/material.f90 index 7264738e5..2258c40a1 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -95,9 +95,9 @@ subroutine parse() integer, dimension(:), allocatable :: & counterPhase, & counterHomogenization, & - temp_ho - integer, dimension(:,:), allocatable :: temp_ph - real(pReal), dimension(:,:), allocatable :: temp_v + ho_of + integer, dimension(:,:), allocatable :: ph_of + real(pReal), dimension(:,:), allocatable :: v_of real(pReal) :: v integer :: & @@ -135,9 +135,9 @@ subroutine parse() allocate(material_O_0(materials%length)) allocate(material_F_i_0(materials%length)) - allocate(temp_ho(materials%length)) - allocate(temp_ph(materials%length,homogenization_maxNconstituents),source=-1) - allocate(temp_v(materials%length,homogenization_maxNconstituents),source=0.0_pReal) + allocate(ho_of(materials%length)) + allocate(ph_of(materials%length,homogenization_maxNconstituents),source=-1) + allocate( v_of(materials%length,homogenization_maxNconstituents),source=0.0_pReal) ! parse YAML structure select type(materials) @@ -147,10 +147,10 @@ subroutine parse() item => materials%first do ma = 1, materials%length material => item%node - temp_ho(ma) = homogenizations%getIndex(material%get_asString('homogenization')) + ho_of(ma) = homogenizations%getIndex(material%get_asString('homogenization')) constituents => material%get('constituents') - homogenization => homogenizations%get(temp_ho(ma)) + homogenization => homogenizations%get(ho_of(ma)) if (constituents%length /= homogenization%get_asInt('N_constituents')) call IO_error(148) allocate(material_O_0(ma)%data(constituents%length)) @@ -158,14 +158,14 @@ subroutine parse() do co = 1, constituents%length constituent => constituents%get(co) - temp_v(ma,co) = constituent%get_asFloat('v') - temp_ph(ma,co) = phases%getIndex(constituent%get_asString('phase')) + v_of(ma,co) = constituent%get_asFloat('v') + ph_of(ma,co) = phases%getIndex(constituent%get_asString('phase')) call material_O_0(ma)%data(co)%fromQuaternion(constituent%get_as1dFloat('O',requiredSize=4)) material_F_i_0(ma)%data(1:3,1:3,co) = constituent%get_as2dFloat('F_i',defaultVal=math_I3,requiredShape=[3,3]) end do - if (dNeq(sum(temp_v(ma,:)),1.0_pReal,1.e-9_pReal)) call IO_error(153,ext_msg='constituent') + if (dNeq(sum(v_of(ma,:)),1.0_pReal,1.e-9_pReal)) call IO_error(153,ext_msg='constituent') item => item%next end do @@ -187,7 +187,7 @@ subroutine parse() do el = 1, discretization_Nelems ma = discretization_materialAt(el) - ho = temp_ho(ma) + ho = ho_of(ma) do ip = 1, discretization_nIPs ce = (el-1)*discretization_nIPs + ip @@ -196,10 +196,10 @@ subroutine parse() material_homogenizationEntry(ce) = counterHomogenization(ho) end do - do co = 1, size(temp_ph(ma,:)>0) + do co = 1, size(ph_of(ma,:)>0) - v = temp_v(ma,co) - ph = temp_ph(ma,co) + v = v_of(ma,co) + ph = ph_of(ma,co) do ip = 1, discretization_nIPs ce = (el-1)*discretization_nIPs + ip From 9e2fcfc9df47b1fb3fdb2a89fdcb5c8c540f3e81 Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 20 Apr 2022 05:24:57 +0200 Subject: [PATCH 020/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-210-ge8c1f8453 --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index 7ce9e687d..c2c4f8316 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha6-206-g51582b80f +v3.0.0-alpha6-210-ge8c1f8453 From df3f4d9480524dc84a815f3149354d2c235fd0f5 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 20 Apr 2022 07:00:02 +0200 Subject: [PATCH 021/142] testing forward/backward FFT --- src/grid/spectral_utilities.f90 | 39 ++++++++++++++++++++++++++++++++- src/prec.f90 | 6 ++--- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/grid/spectral_utilities.f90 b/src/grid/spectral_utilities.f90 index 525f68d7e..3f7c32668 100644 --- a/src/grid/spectral_utilities.f90 +++ b/src/grid/spectral_utilities.f90 @@ -142,7 +142,7 @@ contains !> level chosen. !> Initializes FFTW. !-------------------------------------------------------------------------------------------------- -subroutine spectral_utilities_init +subroutine spectral_utilities_init() PetscErrorCode :: err_PETSc integer :: i, j, k, & @@ -1146,4 +1146,41 @@ subroutine utilities_saveReferenceStiffness end subroutine utilities_saveReferenceStiffness + +!-------------------------------------------------------------------------------------------------- +!> @brief Check correctness of forward-backward transform. +!-------------------------------------------------------------------------------------------------- +subroutine selfTest() + + real(pReal), allocatable, dimension(:,:,:,:,:) :: tensorField_real_ + real(pReal), allocatable, dimension(:,:,:,:) :: vectorField_real_ + real(pReal), allocatable, dimension(:,:,:) :: scalarField_real_ + + + call random_number(tensorField_real) + tensorField_real(1:3,1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal + tensorField_real_ = tensorField_real + call utilities_FFTtensorForward() + call utilities_FFTtensorBackward() + tensorField_real(1:3,1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal + if (maxval(abs(tensorField_real_ - tensorField_real))>1.0e-15_pReal) error stop 'tensorField' + + call random_number(vectorField_real) + vectorField_real(1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal + vectorField_real_ = vectorField_real + call utilities_FFTvectorForward() + call utilities_FFTvectorBackward() + vectorField_real(1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal + if (maxval(abs(vectorField_real_ - vectorField_real))>1.0e-15_pReal) error stop 'vectorField' + + call random_number(scalarField_real) + scalarField_real(cells(1)+1:cells1Red*2,:,:) = 0.0_pReal + scalarField_real_ = scalarField_real + call utilities_FFTscalarForward() + call utilities_FFTscalarBackward() + scalarField_real(cells(1)+1:cells1Red*2,:,:) = 0.0_pReal + if (maxval(abs(scalarField_real_ - scalarField_real))>1.0e-15_pReal) error stop 'scalarField' + +end subroutine selfTest + end module spectral_utilities diff --git a/src/prec.f90 b/src/prec.f90 index d0753790e..73563d4f2 100644 --- a/src/prec.f90 +++ b/src/prec.f90 @@ -48,7 +48,7 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief Report precision and do self test. !-------------------------------------------------------------------------------------------------- -subroutine prec_init +subroutine prec_init() print'(/,1x,a)', '<<<+- prec init -+>>>' @@ -60,7 +60,7 @@ subroutine prec_init print'( a,e10.3)', ' epsilon value: ',PREAL_EPSILON print'( a,i3)', ' decimal precision: ',precision(0.0_pReal) - call selfTest + call selfTest() end subroutine prec_init @@ -245,7 +245,7 @@ end function prec_bytesToC_INT64_T !-------------------------------------------------------------------------------------------------- !> @brief Check correctness of some prec functions. !-------------------------------------------------------------------------------------------------- -subroutine selfTest +subroutine selfTest() integer, allocatable, dimension(:) :: realloc_lhs_test real(pReal), dimension(1) :: f From d6f2b99199a770512634544f018d1ed451b0d75d Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 20 Apr 2022 10:02:55 +0200 Subject: [PATCH 022/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-221-gdff78154a --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index c2c4f8316..b96558745 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha6-210-ge8c1f8453 +v3.0.0-alpha6-221-gdff78154a From d916c7c6b19da5c83af152d81571a42e872845b2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 21 Apr 2022 17:32:30 +0200 Subject: [PATCH 023/142] small polishing --- PRIVATE | 2 +- python/damask/_grid.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PRIVATE b/PRIVATE index f6a94aeaa..e3d9c0cc3 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit f6a94aeaaa3a81347821e7a092d43dd04115f5f6 +Subproject commit e3d9c0cc3ffa1435003f934a0f0e6c7d969a022a diff --git a/python/damask/_grid.py b/python/damask/_grid.py index 6dc9879ce..d4a7ea02f 100644 --- a/python/damask/_grid.py +++ b/python/damask/_grid.py @@ -292,7 +292,7 @@ class Grid: >>> import damask >>> N_grains = 20 >>> cells = (32,32,32) - >>> damask.util.run(f'neper -T -n {N_grains} -tesrsize {cells[0]}:{cells[1]}:{cells[2]} -periodicity "all" -format "vtk"') + >>> damask.util.run(f'neper -T -n {N_grains} -tesrsize {cells[0]}:{cells[1]}:{cells[2]} -periodicity all -format vtk') >>> damask.Grid.load_Neper(f'n{N_grains}-id1.vtk') cells: 32 × 32 × 32 size: 1.0 × 1.0 × 1.0 m³ From 730bd8ae34a951190ed95805ac653aeb807d54f1 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 21 Apr 2022 11:50:00 -0400 Subject: [PATCH 024/142] globally defined prefix_inc --> "increment_" --- python/damask/_result.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index fcfb44ecb..893e19197 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -26,6 +26,7 @@ from . import util h5py3 = h5py.__version__[0] == '3' chunk_size = 1024**2//8 # for compression in HDF5 +prefix_inc = 'increment_' def _read(dataset): """Read a dataset and its metadata into a numpy.ndarray.""" @@ -112,7 +113,7 @@ class Result: else: self.add_curl = self.add_divergence = self.add_gradient = None - r = re.compile(r'increment_([0-9]+)') + r = re.compile(rf'{prefix_inc}([0-9]+)') self.incs = sorted([int(m.group(1)) for i in f.keys() for m in (r.match(i),) if m]) self.times = [round(f[i].attrs['t/s'],12) for i in self.increments] if len(self.incs) == 0: @@ -207,9 +208,9 @@ class Result: [datasets] if what == 'increments': - choice = [c if isinstance(c,str) and c.startswith('increment_') else + choice = [c if isinstance(c,str) and c.startswith(prefix_inc) else self.increments[c] if isinstance(c,int) and c<0 else - f'increment_{c}' for c in choice] + f'{prefix_inc}{c}' for c in choice] elif what == 'times': what = 'increments' if choice == ['*']: @@ -257,7 +258,7 @@ class Result: Increment number of all increments within the given bounds. """ - s,e = map(lambda x: int(x[10:] if isinstance(x,str) and x.startswith('increment_') else x), + s,e = map(lambda x: int(x[10:] if isinstance(x,str) and x.startswith(prefix_inc) else x), (self.incs[ 0] if start is None else start, self.incs[-1] if end is None else end)) return [i for i in self.incs if s <= i <= e] @@ -541,7 +542,7 @@ class Result: @property def increments(self): - return list(map(lambda i:f'increment_{i}',self.incs)) + return [f'{prefix_inc}{i}' for i in self.incs] @property From b5f9d524d7c5199e20599e65b23a4d59c00d801f Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 21 Apr 2022 15:56:17 -0400 Subject: [PATCH 025/142] optional start,end in times_in_range --- python/damask/_result.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index 893e19197..e6de645cd 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -263,28 +263,26 @@ class Result: self.incs[-1] if end is None else end)) return [i for i in self.incs if s <= i <= e] - def times_in_range(self,start,end): + def times_in_range(self,start=None,end=None): """ Get all increments within a given time range. Parameters ---------- - start : float - Time of start increment. - end : float - Time of end increment. + start : float, optional + Time of start increment. Defaults to first. + end : float, optional + Time of end increment. Defaults to last. Returns ------- times : list of float - Simulation time of all increments within the given bounds. + Time of each increment within the given bounds. """ - selected = [] - for i,time in enumerate(self.times): - if start <= time <= end: - selected.append(self.times[i]) - return selected + s,e = (self.times[ 0] if start is None else start, + self.times[-1] if end is None else end) + return [t for t in self.times if s <= t <= e] def view(self,*, From 8e668a565ec500007adabccf06fdad5d4afbf5a1 Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 21 Apr 2022 21:58:03 +0200 Subject: [PATCH 026/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-223-gd916c7c6b --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index b96558745..f5c5e0426 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha6-221-gdff78154a +v3.0.0-alpha6-223-gd916c7c6b From fa58d69cbb6bed4326b9aa28acf4fcd656f6d2ff Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 21 Apr 2022 17:29:33 -0400 Subject: [PATCH 027/142] switched "master" property from incs to increments --- python/damask/_result.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index e6de645cd..b8e025350 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -114,7 +114,8 @@ class Result: self.add_curl = self.add_divergence = self.add_gradient = None r = re.compile(rf'{prefix_inc}([0-9]+)') - self.incs = sorted([int(m.group(1)) for i in f.keys() for m in (r.match(i),) if m]) + self.increments = [f'{prefix_inc}{i}' + for i in sorted([int(m.group(1)) for i in f.keys() for m in (r.match(i),) if m])] self.times = [round(f[i].attrs['t/s'],12) for i in self.increments] if len(self.incs) == 0: raise ValueError('incomplete DADF5 file') @@ -539,8 +540,8 @@ class Result: @property - def increments(self): - return [f'{prefix_inc}{i}' for i in self.incs] + def incs(self): + return [int(i.split(prefix_inc)[-1]) for i in self.increments] @property From 197e24ec0ddd09b7cd7d246d10347596705a6e93 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 21 Apr 2022 18:00:58 -0400 Subject: [PATCH 028/142] pass-through ICs when grid remains unaltered --- python/damask/_grid.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/python/damask/_grid.py b/python/damask/_grid.py index 7fc303d16..3a1efab80 100644 --- a/python/damask/_grid.py +++ b/python/damask/_grid.py @@ -654,7 +654,7 @@ class Grid: origin: 0.0 0.0 0.0 m # materials: 2 - Minimal surface of 'Neovius' type. non-default material IDs. + Minimal surface of 'Neovius' type with non-default material IDs. >>> import numpy as np >>> import damask @@ -984,6 +984,7 @@ class Grid: return Grid(material = renumbered.reshape(self.cells), size = self.size, origin = self.origin, + initial_conditions = self.initial_conditions, comments = self.comments+[util.execution_stamp('Grid','renumber')], ) @@ -1015,6 +1016,7 @@ class Grid: return Grid(material = material, size = self.size, origin = self.origin, + initial_conditions = self.initial_conditions, comments = self.comments+[util.execution_stamp('Grid','substitute')], ) @@ -1037,6 +1039,7 @@ class Grid: return Grid(material = ma.reshape(self.cells,order='F'), size = self.size, origin = self.origin, + initial_conditions = self.initial_conditions, comments = self.comments+[util.execution_stamp('Grid','sort')], ) @@ -1104,6 +1107,7 @@ class Grid: return Grid(material = material, size = self.size, origin = self.origin, + initial_conditions = self.initial_conditions, comments = self.comments+[util.execution_stamp('Grid','clean')], ) @@ -1196,6 +1200,7 @@ class Grid: np.nanmax(self.material)+1 if fill is None else fill), size = self.size, origin = self.origin, + initial_conditions = self.initial_conditions, comments = self.comments+[util.execution_stamp('Grid','add_primitive')], ) @@ -1258,6 +1263,7 @@ class Grid: return Grid(material = np.where(mask, self.material + offset_,self.material), size = self.size, origin = self.origin, + initial_conditions = self.initial_conditions, comments = self.comments+[util.execution_stamp('Grid','vicinity_offset')], ) From 745f5348cd0bc4c816cfb694cc9c1b7bac9f5302 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 22 Apr 2022 00:01:54 +0200 Subject: [PATCH 029/142] running new tests --- src/grid/spectral_utilities.f90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/grid/spectral_utilities.f90 b/src/grid/spectral_utilities.f90 index 3f7c32668..8e7da7647 100644 --- a/src/grid/spectral_utilities.f90 +++ b/src/grid/spectral_utilities.f90 @@ -350,6 +350,8 @@ subroutine spectral_utilities_init() allocate (gamma_hat(3,3,3,3,cells1Red,cells(2),cells3), source = cmplx(0.0_pReal,0.0_pReal,pReal)) endif + call selfTest() + end subroutine spectral_utilities_init From 690b2e9c21c2dbcaf8725666a7c6fe51cba116ff Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 22 Apr 2022 07:18:53 +0200 Subject: [PATCH 030/142] tolerances were to strict for certain operations --- src/grid/spectral_utilities.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/grid/spectral_utilities.f90 b/src/grid/spectral_utilities.f90 index 8e7da7647..4375ec860 100644 --- a/src/grid/spectral_utilities.f90 +++ b/src/grid/spectral_utilities.f90 @@ -1165,7 +1165,7 @@ subroutine selfTest() call utilities_FFTtensorForward() call utilities_FFTtensorBackward() tensorField_real(1:3,1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal - if (maxval(abs(tensorField_real_ - tensorField_real))>1.0e-15_pReal) error stop 'tensorField' + if (maxval(abs(tensorField_real_ - tensorField_real))>5.0e-15_pReal) error stop 'tensorField' call random_number(vectorField_real) vectorField_real(1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal @@ -1173,7 +1173,7 @@ subroutine selfTest() call utilities_FFTvectorForward() call utilities_FFTvectorBackward() vectorField_real(1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal - if (maxval(abs(vectorField_real_ - vectorField_real))>1.0e-15_pReal) error stop 'vectorField' + if (maxval(abs(vectorField_real_ - vectorField_real))>5.0e-15_pReal) error stop 'vectorField' call random_number(scalarField_real) scalarField_real(cells(1)+1:cells1Red*2,:,:) = 0.0_pReal @@ -1181,7 +1181,7 @@ subroutine selfTest() call utilities_FFTscalarForward() call utilities_FFTscalarBackward() scalarField_real(cells(1)+1:cells1Red*2,:,:) = 0.0_pReal - if (maxval(abs(scalarField_real_ - scalarField_real))>1.0e-15_pReal) error stop 'scalarField' + if (maxval(abs(scalarField_real_ - scalarField_real))>5.0e-15_pReal) error stop 'scalarField' end subroutine selfTest From 1733c121f3c0d1c24abe952d8c1fad70a3e3515a Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 22 Apr 2022 11:29:47 -0400 Subject: [PATCH 031/142] allow scalar initial_conditions --> on-the-fly broadcasting --- python/damask/_grid.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/damask/_grid.py b/python/damask/_grid.py index 3a1efab80..6a432e7f5 100644 --- a/python/damask/_grid.py +++ b/python/damask/_grid.py @@ -3,6 +3,7 @@ import copy import warnings import multiprocessing as mp from functools import partial +import collections import typing from typing import Union, Optional, TextIO, List, Sequence, Dict from pathlib import Path @@ -149,11 +150,15 @@ class Grid: @property def initial_conditions(self) -> Dict[str,np.ndarray]: """Fields of initial conditions.""" + self._ic = dict(zip(self._ic.keys(), + [v if isinstance(v, collections.Sequence) else + np.broadcast_to(v,self.cells) for v in self._ic.values()])) return self._ic @initial_conditions.setter def initial_conditions(self, ic: Dict[str,np.ndarray]): + if not isinstance(ic,dict): raise TypeError('initial conditions is not a dictionary') From 06fccc6125bb4ecc6aa097aeec723023ad53bc5b Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 22 Apr 2022 11:30:30 -0400 Subject: [PATCH 032/142] updated test for scalar initial condition --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index baf29e653..002586968 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit baf29e6530eb10083642fd02d4ec59a1c6586591 +Subproject commit 0025869684c70a0ea9afe0b181a48124ce4d6a9e From 5d12ef5b9f0c59ec9203c32b1c6f5c2b70ffdfba Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 22 Apr 2022 18:07:42 +0200 Subject: [PATCH 033/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-228-g758ad6072 --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index f5c5e0426..f8dcddc79 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha6-223-gd916c7c6b +v3.0.0-alpha6-228-g758ad6072 From 1b1eb824c41c78c4fdcc50525a4d4e713b0ccbc9 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 22 Apr 2022 18:26:52 +0200 Subject: [PATCH 034/142] better readable --- python/damask/_result.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index 5ad9454e9..b5f08a87d 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -114,10 +114,9 @@ class Result: self.add_curl = self.add_divergence = self.add_gradient = None r = re.compile(rf'{prefix_inc}([0-9]+)') - self.increments = [f'{prefix_inc}{i}' - for i in sorted([int(m.group(1)) for i in f.keys() for m in (r.match(i),) if m])] + self.increments = sorted([i for i in f.keys() if r.match(i)],key=util.natural_sort) self.times = [round(f[i].attrs['t/s'],12) for i in self.increments] - if len(self.incs) == 0: + if len(self.increments) == 0: raise ValueError('incomplete DADF5 file') self.N_materialpoints, self.N_constituents = np.shape(f['cell_to/phase']) From 61265ff994547ca5b32c37b59e09a5eb8973c175 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 22 Apr 2022 13:39:23 -0400 Subject: [PATCH 035/142] make mypy happy... --- python/damask/_grid.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/python/damask/_grid.py b/python/damask/_grid.py index 6a432e7f5..6b5da947c 100644 --- a/python/damask/_grid.py +++ b/python/damask/_grid.py @@ -3,7 +3,6 @@ import copy import warnings import multiprocessing as mp from functools import partial -import collections import typing from typing import Union, Optional, TextIO, List, Sequence, Dict from pathlib import Path @@ -150,15 +149,14 @@ class Grid: @property def initial_conditions(self) -> Dict[str,np.ndarray]: """Fields of initial conditions.""" - self._ic = dict(zip(self._ic.keys(), - [v if isinstance(v, collections.Sequence) else - np.broadcast_to(v,self.cells) for v in self._ic.values()])) + self._ic = dict(zip(self._ic.keys(), # type: ignore + [v if isinstance(v,np.ndarray) else + np.broadcast_to(v,self.cells) for v in self._ic.values()])) # type: ignore return self._ic @initial_conditions.setter def initial_conditions(self, ic: Dict[str,np.ndarray]): - if not isinstance(ic,dict): raise TypeError('initial conditions is not a dictionary') From 6ec543d08603b3c47fa681b73fa534e8bcf9ca8a Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 22 Apr 2022 14:27:03 -0400 Subject: [PATCH 036/142] merge development --- .github/workflows/Fortran.yml | 2 +- .github/workflows/Python.yml | 12 +- CMakeLists.txt | 30 +++- README | 13 -- README.md | 15 ++ .../2020/Marc_tools/include_linux64.patch | 2 +- .../2021.2/Marc_tools/include_linux64.patch | 2 +- .../2021.3.1/Marc_tools/include_linux64.patch | 2 +- python/damask/VERSION | 2 +- python/damask/_colormap.py | 8 +- python/damask/_config.py | 11 +- python/damask/_grid.py | 8 +- python/damask/_result.py | 8 +- python/damask/_table.py | 9 +- python/damask/grid_filters.py | 8 +- python/damask/util.py | 27 +++- python/tests/test_ConfigMaterial.py | 2 + python/tests/test_Grid.py | 3 + python/tests/test_Result.py | 2 +- python/tests/test_VTK.py | 2 + python/tests/test_util.py | 29 ++-- src/C_routines.c | 29 +++- src/DAMASK_interface.f90 | 2 +- src/HDF5_utilities.f90 | 137 +++++++++++++++++- src/IO.f90 | 4 +- src/VTI.f90 | 7 +- src/YAML_parse.f90 | 80 ++++++++-- src/YAML_types.f90 | 19 ++- src/grid/spectral_utilities.f90 | 41 +++++- src/material.f90 | 112 +++++++------- src/mesh/discretization_mesh.f90 | 4 + src/prec.f90 | 6 +- src/rotations.f90 | 8 - src/system_routines.f90 | 80 +++++----- 34 files changed, 521 insertions(+), 205 deletions(-) delete mode 100644 README create mode 100644 README.md diff --git a/.github/workflows/Fortran.yml b/.github/workflows/Fortran.yml index 5cc241e00..d93cdd27f 100644 --- a/.github/workflows/Fortran.yml +++ b/.github/workflows/Fortran.yml @@ -2,7 +2,7 @@ name: Grid and Mesh Solver on: [push] env: - PETSC_VERSION: '3.16.2' + PETSC_VERSION: '3.17.0' HOMEBREW_NO_ANALYTICS: 'ON' # Make Homebrew installation a little quicker HOMEBREW_NO_AUTO_UPDATE: 'ON' HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: 'ON' diff --git a/.github/workflows/Python.yml b/.github/workflows/Python.yml index b3d714f92..3b6bb0df4 100644 --- a/.github/workflows/Python.yml +++ b/.github/workflows/Python.yml @@ -10,7 +10,8 @@ jobs: strategy: matrix: python-version: ['3.8', '3.9'] #, '3.10'] - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-latest, windows-latest] + fail-fast: false steps: - uses: actions/checkout@v2 @@ -25,11 +26,18 @@ jobs: python -m pip install --upgrade pip pip install pytest pandas scipy h5py vtk matplotlib pyyaml - - name: Install and run unit tests + - name: Install and run unit tests (Unix) + if: runner.os != 'Windows' run: | python -m pip install ./python --no-deps -vv --use-feature=in-tree-build COLUMNS=256 pytest python + - name: Install and run unit tests (Windows) + if: runner.os == 'Windows' + run: | + python -m pip install ./python --no-deps -vv --use-feature=in-tree-build + pytest python -k 'not XDMF' + apt: runs-on: ubuntu-latest diff --git a/CMakeLists.txt b/CMakeLists.txt index b4c405319..6b341dbbe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,8 +9,10 @@ endif() # Dummy project to determine compiler names and version project(Prerequisites LANGUAGES) -set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig") -pkg_check_modules(PETSC REQUIRED PETSc>=3.12.0 PETSc<3.17.0) +set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}") +pkg_check_modules(PETSC_MIN REQUIRED PETSc>=3.12.0 QUIET) #CMake does not support version range +pkg_check_modules(PETSC REQUIRED PETSc<3.18.0) + pkg_get_variable(CMAKE_Fortran_COMPILER PETSc fcompiler) pkg_get_variable(CMAKE_C_COMPILER PETSc ccompiler) @@ -25,6 +27,13 @@ else() endif() add_definitions("-D${DAMASK_SOLVER}") +# EXPERIMENTAL: This might help to detect HDF5 and FFTW3 in the future if PETSc is not aware of them +set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/externalpackages:$ENV{PKG_CONFIG_PATH}") +pkg_check_modules(HDF5 hdf5) +pkg_check_modules(FFTW3 fftw3) +pkg_check_modules(fYAML libfyaml) +pkg_check_modules(zlib zlib) + file(STRINGS ${PROJECT_SOURCE_DIR}/VERSION DAMASK_VERSION) message("\nBuilding ${CMAKE_PROJECT_NAME} ${DAMASK_VERSION}\n") @@ -32,6 +41,9 @@ message("\nBuilding ${CMAKE_PROJECT_NAME} ${DAMASK_VERSION}\n") add_definitions(-DPETSC) add_definitions(-DDAMASKVERSION="${DAMASK_VERSION}") add_definitions(-DCMAKE_SYSTEM="${CMAKE_SYSTEM}") +if(PETSC_VERSION VERSION_GREATER_EQUAL 3.17.0) + add_definitions("-DCHKERRQ=PetscCall") +endif() if(CMAKE_BUILD_TYPE STREQUAL "") set(CMAKE_BUILD_TYPE "RELEASE") @@ -104,8 +116,18 @@ if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") set(CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} ${DEBUG_FLAGS}") endif() -set(CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}} ${PETSC_INCLUDES} ${BUILDCMD_POST}") -set(CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} -o -L${PETSC_LIBRARY_DIRS} -lpetsc ${PETSC_EXTERNAL_LIB} -lz ${BUILDCMD_POST}") +set(CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}} ${PETSC_INCLUDES} ${BUILDCMD_POST}") + +set(CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} -o -L${PETSC_LIBRARY_DIRS} -lpetsc ${PETSC_EXTERNAL_LIB} -lz") + +if(fYAML_FOUND STREQUAL "1") + set(CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} -L${fYAML_LIBRARY_DIRS} -l${fYAML_LIBRARIES}") + add_definitions(-DFYAML) + pkg_get_variable(fYAML_INCLUDE_DIR libfyaml includedir) # fYAML_INCLUDE_DIRS and fYAML_CFLAGS are not working + set(CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}} -I${fYAML_INCLUDE_DIR}") +endif() + +set(CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} ${BUILDCMD_POST}") message("Fortran Compiler Flags:\n${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}}\n") message("C Compiler Flags:\n${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}}\n") diff --git a/README b/README deleted file mode 100644 index 543de378f..000000000 --- a/README +++ /dev/null @@ -1,13 +0,0 @@ -DAMASK - The Düsseldorf Advanced Material Simulation Kit -Visit damask.mpie.de for installation and usage instructions - -CONTACT INFORMATION - -Max-Planck-Institut für Eisenforschung GmbH -Max-Planck-Str. 1 -40237 Düsseldorf -Germany - -damask@mpie.de -https://damask.mpie.de -https://git.damask.mpie.de diff --git a/README.md b/README.md new file mode 100644 index 000000000..5b5edf677 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# DAMASK - The Düsseldorf Advanced Material Simulation Kit + +Visit [damask.mpie.de](https://damask.mpie.de) for installation and usage instructions + +## Contact Information + +Max-Planck-Institut für Eisenforschung GmbH +Max-Planck-Str. 1 +40237 Düsseldorf +Germany + +damask@mpie.de +https://damask.mpie.de +https://git.damask.mpie.de + diff --git a/install/MarcMentat/2020/Marc_tools/include_linux64.patch b/install/MarcMentat/2020/Marc_tools/include_linux64.patch index 9849584fa..133ca07cb 100644 --- a/install/MarcMentat/2020/Marc_tools/include_linux64.patch +++ b/install/MarcMentat/2020/Marc_tools/include_linux64.patch @@ -8,7 +8,7 @@ +# DAMASK uses the HDF5 compiler wrapper around the Intel compiler +H5FC="$(h5fc -shlib -show)" +HDF5_LIB=${H5FC//ifort/} -+FCOMP="$H5FC -DDAMASK_HDF5" ++FCOMP="$H5FC" # AEM if test "$MARCDLLOUTDIR" = ""; then diff --git a/install/MarcMentat/2021.2/Marc_tools/include_linux64.patch b/install/MarcMentat/2021.2/Marc_tools/include_linux64.patch index 5ff02dae6..452618457 100644 --- a/install/MarcMentat/2021.2/Marc_tools/include_linux64.patch +++ b/install/MarcMentat/2021.2/Marc_tools/include_linux64.patch @@ -8,7 +8,7 @@ +# DAMASK uses the HDF5 compiler wrapper around the Intel compiler +H5FC="$(h5fc -shlib -show)" +HDF5_LIB=${H5FC//ifort/} -+FCOMP="$H5FC -DDAMASK_HDF5" ++FCOMP="$H5FC" # AEM if test "$MARCDLLOUTDIR" = ""; then diff --git a/install/MarcMentat/2021.3.1/Marc_tools/include_linux64.patch b/install/MarcMentat/2021.3.1/Marc_tools/include_linux64.patch index e1cc543c6..4adec9db1 100644 --- a/install/MarcMentat/2021.3.1/Marc_tools/include_linux64.patch +++ b/install/MarcMentat/2021.3.1/Marc_tools/include_linux64.patch @@ -7,7 +7,7 @@ +# DAMASK uses the HDF5 compiler wrapper around the Intel compiler +H5FC="$(h5fc -shlib -show)" +HDF5_LIB=${H5FC//ifort/} -+FCOMP="$H5FC -DDAMASK_HDF5" ++FCOMP="$H5FC" + # AEM if test "$MARCDLLOUTDIR" = ""; then diff --git a/python/damask/VERSION b/python/damask/VERSION index dcf64603b..f8dcddc79 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha6-170-gfab34d5c3 +v3.0.0-alpha6-228-g758ad6072 diff --git a/python/damask/_colormap.py b/python/damask/_colormap.py index b4d184786..5253e0acb 100644 --- a/python/damask/_colormap.py +++ b/python/damask/_colormap.py @@ -2,7 +2,6 @@ import os import json import functools import colorsys -from pathlib import Path from typing import Union, TextIO import numpy as np @@ -325,12 +324,7 @@ class Colormap(mpl.colors.ListedColormap): File handle with write access. """ - if fname is None: - return open(self.name.replace(' ','_')+suffix, 'w', newline='\n') - elif isinstance(fname, (str, Path)): - return open(Path(fname).expanduser(), 'w', newline='\n') - else: - return fname + return util.open_text(self.name.replace(' ','_')+suffix if fname is None else fname, 'w') def save_paraview(self, diff --git a/python/damask/_config.py b/python/damask/_config.py index 7adcee9df..6dd6a8328 100644 --- a/python/damask/_config.py +++ b/python/damask/_config.py @@ -2,7 +2,6 @@ import copy from io import StringIO from collections.abc import Iterable import abc -from pathlib import Path from typing import Union, Dict, Any, Type, TypeVar import numpy as np @@ -10,6 +9,7 @@ import yaml from ._typehints import FileHandle from . import Rotation +from . import util MyType = TypeVar('MyType', bound='Config') @@ -144,10 +144,7 @@ class Config(dict): Configuration from file. """ - fhandle = open(Path(fname).expanduser()) if isinstance(fname, (str, Path)) else \ - fname - - return cls(yaml.safe_load(fhandle)) + return cls(yaml.safe_load(util.open_text(fname))) def save(self, fname: FileHandle, @@ -163,9 +160,6 @@ class Config(dict): Keyword arguments parsed to yaml.dump. """ - fhandle = open(Path(fname).expanduser(),'w',newline='\n') if isinstance(fname, (str, Path)) else \ - fname - if 'width' not in kwargs: kwargs['width'] = 256 if 'default_flow_style' not in kwargs: @@ -173,6 +167,7 @@ class Config(dict): if 'sort_keys' not in kwargs: kwargs['sort_keys'] = False + fhandle = util.open_text(fname,'w') try: fhandle.write(yaml.dump(self,Dumper=NiceDumper,**kwargs)) except TypeError: # compatibility with old pyyaml diff --git a/python/damask/_grid.py b/python/damask/_grid.py index 6b5da947c..471ba36bd 100644 --- a/python/damask/_grid.py +++ b/python/damask/_grid.py @@ -314,7 +314,7 @@ class Grid: >>> import damask >>> N_grains = 20 >>> cells = (32,32,32) - >>> damask.util.run(f'neper -T -n {N_grains} -tesrsize {cells[0]}:{cells[1]}:{cells[2]} -periodicity "all" -format "vtk"') + >>> damask.util.run(f'neper -T -n {N_grains} -tesrsize {cells[0]}:{cells[1]}:{cells[2]} -periodicity all -format vtk') >>> damask.Grid.load_Neper(f'n{N_grains}-id1.vtk') cells: 32 × 32 × 32 size: 1.0 × 1.0 × 1.0 m³ @@ -786,8 +786,8 @@ class Grid: # materials: 1 """ - offset_ = np.array(offset,int) if offset is not None else np.zeros(3,int) - cells_ = np.array(cells,int) if cells is not None else self.cells + offset_ = np.array(offset,np.int64) if offset is not None else np.zeros(3,np.int64) + cells_ = np.array(cells,np.int64) if cells is not None else self.cells canvas = np.full(cells_,np.nanmax(self.material) + 1 if fill is None else fill,self.material.dtype) @@ -829,7 +829,7 @@ class Grid: >>> import numpy as np >>> import damask - >>> g = damask.Grid(np.zeros([32]*3,int), np.ones(3)*1e-4) + >>> g = damask.Grid(np.zeros([32]*3,int),np.ones(3)*1e-4) >>> g.mirror('xy',True) cells : 64 x 64 x 32 size : 0.0002 x 0.0002 x 0.0001 m³ diff --git a/python/damask/_result.py b/python/damask/_result.py index 227685b59..9195d2dd1 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -1151,14 +1151,14 @@ class Result: >>> import damask >>> r = damask.Result('my_file.hdf5') - >>> r.strain(t='U',m=0.5) + >>> r.add_strain(t='U',m=0.5) Add the plastic Euler-Almansi strain based on the plastic deformation gradient 'F_p': >>> import damask >>> r = damask.Result('my_file.hdf5') - >>> r.strain('F_p','V',-1) + >>> r.add_strain('F_p','V',-1) """ self._add_generic_pointwise(self._add_strain,{'F':F},{'t':t,'m':m}) @@ -1538,7 +1538,7 @@ class Result: np.prod(shape))} data_items[-1].text = f'{os.path.split(self.fname)[1]}:{name}' - with open(self.fname.with_suffix('.xdmf').name,'w',newline='\n') as f: + with util.open_text(self.fname.with_suffix('.xdmf').name,'w') as f: f.write(xml.dom.minidom.parseString(ET.tostring(xdmf).decode()).toprettyxml()) @@ -1803,7 +1803,7 @@ class Result: if type(obj) == h5py.Dataset and _match(output,[name]): d = obj.attrs['description'] if h5py3 else obj.attrs['description'].decode() if not Path(name).exists() or overwrite: - with open(name,'w') as f_out: f_out.write(obj[0].decode()) + with util.open_text(name,'w') as f_out: f_out.write(obj[0].decode()) print(f'Exported {d} to "{name}".') else: print(f'"{name}" exists, {d} not exported.') diff --git a/python/damask/_table.py b/python/damask/_table.py index 55342bd32..841842fc0 100644 --- a/python/damask/_table.py +++ b/python/damask/_table.py @@ -1,6 +1,5 @@ import re import copy -from pathlib import Path from typing import Union, Tuple, List import pandas as pd @@ -260,7 +259,7 @@ class Table: Table data from file. """ - f = open(Path(fname).expanduser()) if isinstance(fname, (str, Path)) else fname + f = util.open_text(fname) f.seek(0) comments = [] @@ -312,7 +311,7 @@ class Table: Table data from file. """ - f = open(fname) if isinstance(fname, (str, Path)) else fname + f = util.open_text(fname) f.seek(0) content = f.readlines() @@ -594,7 +593,7 @@ class Table: labels += [f'{util.srepr(self.shapes[l],"x")}:{i+1}_{l}' \ for i in range(np.prod(self.shapes[l]))] - f = open(Path(fname).expanduser(),'w',newline='\n') if isinstance(fname, (str, Path)) else fname + f = util.open_text(fname,'w') f.write('\n'.join([f'# {c}' for c in self.comments] + [' '.join(labels)])+('\n' if labels else '')) - self.data.to_csv(f,sep=' ',na_rep='nan',index=False,header=False) + self.data.to_csv(f,sep=' ',na_rep='nan',index=False,header=False,line_terminator='\n') diff --git a/python/damask/grid_filters.py b/python/damask/grid_filters.py index b6b907699..747fc629d 100644 --- a/python/damask/grid_filters.py +++ b/python/damask/grid_filters.py @@ -159,8 +159,8 @@ def coordinates0_point(cells: _IntSequence, """ size_ = _np.array(size,float) - start = origin + size_/_np.array(cells,int)*.5 - end = origin + size_ - size_/_np.array(cells,int)*.5 + start = origin + size_/_np.array(cells,_np.int64)*.5 + end = origin + size_ - size_/_np.array(cells,_np.int64)*.5 return _np.stack(_np.meshgrid(_np.linspace(start[0],end[0],cells[0]), _np.linspace(start[1],end[1],cells[1]), @@ -290,7 +290,7 @@ def cellsSizeOrigin_coordinates0_point(coordinates0: _np.ndarray, coords = [_np.unique(coordinates0[:,i]) for i in range(3)] mincorner = _np.array(list(map(min,coords))) maxcorner = _np.array(list(map(max,coords))) - cells = _np.array(list(map(len,coords)),int) + cells = _np.array(list(map(len,coords)),_np.int64) size = cells/_np.maximum(cells-1,1) * (maxcorner-mincorner) delta = size/cells origin = mincorner - delta*.5 @@ -455,7 +455,7 @@ def cellsSizeOrigin_coordinates0_node(coordinates0: _np.ndarray, coords = [_np.unique(coordinates0[:,i]) for i in range(3)] mincorner = _np.array(list(map(min,coords))) maxcorner = _np.array(list(map(max,coords))) - cells = _np.array(list(map(len,coords)),int) - 1 + cells = _np.array(list(map(len,coords)),_np.int64) - 1 size = maxcorner-mincorner origin = mincorner diff --git a/python/damask/util.py b/python/damask/util.py index a18fe9503..1ab58e8b6 100644 --- a/python/damask/util.py +++ b/python/damask/util.py @@ -10,20 +10,21 @@ import signal import fractions from collections import abc from functools import reduce, partial -from typing import Callable, Union, Iterable, Sequence, Dict, List, Tuple, Literal, Any, Collection +from typing import Callable, Union, Iterable, Sequence, Dict, List, Tuple, Literal, Any, Collection, TextIO from pathlib import Path import numpy as np import h5py from . import version -from ._typehints import FloatSequence, NumpyRngSeed, IntCollection +from ._typehints import FloatSequence, NumpyRngSeed, IntCollection, FileHandle # limit visibility __all__=[ 'srepr', 'emph', 'deemph', 'warn', 'strikeout', 'run', + 'open_text', 'natural_sort', 'show_progress', 'scale_to_coprime', @@ -206,7 +207,25 @@ def run(cmd: str, return stdout, stderr -execute = run +def open_text(fname: FileHandle, + mode: Literal['r','w'] = 'r') -> TextIO: + """ + Open a text file. + + Parameters + ---------- + fname : file, str, or pathlib.Path + Name or handle of file. + mode: {'r','w'}, optional + Access mode: 'r'ead or 'w'rite, defaults to 'r'. + + Returns + ------- + f : file handle + + """ + return fname if not isinstance(fname, (str,Path)) else \ + open(Path(fname).expanduser(),mode,newline=('\n' if mode == 'w' else None)) def natural_sort(key: str) -> List[Union[int, str]]: @@ -431,7 +450,7 @@ def hybrid_IA(dist: np.ndarray, scale_,scale,inc_factor = (0.0,float(N_opt_samples),1.0) while (not np.isclose(scale, scale_)) and (N_inv_samples != N_opt_samples): - repeats = np.rint(scale*dist).astype(int) + repeats = np.rint(scale*dist).astype(np.int64) N_inv_samples = np.sum(repeats) scale_,scale,inc_factor = (scale,scale+inc_factor*0.5*(scale - scale_), inc_factor*2.0) \ if N_inv_samples < N_opt_samples else \ diff --git a/python/tests/test_ConfigMaterial.py b/python/tests/test_ConfigMaterial.py index ea6beae13..d3ea986c5 100644 --- a/python/tests/test_ConfigMaterial.py +++ b/python/tests/test_ConfigMaterial.py @@ -1,3 +1,4 @@ +import sys import os import pytest import numpy as np @@ -41,6 +42,7 @@ class TestConfigMaterial: material_config['material'][0]['constituents'][0]['O']=[0,0,0,0] assert not material_config.is_valid + @pytest.mark.xfail(sys.platform == 'win32', reason='utf8 "not equal" might cause trouble') def test_invalid_fraction(self,ref_path): material_config = ConfigMaterial.load(ref_path/'material.yaml') material_config['material'][0]['constituents'][0]['v']=.9 diff --git a/python/tests/test_Grid.py b/python/tests/test_Grid.py index eedf05ae6..9fb2f310c 100644 --- a/python/tests/test_Grid.py +++ b/python/tests/test_Grid.py @@ -1,3 +1,5 @@ +import sys + import pytest import numpy as np import vtk @@ -47,6 +49,7 @@ class TestGrid: @pytest.mark.parametrize('cmap',[Colormap.from_predefined('stress'),'viridis']) + @pytest.mark.skipif(sys.platform == 'win32', reason='DISPLAY has no effect on windows') def test_show(sef,default,cmap,monkeypatch): monkeypatch.delenv('DISPLAY',raising=False) default.show(cmap) diff --git a/python/tests/test_Result.py b/python/tests/test_Result.py index 9124cff99..9cc8f5643 100644 --- a/python/tests/test_Result.py +++ b/python/tests/test_Result.py @@ -108,7 +108,7 @@ class TestResult: assert np.allclose(in_memory,in_file) @pytest.mark.parametrize('mode', - ['direct',pytest.param('function',marks=pytest.mark.xfail(sys.platform=='darwin',reason='n/a'))]) + ['direct',pytest.param('function',marks=pytest.mark.xfail(sys.platform in ['darwin','win32'], reason='n/a'))]) def test_add_calculation(self,default,tmp_path,mode): if mode == 'direct': diff --git a/python/tests/test_VTK.py b/python/tests/test_VTK.py index 44226bf44..b0a7ef4c5 100644 --- a/python/tests/test_VTK.py +++ b/python/tests/test_VTK.py @@ -2,6 +2,7 @@ import os import filecmp import time import string +import sys import pytest import numpy as np @@ -31,6 +32,7 @@ class TestVTK: print('patched damask.util.execution_stamp') @pytest.mark.parametrize('cmap',[Colormap.from_predefined('cividis'),'strain']) + @pytest.mark.skipif(sys.platform == 'win32', reason='DISPLAY has no effect on windows') def test_show(sef,default,cmap,monkeypatch): monkeypatch.delenv('DISPLAY',raising=False) default.show(colormap=cmap) diff --git a/python/tests/test_util.py b/python/tests/test_util.py index 671654ee0..80786249a 100644 --- a/python/tests/test_util.py +++ b/python/tests/test_util.py @@ -1,5 +1,5 @@ +import sys import random -import os import pytest import numpy as np @@ -11,17 +11,20 @@ from damask import util class TestUtil: - def test_execute_direct(self): - out,err = util.execute('echo test') + @pytest.mark.xfail(sys.platform == 'win32', reason='echo is not a Windows command') + def test_run_direct(self): + out,err = util.run('echo test') assert out=='test\n' and err=='' - def test_execute_env(self): - out,err = util.execute('sh -c "echo $test_for_execute"',env={'test_for_execute':'test'}) + @pytest.mark.xfail(sys.platform == 'win32', reason='echo is not a Windows command') + def test_run_env(self): + out,err = util.run('sh -c "echo $test_for_execute"',env={'test_for_execute':'test'}) assert out=='test\n' and err=='' - def test_execute_runtime_error(self): + @pytest.mark.xfail(sys.platform == 'win32', reason='false is not a Windows command') + def test_run_runtime_error(self): with pytest.raises(RuntimeError): - util.execute('false') + util.run('false') @pytest.mark.parametrize('input,output', [ @@ -125,9 +128,9 @@ class TestUtil: def test_D3D_base_group(self,tmp_path,complete): base_group = ''.join(random.choices('DAMASK', k=10)) with h5py.File(tmp_path/'base_group.dream3d','w') as f: - f.create_group(os.path.join(base_group,'_SIMPL_GEOMETRY')) + f.create_group('/'.join((base_group,'_SIMPL_GEOMETRY'))) if complete: - f[os.path.join(base_group,'_SIMPL_GEOMETRY')].create_dataset('SPACING',data=np.ones(3)) + f['/'.join((base_group,'_SIMPL_GEOMETRY'))].create_dataset('SPACING',data=np.ones(3)) if complete: assert base_group == util.DREAM3D_base_group(tmp_path/'base_group.dream3d') @@ -141,12 +144,12 @@ class TestUtil: cell_data_group = ''.join(random.choices('KULeuven', k=10)) cells = np.random.randint(1,50,3) with h5py.File(tmp_path/'cell_data_group.dream3d','w') as f: - f.create_group(os.path.join(base_group,'_SIMPL_GEOMETRY')) - f[os.path.join(base_group,'_SIMPL_GEOMETRY')].create_dataset('SPACING',data=np.ones(3)) - f[os.path.join(base_group,'_SIMPL_GEOMETRY')].create_dataset('DIMENSIONS',data=cells[::-1]) + f.create_group('/'.join((base_group,'_SIMPL_GEOMETRY'))) + f['/'.join((base_group,'_SIMPL_GEOMETRY'))].create_dataset('SPACING',data=np.ones(3)) + f['/'.join((base_group,'_SIMPL_GEOMETRY'))].create_dataset('DIMENSIONS',data=cells[::-1]) f[base_group].create_group(cell_data_group) if complete: - f[os.path.join(base_group,cell_data_group)].create_dataset('data',shape=np.append(cells,1)) + f['/'.join((base_group,cell_data_group))].create_dataset('data',shape=np.append(cells,1)) if complete: assert cell_data_group == util.DREAM3D_cell_data_group(tmp_path/'cell_data_group.dream3d') diff --git a/src/C_routines.c b/src/C_routines.c index 3d62a87c2..a25fde688 100644 --- a/src/C_routines.c +++ b/src/C_routines.c @@ -7,7 +7,11 @@ #include #include #include -#include "zlib.h" +#include + +#ifdef FYAML +#include +#endif #define PATHLEN 4096 #define STRLEN 256 @@ -80,3 +84,26 @@ void inflate_c(const uLong *s_deflated, const uLong *s_inflated, const Byte defl } } } + +#ifdef FYAML +void to_flow_c(char **flow, int* length_flow, const char *mixed){ + struct fy_document *fyd = NULL; + enum fy_emitter_cfg_flags emit_flags = FYECF_MODE_FLOW_ONELINE | FYECF_STRIP_LABELS | FYECF_STRIP_TAGS |FYECF_STRIP_DOC; + + fyd = fy_document_build_from_string(NULL, mixed, -1); + if (!fyd) { + *length_flow = -1; + return; + } + int err = fy_document_resolve(fyd); + if (err) { + *length_flow = -1; + return; + } + + *flow = fy_emit_document_to_string(fyd,emit_flags); + *length_flow = strlen(*flow); + + fy_document_destroy(fyd); +} +#endif diff --git a/src/DAMASK_interface.f90 b/src/DAMASK_interface.f90 index e958c8a29..1a6bb3ee6 100644 --- a/src/DAMASK_interface.f90 +++ b/src/DAMASK_interface.f90 @@ -11,7 +11,7 @@ !-------------------------------------------------------------------------------------------------- #define PETSC_MAJOR 3 #define PETSC_MINOR_MIN 12 -#define PETSC_MINOR_MAX 16 +#define PETSC_MINOR_MAX 17 module DAMASK_interface use, intrinsic :: ISO_fortran_env diff --git a/src/HDF5_utilities.f90 b/src/HDF5_utilities.f90 index 93de4053b..86807507b 100644 --- a/src/HDF5_utilities.f90 +++ b/src/HDF5_utilities.f90 @@ -48,6 +48,7 @@ module HDF5_utilities !> @details for parallel IO, all dimension except for the last need to match !-------------------------------------------------------------------------------------------------- interface HDF5_write +#if defined(__GFORTRAN__) && __GNUC__<11 module procedure HDF5_write_real1 module procedure HDF5_write_real2 module procedure HDF5_write_real3 @@ -55,7 +56,6 @@ module HDF5_utilities module procedure HDF5_write_real5 module procedure HDF5_write_real6 module procedure HDF5_write_real7 - module procedure HDF5_write_int1 module procedure HDF5_write_int2 module procedure HDF5_write_int3 @@ -63,6 +63,10 @@ module HDF5_utilities module procedure HDF5_write_int5 module procedure HDF5_write_int6 module procedure HDF5_write_int7 +#else + module procedure HDF5_write_real + module procedure HDF5_write_int +#endif end interface HDF5_write !-------------------------------------------------------------------------------------------------- @@ -1210,6 +1214,7 @@ subroutine HDF5_read_int7(dataset,loc_id,datasetName,parallel) end subroutine HDF5_read_int7 +#if defined(__GFORTRAN__) && __GNUC__<11 !-------------------------------------------------------------------------------------------------- !> @brief write dataset of type real with 1 dimension @@ -1499,6 +1504,71 @@ subroutine HDF5_write_real7(dataset,loc_id,datasetName,parallel) end subroutine HDF5_write_real7 +#else + +!-------------------------------------------------------------------------------------------------- +!> @brief write dataset of type real with 1-7 dimension +!-------------------------------------------------------------------------------------------------- +subroutine HDF5_write_real(dataset,loc_id,datasetName,parallel) + + real(pReal), intent(in), dimension(..) :: dataset !< data written to file + integer(HID_T), intent(in) :: loc_id !< file or group handle + character(len=*), intent(in) :: datasetName !< name of the dataset in the file + logical, intent(in), optional :: parallel !< dataset is distributed over multiple processes + + + integer :: hdferr + integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id + integer(HSIZE_T), dimension(rank(dataset)) :: & + myStart, & + myShape, & !< shape of the dataset (this process) + totalShape !< shape of the dataset (all processes) + +!--------------------------------------------------------------------------------------------------- +! determine shape of dataset + myShape = int(shape(dataset),HSIZE_T) + if (any(myShape(1:size(myShape)-1) == 0)) return !< empty dataset (last dimension can be empty) + + if (present(parallel)) then + call initialize_write(dset_id, filespace_id, memspace_id, plist_id, & + myStart, totalShape,loc_id,myShape,datasetName,H5T_NATIVE_DOUBLE,parallel) + else + call initialize_write(dset_id, filespace_id, memspace_id, plist_id, & + myStart, totalShape,loc_id,myShape,datasetName,H5T_NATIVE_DOUBLE,parallel_default) + end if + + if (product(totalShape) /= 0) then + select rank(dataset) + rank (1) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank (2) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank (3) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank (4) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank (5) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank (6) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank (7) + call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + end select + if(hdferr < 0) error stop 'HDF5 error' + end if + + call finalize_write(plist_id, dset_id, filespace_id, memspace_id) + +end subroutine HDF5_write_real +#endif + !-------------------------------------------------------------------------------------------------- !> @brief Write dataset of type string (scalar). @@ -1561,6 +1631,7 @@ subroutine HDF5_write_str(dataset,loc_id,datasetName) end subroutine HDF5_write_str +#if defined(__GFORTRAN__) && __GNUC__<11 !-------------------------------------------------------------------------------------------------- !> @brief write dataset of type integer with 1 dimension @@ -1849,6 +1920,70 @@ subroutine HDF5_write_int7(dataset,loc_id,datasetName,parallel) end subroutine HDF5_write_int7 +#else + +!-------------------------------------------------------------------------------------------------- +!> @brief write dataset of type integer with 1-7 dimension +!-------------------------------------------------------------------------------------------------- +subroutine HDF5_write_int(dataset,loc_id,datasetName,parallel) + + integer, intent(in), dimension(..) :: dataset !< data written to file + integer(HID_T), intent(in) :: loc_id !< file or group handle + character(len=*), intent(in) :: datasetName !< name of the dataset in the file + logical, intent(in), optional :: parallel !< dataset is distributed over multiple processes + + + integer :: hdferr + integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id + integer(HSIZE_T), dimension(rank(dataset)) :: & + myStart, & + myShape, & !< shape of the dataset (this process) + totalShape !< shape of the dataset (all processes) + +!--------------------------------------------------------------------------------------------------- +! determine shape of dataset + myShape = int(shape(dataset),HSIZE_T) + if (any(myShape(1:size(myShape)-1) == 0)) return !< empty dataset (last dimension can be empty) + + if (present(parallel)) then + call initialize_write(dset_id, filespace_id, memspace_id, plist_id, & + myStart, totalShape, loc_id,myShape,datasetName,H5T_NATIVE_INTEGER,parallel) + else + call initialize_write(dset_id, filespace_id, memspace_id, plist_id, & + myStart, totalShape, loc_id,myShape,datasetName,H5T_NATIVE_INTEGER,parallel_default) + end if + + if (product(totalShape) /= 0) then + select rank(dataset) + rank(1) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank(2) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank(3) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank(4) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank(5) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank(6) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + rank(7) + call H5Dwrite_f(dset_id, H5T_NATIVE_INTEGER,dataset,int(totalShape,HSIZE_T), hdferr,& + file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) + end select + if(hdferr < 0) error stop 'HDF5 error' + end if + + call finalize_write(plist_id, dset_id, filespace_id, memspace_id) + +end subroutine HDF5_write_int +#endif !-------------------------------------------------------------------------------------------------- !> @brief initialize HDF5 handles, determines global shape and start for parallel read diff --git a/src/IO.f90 b/src/IO.f90 index 493970824..240c9e992 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -483,7 +483,9 @@ subroutine IO_error(error_ID,el,ip,g,instance,ext_msg) case (701) msg = 'Incorrect indent/Null value not allowed' case (702) - msg = 'Invalid use of flow yaml' + msg = 'Invalid use of flow YAML' + case (703) + msg = 'Invalid YAML' case (704) msg = 'Space expected after a colon for : pair' case (705) diff --git a/src/VTI.f90 b/src/VTI.f90 index d8b8f7778..a5918137e 100644 --- a/src/VTI.f90 +++ b/src/VTI.f90 @@ -81,7 +81,7 @@ subroutine VTI_readDataset_raw(base64_str,dataType,headerType,compressed, & character(len=:), allocatable, intent(out) :: dataType, headerType, base64_str logical, intent(out) :: compressed - logical :: inFile,inImage,gotCellData + logical :: inFile, inImage integer(pI64) :: & startPos, endPos, & s @@ -152,10 +152,9 @@ subroutine VTI_readCellsSizeOrigin(cells,geomSize,origin, & fileContent character(len=:), allocatable :: dataType, headerType - logical :: inFile,inImage,gotCellData,compressed + logical :: inFile, inImage, compressed integer(pI64) :: & - startPos, endPos, & - s + startPos, endPos cells = -1 diff --git a/src/YAML_parse.f90 b/src/YAML_parse.f90 index 8a3264cff..bfce06bc9 100644 --- a/src/YAML_parse.f90 +++ b/src/YAML_parse.f90 @@ -8,6 +8,9 @@ module YAML_parse use prec use IO use YAML_types +#ifdef FYAML + use system_routines +#endif implicit none private @@ -16,14 +19,34 @@ module YAML_parse YAML_parse_init, & YAML_parse_str +#ifdef FYAML + interface + + subroutine to_flow_C(flow,length_flow,mixed) bind(C) + use, intrinsic :: ISO_C_Binding, only: C_INT, C_CHAR, C_PTR + + type(C_PTR), intent(out) :: flow + integer(C_INT), intent(out) :: length_flow + character(kind=C_CHAR), dimension(*), intent(in) :: mixed + end subroutine to_flow_C + + end interface +#endif + + contains !-------------------------------------------------------------------------------------------------- !> @brief Do sanity checks. !-------------------------------------------------------------------------------------------------- -subroutine YAML_parse_init +subroutine YAML_parse_init() - call selfTest + print'(/,1x,a)', '<<<+- YAML_parse init -+>>>' +#ifdef FYAML + print'(/,1x,a)', 'libfyaml powered' +#else + call selfTest() +#endif end subroutine YAML_parse_init @@ -60,7 +83,7 @@ recursive function parse_flow(YAML_flow) result(node) s, & ! start position of dictionary or list d ! position of key: value separator (':') - flow_string = trim(adjustl(YAML_flow(:))) + flow_string = trim(adjustl(YAML_flow)) if (len_trim(flow_string) == 0) then node => emptyDict return @@ -145,8 +168,11 @@ logical function quotedString(line) character(len=*), intent(in) :: line + quotedString = .false. + if (len(line) == 0) return + if (scan(line(:1),IO_QUOTES) == 1) then quotedString = .true. if(line(len(line):len(line)) /= line(:1)) call IO_error(710,ext_msg=line) @@ -155,8 +181,37 @@ logical function quotedString(line) end function quotedString +#ifdef FYAML !-------------------------------------------------------------------------------------------------- -! @brief Returns Indentation. +! @brief Convert all block style YAML parts to flow style. +!-------------------------------------------------------------------------------------------------- +function to_flow(mixed) result(flow) + + character(len=*), intent(in) :: mixed + character(:,C_CHAR), allocatable :: flow + + type(C_PTR) :: str_ptr + integer(C_INT) :: strlen + + + call to_flow_C(str_ptr,strlen,f_c_string(mixed)) + if (strlen < 1) call IO_error(703,ext_msg='libyfaml') + allocate(character(len=strlen,kind=c_char) :: flow) + + block + character(len=strlen,kind=c_char), pointer :: s + call c_f_pointer(str_ptr,s) + flow = s(:len(s)-1) + end block + + call free_C(str_ptr) + +end function to_flow + + +#else +!-------------------------------------------------------------------------------------------------- +! @brief Determine Indentation. ! @details It determines the indentation level for a given block/line. ! In cases for nested lists, an offset is added to determine the indent of the item block (skip ! leading dashes) @@ -280,7 +335,7 @@ subroutine skip_empty_lines(blck,s_blck) enddo end subroutine skip_empty_lines - + !-------------------------------------------------------------------------------------------------- ! @brief skip file header @@ -303,7 +358,7 @@ subroutine skip_file_header(blck,s_blck) call IO_error(708,ext_msg = line) end if end if - + end subroutine skip_file_header @@ -371,7 +426,7 @@ subroutine list_item_inline(blck,s_blck,inline,offset) character(len=:), allocatable :: line integer :: indent,indent_next - + indent = indentDepth(blck(s_blck:),offset) line = IO_rmComment(blck(s_blck:s_blck + index(blck(s_blck:),IO_EOL) - 2)) inline = line(indent-offset+3:) @@ -385,7 +440,7 @@ subroutine list_item_inline(blck,s_blck,inline,offset) indent_next = indentDepth(blck(s_blck:)) enddo - if(scan(inline,",") > 0) inline = '"'//inline//'"' + if(scan(inline,",") > 0) inline = '"'//inline//'"' end subroutine list_item_inline @@ -737,7 +792,7 @@ end subroutine !-------------------------------------------------------------------------------------------------- -! @brief convert all block style YAML parts to flow style +! @brief Convert all block style YAML parts to flow style. !-------------------------------------------------------------------------------------------------- function to_flow(blck) @@ -749,7 +804,7 @@ function to_flow(blck) s_flow, & !< start position in flow offset, & !< counts leading '- ' in nested lists end_line - + allocate(character(len=len(blck)*2)::to_flow) s_flow = 1 s_blck = 1 @@ -876,7 +931,7 @@ subroutine selfTest character(len=*), parameter :: flow = & '{a: ["b", {c: "d"}, "e"]}' - + if( .not. to_flow(flow_multi) == flow) error stop 'to_flow' end block multi_line_flow1 @@ -889,7 +944,7 @@ subroutine selfTest "[c,"//IO_EOL//& "d"//IO_EOL//& "e, f]}"//IO_EOL - + character(len=*), parameter :: flow = & "[{a: {b: [c, d e, f]}}]" @@ -921,5 +976,6 @@ subroutine selfTest end block basic_mixed end subroutine selfTest +#endif end module YAML_parse diff --git a/src/YAML_types.f90 b/src/YAML_types.f90 index d7ca71cbb..857b24bd0 100644 --- a/src/YAML_types.f90 +++ b/src/YAML_types.f90 @@ -119,7 +119,8 @@ module YAML_types type, extends(tNode), public :: tList - class(tItem), pointer :: first => NULL() + class(tItem), pointer :: first => NULL(), & + last => NULL() contains procedure :: asFormattedString => tList_asFormattedString @@ -144,7 +145,7 @@ module YAML_types end type tDict - type :: tItem + type, public :: tItem character(len=:), allocatable :: key class(tNode), pointer :: node => NULL() class(tItem), pointer :: next => NULL() @@ -1348,15 +1349,13 @@ subroutine tList_append(self,node) type(tItem), pointer :: item if (.not. associated(self%first)) then - allocate(self%first) - item => self%first + allocate(item) + self%first => item + self%last => item else - item => self%first - do while (associated(item%next)) - item => item%next - enddo - allocate(item%next) - item => item%next + allocate(self%last%next) + item => self%last%next + self%last => item end if item%node => node diff --git a/src/grid/spectral_utilities.f90 b/src/grid/spectral_utilities.f90 index 525f68d7e..4375ec860 100644 --- a/src/grid/spectral_utilities.f90 +++ b/src/grid/spectral_utilities.f90 @@ -142,7 +142,7 @@ contains !> level chosen. !> Initializes FFTW. !-------------------------------------------------------------------------------------------------- -subroutine spectral_utilities_init +subroutine spectral_utilities_init() PetscErrorCode :: err_PETSc integer :: i, j, k, & @@ -350,6 +350,8 @@ subroutine spectral_utilities_init allocate (gamma_hat(3,3,3,3,cells1Red,cells(2),cells3), source = cmplx(0.0_pReal,0.0_pReal,pReal)) endif + call selfTest() + end subroutine spectral_utilities_init @@ -1146,4 +1148,41 @@ subroutine utilities_saveReferenceStiffness end subroutine utilities_saveReferenceStiffness + +!-------------------------------------------------------------------------------------------------- +!> @brief Check correctness of forward-backward transform. +!-------------------------------------------------------------------------------------------------- +subroutine selfTest() + + real(pReal), allocatable, dimension(:,:,:,:,:) :: tensorField_real_ + real(pReal), allocatable, dimension(:,:,:,:) :: vectorField_real_ + real(pReal), allocatable, dimension(:,:,:) :: scalarField_real_ + + + call random_number(tensorField_real) + tensorField_real(1:3,1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal + tensorField_real_ = tensorField_real + call utilities_FFTtensorForward() + call utilities_FFTtensorBackward() + tensorField_real(1:3,1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal + if (maxval(abs(tensorField_real_ - tensorField_real))>5.0e-15_pReal) error stop 'tensorField' + + call random_number(vectorField_real) + vectorField_real(1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal + vectorField_real_ = vectorField_real + call utilities_FFTvectorForward() + call utilities_FFTvectorBackward() + vectorField_real(1:3,cells(1)+1:cells1Red*2,:,:) = 0.0_pReal + if (maxval(abs(vectorField_real_ - vectorField_real))>5.0e-15_pReal) error stop 'vectorField' + + call random_number(scalarField_real) + scalarField_real(cells(1)+1:cells1Red*2,:,:) = 0.0_pReal + scalarField_real_ = scalarField_real + call utilities_FFTscalarForward() + call utilities_FFTscalarBackward() + scalarField_real(cells(1)+1:cells1Red*2,:,:) = 0.0_pReal + if (maxval(abs(scalarField_real_ - scalarField_real))>5.0e-15_pReal) error stop 'scalarField' + +end subroutine selfTest + end module spectral_utilities diff --git a/src/material.f90 b/src/material.f90 index 3ff280b0d..2258c40a1 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -91,9 +91,13 @@ subroutine parse() homogenizations, & homogenization + class(tItem), pointer :: item integer, dimension(:), allocatable :: & counterPhase, & - counterHomogenization + counterHomogenization, & + ho_of + integer, dimension(:,:), allocatable :: ph_of + real(pReal), dimension(:,:), allocatable :: v_of real(pReal) :: v integer :: & @@ -102,11 +106,14 @@ subroutine parse() co, ce, & ma + materials => config_material%get('material') phases => config_material%get('phase') homogenizations => config_material%get('homogenization') - call sanityCheck(materials, homogenizations) + + if (maxval(discretization_materialAt) > materials%length) & + call IO_error(155,ext_msg='More materials requested than found in material.yaml') #if defined (__GFORTRAN__) material_name_phase = getKeys(phases) @@ -123,6 +130,49 @@ subroutine parse() end do homogenization_maxNconstituents = maxval(homogenization_Nconstituents) + allocate(material_v(homogenization_maxNconstituents,discretization_Ncells),source=0.0_pReal) + + allocate(material_O_0(materials%length)) + allocate(material_F_i_0(materials%length)) + + allocate(ho_of(materials%length)) + allocate(ph_of(materials%length,homogenization_maxNconstituents),source=-1) + allocate( v_of(materials%length,homogenization_maxNconstituents),source=0.0_pReal) + + ! parse YAML structure + select type(materials) + + class is(tList) + + item => materials%first + do ma = 1, materials%length + material => item%node + ho_of(ma) = homogenizations%getIndex(material%get_asString('homogenization')) + constituents => material%get('constituents') + + homogenization => homogenizations%get(ho_of(ma)) + if (constituents%length /= homogenization%get_asInt('N_constituents')) call IO_error(148) + + allocate(material_O_0(ma)%data(constituents%length)) + allocate(material_F_i_0(ma)%data(1:3,1:3,constituents%length)) + + do co = 1, constituents%length + constituent => constituents%get(co) + v_of(ma,co) = constituent%get_asFloat('v') + ph_of(ma,co) = phases%getIndex(constituent%get_asString('phase')) + + call material_O_0(ma)%data(co)%fromQuaternion(constituent%get_as1dFloat('O',requiredSize=4)) + material_F_i_0(ma)%data(1:3,1:3,co) = constituent%get_as2dFloat('F_i',defaultVal=math_I3,requiredShape=[3,3]) + + end do + if (dNeq(sum(v_of(ma,:)),1.0_pReal,1.e-9_pReal)) call IO_error(153,ext_msg='constituent') + + item => item%next + end do + + end select + + allocate(counterPhase(phases%length),source=0) allocate(counterHomogenization(homogenizations%length),source=0) @@ -132,12 +182,13 @@ subroutine parse() allocate(material_phaseID(homogenization_maxNconstituents,discretization_Ncells),source=0) allocate(material_phaseEntry(homogenization_maxNconstituents,discretization_Ncells),source=0) - allocate(material_v(homogenization_maxNconstituents,discretization_Ncells),source=0.0_pReal) + ! build mappings do el = 1, discretization_Nelems - material => materials%get(discretization_materialAt(el)) - ho = homogenizations%getIndex(material%get_asString('homogenization')) + ma = discretization_materialAt(el) + ho = ho_of(ma) + do ip = 1, discretization_nIPs ce = (el-1)*discretization_nIPs + ip material_homogenizationID(ce) = ho @@ -145,13 +196,11 @@ subroutine parse() material_homogenizationEntry(ce) = counterHomogenization(ho) end do - constituents => material%get('constituents') - do co = 1, constituents%length - constituent => constituents%get(co) + do co = 1, size(ph_of(ma,:)>0) - v = constituent%get_asFloat('v') + v = v_of(ma,co) + ph = ph_of(ma,co) - ph = phases%getIndex(constituent%get_asString('phase')) do ip = 1, discretization_nIPs ce = (el-1)*discretization_nIPs + ip material_phaseID(co,ce) = ph @@ -161,54 +210,11 @@ subroutine parse() end do end do - if (dNeq(sum(material_v(1:constituents%length,ce)),1.0_pReal,1.e-9_pReal)) & - call IO_error(153,ext_msg='constituent') - end do - allocate(material_O_0(materials%length)) - allocate(material_F_i_0(materials%length)) - - do ma = 1, materials%length - material => materials%get(ma) - constituents => material%get('constituents') - allocate(material_O_0(ma)%data(constituents%length)) - allocate(material_F_i_0(ma)%data(1:3,1:3,constituents%length)) - do co = 1, constituents%length - constituent => constituents%get(co) - call material_O_0(ma)%data(co)%fromQuaternion(constituent%get_as1dFloat('O',requiredSize=4)) - material_F_i_0(ma)%data(1:3,1:3,co) = constituent%get_as2dFloat('F_i',defaultVal=math_I3,requiredShape=[3,3]) - enddo - enddo - end subroutine parse -!-------------------------------------------------------------------------------------------------- -!> @brief Check if material.yaml is consistent and contains sufficient # of materials -!-------------------------------------------------------------------------------------------------- -subroutine sanityCheck(materials,homogenizations) - - class(tNode), intent(in) :: materials, & - homogenizations - - class(tNode), pointer :: material, & - homogenization, & - constituents - integer :: m - - if (maxval(discretization_materialAt) > materials%length) & - call IO_error(155,ext_msg='More materials requested than found in material.yaml') - - do m = 1, materials%length - material => materials%get(m) - constituents => material%get('constituents') - homogenization => homogenizations%get(material%get_asString('homogenization')) - if (constituents%length /= homogenization%get_asInt('N_constituents')) call IO_error(148) - end do - -end subroutine sanityCheck - #if defined (__GFORTRAN__) !-------------------------------------------------------------------------------------------------- !> @brief %keys() is broken on gfortran diff --git a/src/mesh/discretization_mesh.f90 b/src/mesh/discretization_mesh.f90 index 9baff52fb..70ee28343 100644 --- a/src/mesh/discretization_mesh.f90 +++ b/src/mesh/discretization_mesh.f90 @@ -100,7 +100,11 @@ subroutine discretization_mesh_init(restart) debug_element = config_debug%get_asInt('element',defaultVal=1) debug_ip = config_debug%get_asInt('integrationpoint',defaultVal=1) +#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>16) + call DMPlexCreateFromFile(PETSC_COMM_WORLD,interface_geomFile,'n/a',PETSC_TRUE,globalMesh,err_PETSc) +#else call DMPlexCreateFromFile(PETSC_COMM_WORLD,interface_geomFile,PETSC_TRUE,globalMesh,err_PETSc) +#endif CHKERRQ(err_PETSc) call DMGetDimension(globalMesh,dimPlex,err_PETSc) CHKERRQ(err_PETSc) diff --git a/src/prec.f90 b/src/prec.f90 index d0753790e..73563d4f2 100644 --- a/src/prec.f90 +++ b/src/prec.f90 @@ -48,7 +48,7 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief Report precision and do self test. !-------------------------------------------------------------------------------------------------- -subroutine prec_init +subroutine prec_init() print'(/,1x,a)', '<<<+- prec init -+>>>' @@ -60,7 +60,7 @@ subroutine prec_init print'( a,e10.3)', ' epsilon value: ',PREAL_EPSILON print'( a,i3)', ' decimal precision: ',precision(0.0_pReal) - call selfTest + call selfTest() end subroutine prec_init @@ -245,7 +245,7 @@ end function prec_bytesToC_INT64_T !-------------------------------------------------------------------------------------------------- !> @brief Check correctness of some prec functions. !-------------------------------------------------------------------------------------------------- -subroutine selfTest +subroutine selfTest() integer, allocatable, dimension(:) :: realloc_lhs_test real(pReal), dimension(1) :: f diff --git a/src/rotations.f90 b/src/rotations.f90 index 53f1fe976..7aa81fcab 100644 --- a/src/rotations.f90 +++ b/src/rotations.f90 @@ -658,11 +658,7 @@ function om2ax(om) result(ax) else call dgeev('N','V',3,om_,3,Wr,Wi,devNull,3,VR,3,work,size(work,1),ierr) if (ierr /= 0) error stop 'LAPACK error' -#if defined(__GFORTRAN__) && __GNUC__<9 - i = maxloc(merge(1,0,cEq(cmplx(Wr,Wi,pReal),cmplx(1.0_pReal,0.0_pReal,pReal),tol=1.0e-14_pReal)),dim=1) -#else i = findloc(cEq(cmplx(Wr,Wi,pReal),cmplx(1.0_pReal,0.0_pReal,pReal),tol=1.0e-14_pReal),.true.,dim=1) !find eigenvalue (1,0) -#endif if (i == 0) error stop 'om2ax conversion failed' ax(1:3) = VR(1:3,i) where ( dNeq0([om(2,3)-om(3,2), om(3,1)-om(1,3), om(1,2)-om(2,1)])) & @@ -1427,10 +1423,6 @@ subroutine selfTest() do i = 1, 20 -#if defined(__GFORTRAN__) && __GNUC__<9 - if(i<7) cycle -#endif - if(i==1) then qu = om2qu(math_I3) elseif(i==2) then diff --git a/src/system_routines.f90 b/src/system_routines.f90 index 2eb0b7958..e0adf9dc0 100644 --- a/src/system_routines.f90 +++ b/src/system_routines.f90 @@ -17,59 +17,67 @@ module system_routines getUserName, & signalterm_C, & signalusr1_C, & - signalusr2_C + signalusr2_C, & + f_c_string, & + free_C interface - function setCWD_C(cwd) bind(C) - use, intrinsic :: ISO_C_Binding, only: C_INT, C_CHAR + function setCWD_C(cwd) bind(C) + use, intrinsic :: ISO_C_Binding, only: C_INT, C_CHAR - integer(C_INT) :: setCWD_C - character(kind=C_CHAR), dimension(*), intent(in) :: cwd - end function setCWD_C + integer(C_INT) :: setCWD_C + character(kind=C_CHAR), dimension(*), intent(in) :: cwd + end function setCWD_C - subroutine getCWD_C(cwd, stat) bind(C) - use, intrinsic :: ISO_C_Binding, only: C_INT, C_CHAR - use prec + subroutine getCWD_C(cwd, stat) bind(C) + use, intrinsic :: ISO_C_Binding, only: C_INT, C_CHAR + use prec - character(kind=C_CHAR), dimension(pPathLen+1), intent(out) :: cwd ! NULL-terminated array - integer(C_INT), intent(out) :: stat - end subroutine getCWD_C + character(kind=C_CHAR), dimension(pPathLen+1), intent(out) :: cwd ! NULL-terminated array + integer(C_INT), intent(out) :: stat + end subroutine getCWD_C - subroutine getHostName_C(hostname, stat) bind(C) - use, intrinsic :: ISO_C_Binding, only: C_INT, C_CHAR - use prec + subroutine getHostName_C(hostname, stat) bind(C) + use, intrinsic :: ISO_C_Binding, only: C_INT, C_CHAR + use prec - character(kind=C_CHAR), dimension(pStringLen+1), intent(out) :: hostname ! NULL-terminated array - integer(C_INT), intent(out) :: stat - end subroutine getHostName_C + character(kind=C_CHAR), dimension(pStringLen+1), intent(out) :: hostname ! NULL-terminated array + integer(C_INT), intent(out) :: stat + end subroutine getHostName_C - subroutine getUserName_C(username, stat) bind(C) - use, intrinsic :: ISO_C_Binding, only: C_INT, C_CHAR - use prec + subroutine getUserName_C(username, stat) bind(C) + use, intrinsic :: ISO_C_Binding, only: C_INT, C_CHAR + use prec - character(kind=C_CHAR), dimension(pStringLen+1), intent(out) :: username ! NULL-terminated array - integer(C_INT), intent(out) :: stat - end subroutine getUserName_C + character(kind=C_CHAR), dimension(pStringLen+1), intent(out) :: username ! NULL-terminated array + integer(C_INT), intent(out) :: stat + end subroutine getUserName_C - subroutine signalterm_C(handler) bind(C) - use, intrinsic :: ISO_C_Binding, only: C_FUNPTR + subroutine signalterm_C(handler) bind(C) + use, intrinsic :: ISO_C_Binding, only: C_FUNPTR - type(C_FUNPTR), intent(in), value :: handler - end subroutine signalterm_C + type(C_FUNPTR), intent(in), value :: handler + end subroutine signalterm_C - subroutine signalusr1_C(handler) bind(C) - use, intrinsic :: ISO_C_Binding, only: C_FUNPTR + subroutine signalusr1_C(handler) bind(C) + use, intrinsic :: ISO_C_Binding, only: C_FUNPTR - type(C_FUNPTR), intent(in), value :: handler - end subroutine signalusr1_C + type(C_FUNPTR), intent(in), value :: handler + end subroutine signalusr1_C - subroutine signalusr2_C(handler) bind(C) - use, intrinsic :: ISO_C_Binding, only: C_FUNPTR + subroutine signalusr2_C(handler) bind(C) + use, intrinsic :: ISO_C_Binding, only: C_FUNPTR + + type(C_FUNPTR), intent(in), value :: handler + end subroutine signalusr2_C + + subroutine free_C(ptr) bind(C,name='free') + import c_ptr + type(c_ptr), value :: ptr + end subroutine free_C - type(C_FUNPTR), intent(in), value :: handler - end subroutine signalusr2_C end interface From 6eb8ade40be1ea2f81651e936f48cb4a8a3f6ed3 Mon Sep 17 00:00:00 2001 From: Test User Date: Sat, 23 Apr 2022 08:05:31 +0200 Subject: [PATCH 037/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-236-g1f4ee0813 --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index f8dcddc79..fa4fd9fef 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha6-228-g758ad6072 +v3.0.0-alpha6-236-g1f4ee0813 From 0e65d44bdc39d27653141f3f1453a745d4868cc4 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 23 Apr 2022 14:41:10 +0200 Subject: [PATCH 038/142] separating functionality signal handling and CLI handling are not really related --- src/CPFEM2.f90 | 3 +- src/DAMASK_interface.f90 | 106 +------------------------------- src/grid/DAMASK_grid.f90 | 11 ++-- src/signals.f90 | 128 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 138 insertions(+), 110 deletions(-) create mode 100644 src/signals.f90 diff --git a/src/CPFEM2.f90 b/src/CPFEM2.f90 index b24ba5480..909da7f1e 100644 --- a/src/CPFEM2.f90 +++ b/src/CPFEM2.f90 @@ -5,6 +5,7 @@ !-------------------------------------------------------------------------------------------------- module CPFEM2 use parallelization + use signals use DAMASK_interface use prec use IO @@ -21,7 +22,6 @@ module CPFEM2 use material use phase use homogenization - use discretization #if defined(MESH) use FEM_quadrature @@ -44,6 +44,7 @@ subroutine CPFEM_initAll call parallelization_init call DAMASK_interface_init ! Spectral and FEM interface to commandline + call signals_init call prec_init call IO_init #if defined(MESH) diff --git a/src/DAMASK_interface.f90 b/src/DAMASK_interface.f90 index 1a6bb3ee6..2dee9b13c 100644 --- a/src/DAMASK_interface.f90 +++ b/src/DAMASK_interface.f90 @@ -24,10 +24,6 @@ module DAMASK_interface implicit none private - logical, volatile, public, protected :: & - interface_SIGTERM, & !< termination signal - interface_SIGUSR1, & !< 1. user-defined signal - interface_SIGUSR2 !< 2. user-defined signal integer, public, protected :: & interface_restartInc = 0 !< Increment at which calculation starts character(len=:), allocatable, public, protected :: & @@ -36,10 +32,7 @@ module DAMASK_interface public :: & getSolverJobName, & - DAMASK_interface_init, & - interface_setSIGTERM, & - interface_setSIGUSR1, & - interface_setSIGUSR2 + DAMASK_interface_init contains @@ -197,13 +190,6 @@ subroutine DAMASK_interface_init if (interface_restartInc > 0) & print'(a,i6.6)', ' Restart from increment: ', interface_restartInc - call signalterm_c(c_funloc(catchSIGTERM)) - call signalusr1_c(c_funloc(catchSIGUSR1)) - call signalusr2_c(c_funloc(catchSIGUSR2)) - call interface_setSIGTERM(.false.) - call interface_setSIGUSR1(.false.) - call interface_setSIGUSR2(.false.) - end subroutine DAMASK_interface_init @@ -376,92 +362,4 @@ function makeRelativePath(a,b) end function makeRelativePath - -!-------------------------------------------------------------------------------------------------- -!> @brief Set global variable interface_SIGTERM to .true. -!> @details This function can be registered to catch signals send to the executable. -!-------------------------------------------------------------------------------------------------- -subroutine catchSIGTERM(signal) bind(C) - - integer(C_INT), value :: signal - - - print'(a,i0)', ' received signal ',signal - call interface_setSIGTERM(.true.) - -end subroutine catchSIGTERM - - -!-------------------------------------------------------------------------------------------------- -!> @brief Set global variable interface_SIGUSR1 to .true. -!> @details This function can be registered to catch signals send to the executable. -!-------------------------------------------------------------------------------------------------- -subroutine catchSIGUSR1(signal) bind(C) - - integer(C_INT), value :: signal - - - print'(a,i0)', ' received signal ',signal - call interface_setSIGUSR1(.true.) - -end subroutine catchSIGUSR1 - - -!-------------------------------------------------------------------------------------------------- -!> @brief Set global variable interface_SIGUSR2 to .true. -!> @details This function can be registered to catch signals send to the executable. -!-------------------------------------------------------------------------------------------------- -subroutine catchSIGUSR2(signal) bind(C) - - integer(C_INT), value :: signal - - - print'(a,i0,a)', ' received signal ',signal - call interface_setSIGUSR2(.true.) - -end subroutine catchSIGUSR2 - - -!-------------------------------------------------------------------------------------------------- -!> @brief Set global variable interface_SIGTERM. -!-------------------------------------------------------------------------------------------------- -subroutine interface_setSIGTERM(state) - - logical, intent(in) :: state - - - interface_SIGTERM = state - print*, 'set SIGTERM to',state - -end subroutine interface_setSIGTERM - - -!-------------------------------------------------------------------------------------------------- -!> @brief Set global variable interface_SIGUSR. -!-------------------------------------------------------------------------------------------------- -subroutine interface_setSIGUSR1(state) - - logical, intent(in) :: state - - - interface_SIGUSR1 = state - print*, 'set SIGUSR1 to',state - -end subroutine interface_setSIGUSR1 - - -!-------------------------------------------------------------------------------------------------- -!> @brief Set global variable interface_SIGUSR2. -!-------------------------------------------------------------------------------------------------- -subroutine interface_setSIGUSR2(state) - - logical, intent(in) :: state - - - interface_SIGUSR2 = state - print*, 'set SIGUSR2 to',state - -end subroutine interface_setSIGUSR2 - - -end module +end module DAMASK_interface diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index 39870a8ff..72cc83452 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -15,6 +15,7 @@ program DAMASK_grid use prec use parallelization + use signals use DAMASK_interface use IO use config @@ -448,15 +449,15 @@ program DAMASK_grid print'(/,1x,a,i0,a)', 'increment ', totalIncsCounter, ' NOT converged' endif; flush(IO_STDOUT) - call MPI_Allreduce(interface_SIGUSR1,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI) + call MPI_Allreduce(signals_SIGUSR1,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' if (mod(inc,loadCases(l)%f_out) == 0 .or. signal) then print'(/,1x,a)', '... writing results to file ...............................................' flush(IO_STDOUT) call CPFEM_results(totalIncsCounter,t) endif - if (signal) call interface_setSIGUSR1(.false.) - call MPI_Allreduce(interface_SIGUSR2,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI) + if (signal) call signals_setSIGUSR1(.false.) + call MPI_Allreduce(signals_SIGUSR2,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' if (mod(inc,loadCases(l)%f_restart) == 0 .or. signal) then do field = 1, nActiveFields @@ -469,8 +470,8 @@ program DAMASK_grid end do call CPFEM_restartWrite endif - if (signal) call interface_setSIGUSR2(.false.) - call MPI_Allreduce(interface_SIGTERM,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI) + if (signal) call signals_setSIGUSR2(.false.) + call MPI_Allreduce(signals_SIGTERM,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' if (signal) exit loadCaseLooping endif skipping diff --git a/src/signals.f90 b/src/signals.f90 new file mode 100644 index 000000000..bf53912f4 --- /dev/null +++ b/src/signals.f90 @@ -0,0 +1,128 @@ +!-------------------------------------------------------------------------------------------------- +!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH +!> @brief Handling of UNIX signals. +!-------------------------------------------------------------------------------------------------- +module signals + use prec + use system_routines + + implicit none + private + + logical, volatile, public, protected :: & + signals_SIGTERM, & !< termination signal + signals_SIGUSR1, & !< 1. user-defined signal + signals_SIGUSR2 !< 2. user-defined signal + + public :: & + signals_init, & + signals_setSIGTERM, & + signals_setSIGUSR1, & + signals_setSIGUSR2 + +contains + + +!-------------------------------------------------------------------------------------------------- +!> @brief Register signal handlers. +!-------------------------------------------------------------------------------------------------- +subroutine signals_init() + + call signalterm_c(c_funloc(catchSIGTERM)) + call signalusr1_c(c_funloc(catchSIGUSR1)) + call signalusr2_c(c_funloc(catchSIGUSR2)) + call signals_setSIGTERM(.false.) + call signals_setSIGUSR1(.false.) + call signals_setSIGUSR2(.false.) + +end subroutine signals_init + + +!-------------------------------------------------------------------------------------------------- +!> @brief Set global variable signals_SIGTERM to .true. +!> @details This function can be registered to catch signals send to the executable. +!-------------------------------------------------------------------------------------------------- +subroutine catchSIGTERM(signal) bind(C) + + integer(C_INT), value :: signal + + + print'(a,i0)', ' received signal ',signal + call signals_setSIGTERM(.true.) + +end subroutine catchSIGTERM + + +!-------------------------------------------------------------------------------------------------- +!> @brief Set global variable signals_SIGUSR1 to .true. +!> @details This function can be registered to catch signals send to the executable. +!-------------------------------------------------------------------------------------------------- +subroutine catchSIGUSR1(signal) bind(C) + + integer(C_INT), value :: signal + + + print'(a,i0)', ' received signal ',signal + call signals_setSIGUSR1(.true.) + +end subroutine catchSIGUSR1 + + +!-------------------------------------------------------------------------------------------------- +!> @brief Set global variable signals_SIGUSR2 to .true. +!> @details This function can be registered to catch signals send to the executable. +!-------------------------------------------------------------------------------------------------- +subroutine catchSIGUSR2(signal) bind(C) + + integer(C_INT), value :: signal + + + print'(a,i0,a)', ' received signal ',signal + call signals_setSIGUSR2(.true.) + +end subroutine catchSIGUSR2 + + +!-------------------------------------------------------------------------------------------------- +!> @brief Set global variable signals_SIGTERM. +!-------------------------------------------------------------------------------------------------- +subroutine signals_setSIGTERM(state) + + logical, intent(in) :: state + + + signals_SIGTERM = state + print*, 'set SIGTERM to',state + +end subroutine signals_setSIGTERM + + +!-------------------------------------------------------------------------------------------------- +!> @brief Set global variable signals_SIGUSR. +!-------------------------------------------------------------------------------------------------- +subroutine signals_setSIGUSR1(state) + + logical, intent(in) :: state + + + signals_SIGUSR1 = state + print*, 'set SIGUSR1 to',state + +end subroutine signals_setSIGUSR1 + + +!-------------------------------------------------------------------------------------------------- +!> @brief Set global variable signals_SIGUSR2. +!-------------------------------------------------------------------------------------------------- +subroutine signals_setSIGUSR2(state) + + logical, intent(in) :: state + + + signals_SIGUSR2 = state + print*, 'set SIGUSR2 to',state + +end subroutine signals_setSIGUSR2 + + +end module signals From b80b406ad5e4deb4e117b35d2868a01b68c64a81 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 23 Apr 2022 14:52:10 +0200 Subject: [PATCH 039/142] more specific name 'interface' can be an interface to anything, 'CLI' is an established abbreviation for 'command line interface' --- src/{DAMASK_interface.f90 => CLI.f90} | 54 +++++++++----------- src/CPFEM2.f90 | 12 ++--- src/grid/DAMASK_grid.f90 | 10 ++-- src/grid/discretization_grid.f90 | 6 +-- src/grid/grid_mech_FEM.f90 | 10 ++-- src/grid/grid_mech_spectral_basic.f90 | 10 ++-- src/grid/grid_mech_spectral_polarisation.f90 | 10 ++-- src/grid/grid_thermal_spectral.f90 | 4 +- 8 files changed, 56 insertions(+), 60 deletions(-) rename src/{DAMASK_interface.f90 => CLI.f90} (89%) diff --git a/src/DAMASK_interface.f90 b/src/CLI.f90 similarity index 89% rename from src/DAMASK_interface.f90 rename to src/CLI.f90 index 2dee9b13c..15b83ab80 100644 --- a/src/DAMASK_interface.f90 +++ b/src/CLI.f90 @@ -1,13 +1,9 @@ !-------------------------------------------------------------------------------------------------- -!> @author Jaeyong Jung, Max-Planck-Institut für Eisenforschung GmbH -!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH -!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH -!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH -!> @brief Interfacing between the PETSc-based solvers and the material subroutines provided -!! by DAMASK -!> @details Interfacing between the PETSc-based solvers and the material subroutines provided -!> by DAMASK. Interpreting the command line arguments to get load case, geometry file, -!> and working directory. +!> @author Jaeyong Jung, Max-Planck-Institut für Eisenforschung GmbH +!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH +!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH +!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH +!> @brief Parse command line interface for PETSc-based solvers !-------------------------------------------------------------------------------------------------- #define PETSC_MAJOR 3 #define PETSC_MINOR_MIN 12 @@ -25,14 +21,14 @@ module DAMASK_interface implicit none private integer, public, protected :: & - interface_restartInc = 0 !< Increment at which calculation starts + CLI_restartInc = 0 !< Increment at which calculation starts character(len=:), allocatable, public, protected :: & - interface_geomFile, & !< parameter given for geometry file - interface_loadFile !< parameter given for load case file + CLI_geomFile, & !< parameter given for geometry file + CLI_loadFile !< parameter given for load case file public :: & getSolverJobName, & - DAMASK_interface_init + CLI_init contains @@ -40,7 +36,7 @@ contains !> @brief initializes the solver by interpreting the command line arguments. Also writes !! information on computation to screen !-------------------------------------------------------------------------------------------------- -subroutine DAMASK_interface_init +subroutine CLI_init #include #if PETSC_VERSION_MAJOR!=3 || PETSC_VERSION_MINORPETSC_MINOR_MAX @@ -156,8 +152,8 @@ subroutine DAMASK_interface_init call get_command_argument(i+1,workingDirArg,status=err) case ('-r', '--rs', '--restart') call get_command_argument(i+1,arg,status=err) - read(arg,*,iostat=stat) interface_restartInc - if (interface_restartInc < 0 .or. stat /=0) then + read(arg,*,iostat=stat) CLI_restartInc + if (CLI_restartInc < 0 .or. stat /=0) then print'(/,a)', ' ERROR: Could not parse restart increment: '//trim(arg) call quit(1) endif @@ -171,8 +167,8 @@ subroutine DAMASK_interface_init endif if (len_trim(workingDirArg) > 0) call setWorkingDirectory(trim(workingDirArg)) - interface_geomFile = getGeometryFile(geometryArg) - interface_loadFile = getLoadCaseFile(loadCaseArg) + CLI_geomFile = getGeometryFile(geometryArg) + CLI_loadFile = getLoadCaseFile(loadCaseArg) call get_command(commandLine) print'(/,a)', ' Host name: '//getHostName() @@ -184,13 +180,13 @@ subroutine DAMASK_interface_init print'(a)', ' Geometry argument: '//trim(geometryArg) print'(a)', ' Load case argument: '//trim(loadcaseArg) print'(/,a)', ' Working directory: '//getCWD() - print'(a)', ' Geometry file: '//interface_geomFile - print'(a)', ' Load case file: '//interface_loadFile + print'(a)', ' Geometry file: '//CLI_geomFile + print'(a)', ' Load case file: '//CLI_loadFile print'(a)', ' Solver job name: '//getSolverJobName() - if (interface_restartInc > 0) & - print'(a,i6.6)', ' Restart from increment: ', interface_restartInc + if (CLI_restartInc > 0) & + print'(a,i6.6)', ' Restart from increment: ', CLI_restartInc -end subroutine DAMASK_interface_init +end subroutine CLI_init !-------------------------------------------------------------------------------------------------- @@ -229,15 +225,15 @@ function getSolverJobName() character(len=:), allocatable :: getSolverJobName integer :: posExt,posSep - posExt = scan(interface_geomFile,'.',back=.true.) - posSep = scan(interface_geomFile,'/',back=.true.) + posExt = scan(CLI_geomFile,'.',back=.true.) + posSep = scan(CLI_geomFile,'/',back=.true.) - getSolverJobName = interface_geomFile(posSep+1:posExt-1) + getSolverJobName = CLI_geomFile(posSep+1:posExt-1) - posExt = scan(interface_loadFile,'.',back=.true.) - posSep = scan(interface_loadFile,'/',back=.true.) + posExt = scan(CLI_loadFile,'.',back=.true.) + posSep = scan(CLI_loadFile,'/',back=.true.) - getSolverJobName = getSolverJobName//'_'//interface_loadFile(posSep+1:posExt-1) + getSolverJobName = getSolverJobName//'_'//CLI_loadFile(posSep+1:posExt-1) end function getSolverJobName diff --git a/src/CPFEM2.f90 b/src/CPFEM2.f90 index 909da7f1e..7bf91c3a8 100644 --- a/src/CPFEM2.f90 +++ b/src/CPFEM2.f90 @@ -43,7 +43,7 @@ contains subroutine CPFEM_initAll call parallelization_init - call DAMASK_interface_init ! Spectral and FEM interface to commandline + call CLI_init ! Spectral and FEM interface to commandline call signals_init call prec_init call IO_init @@ -55,18 +55,18 @@ subroutine CPFEM_initAll call YAML_types_init call YAML_parse_init call HDF5_utilities_init - call results_init(restart=interface_restartInc>0) + call results_init(restart=CLI_restartInc>0) call config_init call math_init call rotations_init call polynomials_init call lattice_init #if defined(MESH) - call discretization_mesh_init(restart=interface_restartInc>0) + call discretization_mesh_init(restart=CLI_restartInc>0) #elif defined(GRID) - call discretization_grid_init(restart=interface_restartInc>0) + call discretization_grid_init(restart=CLI_restartInc>0) #endif - call material_init(restart=interface_restartInc>0) + call material_init(restart=CLI_restartInc>0) call phase_init call homogenization_init call CPFEM_init @@ -86,7 +86,7 @@ subroutine CPFEM_init print'(/,1x,a)', '<<<+- CPFEM init -+>>>'; flush(IO_STDOUT) - if (interface_restartInc > 0) then + if (CLI_restartInc > 0) then print'(/,a,i0,a)', ' reading restart information of increment from file'; flush(IO_STDOUT) fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','r') diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index 72cc83452..f28bd324f 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -134,8 +134,8 @@ program DAMASK_grid if (maxCutBack < 0) call IO_error(301,ext_msg='maxCutBack') if (worldrank == 0) then - fileContent = IO_read(interface_loadFile) - fname = interface_loadFile + fileContent = IO_read(CLI_loadFile) + fname = CLI_loadFile if (scan(fname,'/') /= 0) fname = fname(scan(fname,'/',.true.)+1:) call results_openJobFile(parallel=.false.) call results_writeDataset_str(fileContent,'setup',fname,'load case definition (grid solver)') @@ -315,7 +315,7 @@ program DAMASK_grid !-------------------------------------------------------------------------------------------------- ! write header of output file if (worldrank == 0) then - writeHeader: if (interface_restartInc < 1) then + writeHeader: if (CLI_restartInc < 1) then open(newunit=statUnit,file=trim(getSolverJobName())//'.sta',form='FORMATTED',status='REPLACE') write(statUnit,'(a)') 'Increment Time CutbackLevel Converged IterationsNeeded' ! statistics file else writeHeader @@ -324,7 +324,7 @@ program DAMASK_grid endif writeHeader endif - writeUndeformed: if (interface_restartInc < 1) then + writeUndeformed: if (CLI_restartInc < 1) then print'(/,1x,a)', '... writing initial configuration to file .................................' flush(IO_STDOUT) call CPFEM_results(0,0.0_pReal) @@ -348,7 +348,7 @@ program DAMASK_grid endif Delta_t = Delta_t * real(subStepFactor,pReal)**real(-cutBackLevel,pReal) ! depending on cut back level, decrease time step - skipping: if (totalIncsCounter <= interface_restartInc) then ! not yet at restart inc? + skipping: if (totalIncsCounter <= CLI_restartInc) then ! not yet at restart inc? t = t + Delta_t ! just advance time, skip already performed calculation guess = .true. ! QUESTION:why forced guessing instead of inheriting loadcase preference else skipping diff --git a/src/grid/discretization_grid.f90 b/src/grid/discretization_grid.f90 index 3cd779ec0..ec119e11a 100644 --- a/src/grid/discretization_grid.f90 +++ b/src/grid/discretization_grid.f90 @@ -76,14 +76,14 @@ subroutine discretization_grid_init(restart) if (worldrank == 0) then - fileContent = IO_read(interface_geomFile) + fileContent = IO_read(CLI_geomFile) call VTI_readCellsSizeOrigin(cells,geomSize,origin,fileContent) materialAt_global = VTI_readDataset_int(fileContent,'material') + 1 if (any(materialAt_global < 1)) & call IO_error(180,ext_msg='material ID < 1') if (size(materialAt_global) /= product(cells)) & call IO_error(180,ext_msg='mismatch in # of material IDs and cells') - fname = interface_geomFile + fname = CLI_geomFile if (scan(fname,'/') /= 0) fname = fname(scan(fname,'/',.true.)+1:) call results_openJobFile(parallel=.false.) call results_writeDataset_str(fileContent,'setup',fname,'geometry definition (grid solver)') @@ -329,7 +329,7 @@ function discretization_grid_getInitialCondition(label) result(ic) displs, sendcounts if (worldrank == 0) then - ic_global = VTI_readDataset_real(IO_read(interface_geomFile),label) + ic_global = VTI_readDataset_real(IO_read(CLI_geomFile),label) else allocate(ic_global(0)) ! needed for IntelMPI endif diff --git a/src/grid/grid_mech_FEM.f90 b/src/grid/grid_mech_FEM.f90 index 3c42c8c23..cef83e4a3 100644 --- a/src/grid/grid_mech_FEM.f90 +++ b/src/grid/grid_mech_FEM.f90 @@ -231,8 +231,8 @@ subroutine grid_mechanical_FEM_init !-------------------------------------------------------------------------------------------------- ! init fields - restartRead: if (interface_restartInc > 0) then - print'(/,1x,a,i0,a)', 'reading restart data of increment ', interface_restartInc, ' from file' + restartRead: if (CLI_restartInc > 0) then + print'(/,1x,a,i0,a)', 'reading restart data of increment ', CLI_restartInc, ' from file' fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','r') groupHandle = HDF5_openGroup(fileHandle,'solver') @@ -254,7 +254,7 @@ subroutine grid_mechanical_FEM_init call HDF5_read(u_current,groupHandle,'u') call HDF5_read(u_lastInc,groupHandle,'u_lastInc') - elseif (interface_restartInc == 0) then restartRead + elseif (CLI_restartInc == 0) then restartRead F_lastInc = spread(spread(spread(math_I3,3,cells(1)),4,cells(2)),5,cells3) ! initialize to identity F = spread(spread(spread(math_I3,3,cells(1)),4,cells(2)),5,cells3) endif restartRead @@ -269,8 +269,8 @@ subroutine grid_mechanical_FEM_init call DMDAVecRestoreArrayF90(mechanical_grid,solution_lastInc,u_lastInc,err_PETSc) CHKERRQ(err_PETSc) - restartRead2: if (interface_restartInc > 0) then - print'(1x,a,i0,a)', 'reading more restart data of increment ', interface_restartInc, ' from file' + restartRead2: if (CLI_restartInc > 0) then + print'(1x,a,i0,a)', 'reading more restart data of increment ', CLI_restartInc, ' from file' call HDF5_read(C_volAvg,groupHandle,'C_volAvg',.false.) call MPI_Bcast(C_volAvg,81_MPI_INTEGER_KIND,MPI_DOUBLE,0_MPI_INTEGER_KIND,MPI_COMM_WORLD,err_MPI) if(err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index 2f2b73f01..61d17f6bd 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -201,8 +201,8 @@ subroutine grid_mechanical_spectral_basic_init call DMDAVecGetArrayF90(da,solution_vec,F,err_PETSc) ! places pointer on PETSc data CHKERRQ(err_PETSc) - restartRead: if (interface_restartInc > 0) then - print'(/,1x,a,i0,a)', 'reading restart data of increment ', interface_restartInc, ' from file' + restartRead: if (CLI_restartInc > 0) then + print'(/,1x,a,i0,a)', 'reading restart data of increment ', CLI_restartInc, ' from file' fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','r') groupHandle = HDF5_openGroup(fileHandle,'solver') @@ -222,7 +222,7 @@ subroutine grid_mechanical_spectral_basic_init call HDF5_read(F,groupHandle,'F') call HDF5_read(F_lastInc,groupHandle,'F_lastInc') - elseif (interface_restartInc == 0) then restartRead + elseif (CLI_restartInc == 0) then restartRead F_lastInc = spread(spread(spread(math_I3,3,cells(1)),4,cells(2)),5,cells3) ! initialize to identity F = reshape(F_lastInc,[9,cells(1),cells(2),cells3]) end if restartRead @@ -235,8 +235,8 @@ subroutine grid_mechanical_spectral_basic_init call DMDAVecRestoreArrayF90(da,solution_vec,F,err_PETSc) ! deassociate pointer CHKERRQ(err_PETSc) - restartRead2: if (interface_restartInc > 0) then - print'(1x,a,i0,a)', 'reading more restart data of increment ', interface_restartInc, ' from file' + restartRead2: if (CLI_restartInc > 0) then + print'(1x,a,i0,a)', 'reading more restart data of increment ', CLI_restartInc, ' from file' call HDF5_read(C_volAvg,groupHandle,'C_volAvg',.false.) call MPI_Bcast(C_volAvg,81_MPI_INTEGER_KIND,MPI_DOUBLE,0_MPI_INTEGER_KIND,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' diff --git a/src/grid/grid_mech_spectral_polarisation.f90 b/src/grid/grid_mech_spectral_polarisation.f90 index b72cc4232..a75a01016 100644 --- a/src/grid/grid_mech_spectral_polarisation.f90 +++ b/src/grid/grid_mech_spectral_polarisation.f90 @@ -223,8 +223,8 @@ subroutine grid_mechanical_spectral_polarisation_init F => FandF_tau(0: 8,:,:,:) F_tau => FandF_tau(9:17,:,:,:) - restartRead: if (interface_restartInc > 0) then - print'(/,1x,a,i0,a)', 'reading restart data of increment ', interface_restartInc, ' from file' + restartRead: if (CLI_restartInc > 0) then + print'(/,1x,a,i0,a)', 'reading restart data of increment ', CLI_restartInc, ' from file' fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','r') groupHandle = HDF5_openGroup(fileHandle,'solver') @@ -246,7 +246,7 @@ subroutine grid_mechanical_spectral_polarisation_init call HDF5_read(F_tau,groupHandle,'F_tau') call HDF5_read(F_tau_lastInc,groupHandle,'F_tau_lastInc') - elseif (interface_restartInc == 0) then restartRead + elseif (CLI_restartInc == 0) then restartRead F_lastInc = spread(spread(spread(math_I3,3,cells(1)),4,cells(2)),5,cells3) ! initialize to identity F = reshape(F_lastInc,[9,cells(1),cells(2),cells3]) F_tau = 2.0_pReal*F @@ -261,8 +261,8 @@ subroutine grid_mechanical_spectral_polarisation_init call DMDAVecRestoreArrayF90(da,solution_vec,FandF_tau,err_PETSc) ! deassociate pointer CHKERRQ(err_PETSc) - restartRead2: if (interface_restartInc > 0) then - print'(1x,a,i0,a)', 'reading more restart data of increment ', interface_restartInc, ' from file' + restartRead2: if (CLI_restartInc > 0) then + print'(1x,a,i0,a)', 'reading more restart data of increment ', CLI_restartInc, ' from file' call HDF5_read(C_volAvg,groupHandle,'C_volAvg',.false.) call MPI_Bcast(C_volAvg,81_MPI_INTEGER_KIND,MPI_DOUBLE,0_MPI_INTEGER_KIND,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' diff --git a/src/grid/grid_thermal_spectral.f90 b/src/grid/grid_thermal_spectral.f90 index 6bbeabf00..18a79820e 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -140,8 +140,8 @@ subroutine grid_thermal_spectral_init() CHKERRQ(err_PETSc) - restartRead: if (interface_restartInc > 0) then - print'(/,1x,a,i0,a)', 'reading restart data of increment ', interface_restartInc, ' from file' + restartRead: if (CLI_restartInc > 0) then + print'(/,1x,a,i0,a)', 'reading restart data of increment ', CLI_restartInc, ' from file' fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','r') groupHandle = HDF5_openGroup(fileHandle,'solver') From 01e6d31053a31471eabeb448bf322f205addd110 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sat, 23 Apr 2022 12:00:02 -0400 Subject: [PATCH 040/142] use newest PRIVATE --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 002586968..3561f74a5 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 0025869684c70a0ea9afe0b181a48124ce4d6a9e +Subproject commit 3561f74a5852c32e2c3da4dc48090b517cfa8e90 From 553e16ffa3b6be03df663a36355e1e97553c02ba Mon Sep 17 00:00:00 2001 From: Test User Date: Sat, 23 Apr 2022 20:36:11 +0200 Subject: [PATCH 041/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-249-gd2cf972b2 --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index fa4fd9fef..17295dc62 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha6-236-g1f4ee0813 +v3.0.0-alpha6-249-gd2cf972b2 From 91b71fdff8aa38b4669d0b5f03fb2ab18915ecdc Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 24 Apr 2022 04:43:44 +0200 Subject: [PATCH 042/142] systematic naming scheme --- src/CLI.f90 | 6 +++--- src/CPFEM2.f90 | 2 +- src/config.f90 | 14 ++++++-------- src/grid/DAMASK_grid.f90 | 2 +- src/grid/discretization_grid.f90 | 2 +- src/grid/grid_mech_FEM.f90 | 2 +- src/grid/grid_mech_spectral_basic.f90 | 2 +- src/grid/grid_mech_spectral_polarisation.f90 | 2 +- src/grid/grid_thermal_spectral.f90 | 2 +- src/grid/spectral_utilities.f90 | 2 +- src/mesh/DAMASK_mesh.f90 | 4 ++-- src/mesh/discretization_mesh.f90 | 6 +++--- src/mesh/mesh_mech_FEM.f90 | 2 +- src/results.f90 | 4 +++- 14 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/CLI.f90 b/src/CLI.f90 index 15b83ab80..ff3d7349f 100644 --- a/src/CLI.f90 +++ b/src/CLI.f90 @@ -9,7 +9,7 @@ #define PETSC_MINOR_MIN 12 #define PETSC_MINOR_MAX 17 -module DAMASK_interface +module CLI use, intrinsic :: ISO_fortran_env use PETScSys @@ -60,7 +60,7 @@ subroutine CLI_init quit - print'(/,1x,a)', '<<<+- DAMASK_interface init -+>>>' + print'(/,1x,a)', '<<<+- CLI init -+>>>' ! http://patorjk.com/software/taag/#p=display&f=Lean&t=DAMASK%203 #ifdef DEBUG @@ -358,4 +358,4 @@ function makeRelativePath(a,b) end function makeRelativePath -end module DAMASK_interface +end module CLI diff --git a/src/CPFEM2.f90 b/src/CPFEM2.f90 index 7bf91c3a8..186441f3a 100644 --- a/src/CPFEM2.f90 +++ b/src/CPFEM2.f90 @@ -6,7 +6,7 @@ module CPFEM2 use parallelization use signals - use DAMASK_interface + use CLI use prec use IO use YAML_types diff --git a/src/config.f90 b/src/config.f90 index aaf6fee1a..767e3e6c9 100644 --- a/src/config.f90 +++ b/src/config.f90 @@ -1,8 +1,6 @@ !-------------------------------------------------------------------------------------------------- !> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH -!> @brief Reads in the material, numerics & debug configuration from their respective file -!> @details Reads the material configuration file, where solverJobName.yaml takes -!! precedence over material.yaml. +!> @brief Read in the material, numerics & debug configuration from their respective file !-------------------------------------------------------------------------------------------------- module config use IO @@ -28,19 +26,19 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief Real *.yaml configuration files. !-------------------------------------------------------------------------------------------------- -subroutine config_init +subroutine config_init() print'(/,1x,a)', '<<<+- config init -+>>>'; flush(IO_STDOUT) - call parse_material - call parse_numerics - call parse_debug + call parse_material() + call parse_numerics() + call parse_debug() end subroutine config_init !-------------------------------------------------------------------------------------------------- -!> @brief Read material.yaml or .yaml. +!> @brief Read material.yaml. !-------------------------------------------------------------------------------------------------- subroutine parse_material() diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index f28bd324f..a290ac194 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -16,7 +16,7 @@ program DAMASK_grid use prec use parallelization use signals - use DAMASK_interface + use CLI use IO use config use math diff --git a/src/grid/discretization_grid.f90 b/src/grid/discretization_grid.f90 index ec119e11a..ddb36a246 100644 --- a/src/grid/discretization_grid.f90 +++ b/src/grid/discretization_grid.f90 @@ -15,7 +15,7 @@ module discretization_grid use parallelization use system_routines use VTI - use DAMASK_interface + use CLI use IO use config use results diff --git a/src/grid/grid_mech_FEM.f90 b/src/grid/grid_mech_FEM.f90 index cef83e4a3..53d788987 100644 --- a/src/grid/grid_mech_FEM.f90 +++ b/src/grid/grid_mech_FEM.f90 @@ -15,7 +15,7 @@ module grid_mechanical_FEM use prec use parallelization - use DAMASK_interface + use CLI use IO use HDF5 use HDF5_utilities diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index 61d17f6bd..c0b85d00e 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -15,7 +15,7 @@ module grid_mechanical_spectral_basic use prec use parallelization - use DAMASK_interface + use CLI use IO use HDF5 use HDF5_utilities diff --git a/src/grid/grid_mech_spectral_polarisation.f90 b/src/grid/grid_mech_spectral_polarisation.f90 index a75a01016..ec27c7390 100644 --- a/src/grid/grid_mech_spectral_polarisation.f90 +++ b/src/grid/grid_mech_spectral_polarisation.f90 @@ -15,7 +15,7 @@ module grid_mechanical_spectral_polarisation use prec use parallelization - use DAMASK_interface + use CLI use IO use HDF5 use HDF5_utilities diff --git a/src/grid/grid_thermal_spectral.f90 b/src/grid/grid_thermal_spectral.f90 index 18a79820e..8483fe336 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -16,7 +16,7 @@ module grid_thermal_spectral use prec use parallelization use IO - use DAMASK_interface + use CLI use HDF5_utilities use HDF5 use spectral_utilities diff --git a/src/grid/spectral_utilities.f90 b/src/grid/spectral_utilities.f90 index 4375ec860..c8321f83f 100644 --- a/src/grid/spectral_utilities.f90 +++ b/src/grid/spectral_utilities.f90 @@ -13,7 +13,7 @@ module spectral_utilities #endif use prec - use DAMASK_interface + use CLI use parallelization use math use rotations diff --git a/src/mesh/DAMASK_mesh.f90 b/src/mesh/DAMASK_mesh.f90 index 065eca1cb..85ce0e922 100644 --- a/src/mesh/DAMASK_mesh.f90 +++ b/src/mesh/DAMASK_mesh.f90 @@ -10,7 +10,7 @@ program DAMASK_mesh #include use PetscDM use prec - use DAMASK_interface + use CLI use parallelization use IO use math @@ -104,7 +104,7 @@ program DAMASK_mesh !-------------------------------------------------------------------------------------------------- ! reading basic information from load case file and allocate data structure containing load cases - fileContent = IO_readlines(trim(interface_loadFile)) + fileContent = IO_readlines(trim(CLI_loadFile)) do l = 1, size(fileContent) line = fileContent(l) if (IO_isBlank(line)) cycle ! skip empty lines diff --git a/src/mesh/discretization_mesh.f90 b/src/mesh/discretization_mesh.f90 index 70ee28343..b898c4e6b 100644 --- a/src/mesh/discretization_mesh.f90 +++ b/src/mesh/discretization_mesh.f90 @@ -15,7 +15,7 @@ module discretization_mesh use MPI_f08 #endif - use DAMASK_interface + use CLI use parallelization use IO use config @@ -101,9 +101,9 @@ subroutine discretization_mesh_init(restart) debug_ip = config_debug%get_asInt('integrationpoint',defaultVal=1) #if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>16) - call DMPlexCreateFromFile(PETSC_COMM_WORLD,interface_geomFile,'n/a',PETSC_TRUE,globalMesh,err_PETSc) + call DMPlexCreateFromFile(PETSC_COMM_WORLD,CLI_geomFile,'n/a',PETSC_TRUE,globalMesh,err_PETSc) #else - call DMPlexCreateFromFile(PETSC_COMM_WORLD,interface_geomFile,PETSC_TRUE,globalMesh,err_PETSc) + call DMPlexCreateFromFile(PETSC_COMM_WORLD,CLI_geomFile,PETSC_TRUE,globalMesh,err_PETSc) #endif CHKERRQ(err_PETSc) call DMGetDimension(globalMesh,dimPlex,err_PETSc) diff --git a/src/mesh/mesh_mech_FEM.f90 b/src/mesh/mesh_mech_FEM.f90 index 8cf9dbfa1..474faa4ae 100644 --- a/src/mesh/mesh_mech_FEM.f90 +++ b/src/mesh/mesh_mech_FEM.f90 @@ -20,7 +20,7 @@ module mesh_mechanical_FEM use FEM_utilities use discretization use discretization_mesh - use DAMASK_interface + use CLI use config use IO use FEM_quadrature diff --git a/src/results.f90 b/src/results.f90 index 9fccff03e..bd7f7d34d 100644 --- a/src/results.f90 +++ b/src/results.f90 @@ -6,17 +6,19 @@ !-------------------------------------------------------------------------------------------------- module results use prec - use DAMASK_interface use parallelization use IO use HDF5_utilities use HDF5 #ifdef PETSC + use CLI #include use PETScSys #if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>14) && !defined(PETSC_HAVE_MPI_F90MODULE_VISIBILITY) use MPI_f08 #endif +#else + use DAMASK_interface #endif implicit none From 26ab0365be98cff7444ae81baebfb3dea8f96d15 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 24 Apr 2022 17:30:37 +0200 Subject: [PATCH 043/142] only used by the grid solver --- src/{ => grid}/VTI.f90 | 0 src/{ => grid}/base64.f90 | 0 src/{ => grid}/zlib.f90 | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename src/{ => grid}/VTI.f90 (100%) rename src/{ => grid}/base64.f90 (100%) rename src/{ => grid}/zlib.f90 (100%) diff --git a/src/VTI.f90 b/src/grid/VTI.f90 similarity index 100% rename from src/VTI.f90 rename to src/grid/VTI.f90 diff --git a/src/base64.f90 b/src/grid/base64.f90 similarity index 100% rename from src/base64.f90 rename to src/grid/base64.f90 diff --git a/src/zlib.f90 b/src/grid/zlib.f90 similarity index 100% rename from src/zlib.f90 rename to src/grid/zlib.f90 From d41d03015a8db35b8a0bacb2c2c5da6297592406 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 24 Apr 2022 17:35:59 +0200 Subject: [PATCH 044/142] better matching name --- src/CMakeLists.txt | 2 +- src/DAMASK_Marc.f90 | 24 ++--- src/commercialFEM_fileList.f90 | 2 +- src/grid/DAMASK_grid.f90 | 12 +-- src/{CPFEM.f90 => materialpoint.f90} | 126 ++++++++++++------------- src/{CPFEM2.f90 => materialpoint2.f90} | 28 +++--- src/mesh/DAMASK_mesh.f90 | 8 +- 7 files changed, 101 insertions(+), 101 deletions(-) rename src/{CPFEM.f90 => materialpoint.f90} (67%) rename src/{CPFEM2.f90 => materialpoint2.f90} (88%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 82efe8748..ff24066de 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,7 +7,7 @@ endif() file(GLOB damask-sources CONFIGURE_DEPENDS *.f90 *.c) # probably we should have a subfolder for MSC.Marc -list(FILTER damask-sources EXCLUDE REGEX ".*CPFEM.f90") +list(FILTER damask-sources EXCLUDE REGEX ".*materialpoint.f90") list(FILTER damask-sources EXCLUDE REGEX ".*DAMASK_Marc.*.f90") list(FILTER damask-sources EXCLUDE REGEX ".*commercialFEM_fileList.*.f90") diff --git a/src/DAMASK_Marc.f90 b/src/DAMASK_Marc.f90 index 6e969ced4..22e6261ca 100644 --- a/src/DAMASK_Marc.f90 +++ b/src/DAMASK_Marc.f90 @@ -160,7 +160,7 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & use YAML_types use discretization_marc use homogenization - use CPFEM + use materialpoint implicit none include "omp_lib.h" ! the openMP function library @@ -232,7 +232,7 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & logical, save :: & lastIncConverged = .false., & !< needs description outdatedByNewInc = .false., & !< needs description - CPFEM_init_done = .false., & !< remember whether init has been done already + materialpoint_init_done = .false., & !< remember whether init has been done already debug_basic = .true. class(tNode), pointer :: & debug_Marc ! pointer to Marc debug options @@ -255,9 +255,9 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & defaultNumThreadsInt = omp_get_num_threads() ! remember number of threads set by Marc call omp_set_num_threads(1_pI32) ! no openMP - if (.not. CPFEM_init_done) then - CPFEM_init_done = .true. - call CPFEM_initAll + if (.not. materialpoint_init_done) then + materialpoint_init_done = .true. + call materialpoint_initAll debug_Marc => config_debug%get('Marc',defaultVal=emptyList) debug_basic = debug_Marc%contains('basic') endif @@ -265,9 +265,9 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & computationMode = 0 ! save initialization value, since it does not result in any calculation if (lovl == 4 ) then ! jacobian requested by marc if (timinc < theDelta .and. theInc == inc .and. lastLovl /= lovl) & ! first after cutback - computationMode = CPFEM_RESTOREJACOBIAN + computationMode = materialpoint_RESTOREJACOBIAN elseif (lovl == 6) then ! stress requested by marc - computationMode = CPFEM_CALCRESULTS + computationMode = materialpoint_CALCRESULTS if (cptim > theTime .or. inc /= theInc) then ! reached "convergence" terminallyIll = .false. cycleCounter = -1 ! first calc step increments this to cycle = 0 @@ -300,11 +300,11 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & !call mesh_build_ipCoordinates() ! update ip coordinates endif if (outdatedByNewInc) then - computationMode = ior(computationMode,CPFEM_AGERESULTS) + computationMode = ior(computationMode,materialpoint_AGERESULTS) outdatedByNewInc = .false. endif if (lastIncConverged) then - computationMode = ior(computationMode,CPFEM_BACKUPJACOBIAN) + computationMode = ior(computationMode,materialpoint_BACKUPJACOBIAN) lastIncConverged = .false. endif @@ -315,7 +315,7 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & endif lastLovl = lovl - call CPFEM_general(computationMode,ffn,ffn1,t(1),timinc,m(1),nn,stress,ddsdde) + call materialpoint_general(computationMode,ffn,ffn1,t(1),timinc,m(1),nn,stress,ddsdde) d = ddsdde(1:ngens,1:ngens) s = stress(1:ndi+nshear) @@ -359,7 +359,7 @@ subroutine flux(f,ts,n,time) !-------------------------------------------------------------------------------------------------- subroutine uedinc(inc,incsub) use prec - use CPFEM + use materialpoint use discretization_marc implicit none @@ -380,7 +380,7 @@ subroutine uedinc(inc,incsub) enddo call discretization_marc_UpdateNodeAndIpCoords(d_n) - call CPFEM_results(inc,cptim) + call materialpoint_results(inc,cptim) inc_written = inc endif diff --git a/src/commercialFEM_fileList.f90 b/src/commercialFEM_fileList.f90 index 8dbbea706..8bcf2f454 100644 --- a/src/commercialFEM_fileList.f90 +++ b/src/commercialFEM_fileList.f90 @@ -51,4 +51,4 @@ #include "homogenization_thermal_isotemperature.f90" #include "homogenization_damage.f90" #include "homogenization_damage_pass.f90" -#include "CPFEM.f90" +#include "materialpoint.f90" diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index 39870a8ff..e42912b23 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -19,7 +19,7 @@ program DAMASK_grid use IO use config use math - use CPFEM2 + use materialpoint2 use material use spectral_utilities use grid_mechanical_spectral_basic @@ -116,7 +116,7 @@ program DAMASK_grid !-------------------------------------------------------------------------------------------------- ! init DAMASK (all modules) - call CPFEM_initAll + call materialpoint_initAll() print'(/,1x,a)', '<<<+- DAMASK_grid init -+>>>'; flush(IO_STDOUT) print'(/,1x,a)', 'P. Shanthraj et al., Handbook of Mechanics of Materials, 2019' @@ -326,7 +326,7 @@ program DAMASK_grid writeUndeformed: if (interface_restartInc < 1) then print'(/,1x,a)', '... writing initial configuration to file .................................' flush(IO_STDOUT) - call CPFEM_results(0,0.0_pReal) + call materialpoint_results(0,0.0_pReal) endif writeUndeformed loadCaseLooping: do l = 1, size(loadCases) @@ -386,7 +386,7 @@ program DAMASK_grid case(FIELD_DAMAGE_ID); call grid_damage_spectral_forward(cutBack) end select enddo - if (.not. cutBack) call CPFEM_forward + if (.not. cutBack) call materialpoint_forward !-------------------------------------------------------------------------------------------------- ! solve fields @@ -453,7 +453,7 @@ program DAMASK_grid if (mod(inc,loadCases(l)%f_out) == 0 .or. signal) then print'(/,1x,a)', '... writing results to file ...............................................' flush(IO_STDOUT) - call CPFEM_results(totalIncsCounter,t) + call materialpoint_results(totalIncsCounter,t) endif if (signal) call interface_setSIGUSR1(.false.) call MPI_Allreduce(interface_SIGUSR2,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI) @@ -467,7 +467,7 @@ program DAMASK_grid call grid_thermal_spectral_restartWrite end select end do - call CPFEM_restartWrite + call materialpoint_restartWrite endif if (signal) call interface_setSIGUSR2(.false.) call MPI_Allreduce(interface_SIGTERM,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI) diff --git a/src/CPFEM.f90 b/src/materialpoint.f90 similarity index 67% rename from src/CPFEM.f90 rename to src/materialpoint.f90 index 37e4ba737..743113036 100644 --- a/src/CPFEM.f90 +++ b/src/materialpoint.f90 @@ -1,9 +1,9 @@ !-------------------------------------------------------------------------------------------------- !> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH -!> @brief CPFEM engine +!> @brief materialpoint engine !-------------------------------------------------------------------------------------------------- -module CPFEM +module materialpoint use DAMASK_interface use prec use IO @@ -27,24 +27,24 @@ module CPFEM private real(pReal), dimension (:,:,:), allocatable, private :: & - CPFEM_cs !< Cauchy stress + materialpoint_cs !< Cauchy stress real(pReal), dimension (:,:,:,:), allocatable, private :: & - CPFEM_dcsdE !< Cauchy stress tangent + materialpoint_dcsdE !< Cauchy stress tangent real(pReal), dimension (:,:,:,:), allocatable, private :: & - CPFEM_dcsdE_knownGood !< known good tangent + materialpoint_dcsdE_knownGood !< known good tangent integer, public :: & cycleCounter = 0 !< needs description integer, parameter, public :: & - CPFEM_CALCRESULTS = 2**0, & - CPFEM_AGERESULTS = 2**1, & - CPFEM_BACKUPJACOBIAN = 2**2, & - CPFEM_RESTOREJACOBIAN = 2**3 + materialpoint_CALCRESULTS = 2**0, & + materialpoint_AGERESULTS = 2**1, & + materialpoint_BACKUPJACOBIAN = 2**2, & + materialpoint_RESTOREJACOBIAN = 2**3 type, private :: tNumerics integer :: & - iJacoStiffness !< frequency of stiffness update + iJacoStiffness !< frequency of stiffness update end type tNumerics type(tNumerics), private :: num @@ -59,12 +59,12 @@ module CPFEM ip end type tDebugOptions - type(tDebugOptions), private :: debugCPFEM + type(tDebugOptions), private :: debugmaterialpoint public :: & - CPFEM_general, & - CPFEM_initAll, & - CPFEM_results + materialpoint_general, & + materialpoint_initAll, & + materialpoint_results contains @@ -72,7 +72,7 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief Initialize all modules. !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_initAll +subroutine materialpoint_initAll call DAMASK_interface_init call prec_init @@ -90,50 +90,50 @@ subroutine CPFEM_initAll call material_init(.false.) call phase_init call homogenization_init - call CPFEM_init + call materialpoint_init call config_deallocate -end subroutine CPFEM_initAll +end subroutine materialpoint_initAll !-------------------------------------------------------------------------------------------------- -!> @brief allocate the arrays defined in module CPFEM and initialize them +!> @brief allocate the arrays defined in module materialpoint and initialize them !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_init +subroutine materialpoint_init class(tNode), pointer :: & - debug_CPFEM + debug_materialpoint - print'(/,1x,a)', '<<<+- CPFEM init -+>>>'; flush(IO_STDOUT) + print'(/,1x,a)', '<<<+- materialpoint init -+>>>'; flush(IO_STDOUT) - allocate(CPFEM_cs( 6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal) - allocate(CPFEM_dcsdE( 6,6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal) - allocate(CPFEM_dcsdE_knownGood(6,6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal) + allocate(materialpoint_cs( 6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal) + allocate(materialpoint_dcsdE( 6,6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal) + allocate(materialpoint_dcsdE_knownGood(6,6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal) !------------------------------------------------------------------------------ ! read debug options - debug_CPFEM => config_debug%get('CPFEM',defaultVal=emptyList) - debugCPFEM%basic = debug_CPFEM%contains('basic') - debugCPFEM%extensive = debug_CPFEM%contains('extensive') - debugCPFEM%selective = debug_CPFEM%contains('selective') - debugCPFEM%element = config_debug%get_asInt('element',defaultVal = 1) - debugCPFEM%ip = config_debug%get_asInt('integrationpoint',defaultVal = 1) + debug_materialpoint => config_debug%get('materialpoint',defaultVal=emptyList) + debugmaterialpoint%basic = debug_materialpoint%contains('basic') + debugmaterialpoint%extensive = debug_materialpoint%contains('extensive') + debugmaterialpoint%selective = debug_materialpoint%contains('selective') + debugmaterialpoint%element = config_debug%get_asInt('element',defaultVal = 1) + debugmaterialpoint%ip = config_debug%get_asInt('integrationpoint',defaultVal = 1) - if(debugCPFEM%basic) then - print'(a32,1x,6(i8,1x))', 'CPFEM_cs: ', shape(CPFEM_cs) - print'(a32,1x,6(i8,1x))', 'CPFEM_dcsdE: ', shape(CPFEM_dcsdE) - print'(a32,1x,6(i8,1x),/)', 'CPFEM_dcsdE_knownGood: ', shape(CPFEM_dcsdE_knownGood) + if(debugmaterialpoint%basic) then + print'(a32,1x,6(i8,1x))', 'materialpoint_cs: ', shape(materialpoint_cs) + print'(a32,1x,6(i8,1x))', 'materialpoint_dcsdE: ', shape(materialpoint_dcsdE) + print'(a32,1x,6(i8,1x),/)', 'materialpoint_dcsdE_knownGood: ', shape(materialpoint_dcsdE_knownGood) flush(IO_STDOUT) endif -end subroutine CPFEM_init +end subroutine materialpoint_init !-------------------------------------------------------------------------------------------------- !> @brief perform initialization at first call, update variables and call the actual material model !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyStress, jacobian) +subroutine materialpoint_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyStress, jacobian) integer, intent(in) :: elFE, & !< FE element number ip !< integration point number @@ -161,7 +161,7 @@ subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyS elCP = discretization_Marc_FEM2DAMASK_elem(elFE) ce = discretization_Marc_FEM2DAMASK_cell(ip,elFE) - if (debugCPFEM%basic .and. elCP == debugCPFEM%element .and. ip == debugCPFEM%ip) then + if (debugmaterialpoint%basic .and. elCP == debugmaterialpoint%element .and. ip == debugmaterialpoint%ip) then print'(/,a)', '#############################################' print'(a1,a22,1x,i8,a13)', '#','element', elCP, '#' print'(a1,a22,1x,i8,a13)', '#','ip', ip, '#' @@ -172,26 +172,26 @@ subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyS print'(a,/)', '#############################################'; flush (6) endif - if (iand(mode, CPFEM_BACKUPJACOBIAN) /= 0) & - CPFEM_dcsde_knownGood = CPFEM_dcsde - if (iand(mode, CPFEM_RESTOREJACOBIAN) /= 0) & - CPFEM_dcsde = CPFEM_dcsde_knownGood + if (iand(mode, materialpoint_BACKUPJACOBIAN) /= 0) & + materialpoint_dcsde_knownGood = materialpoint_dcsde + if (iand(mode, materialpoint_RESTOREJACOBIAN) /= 0) & + materialpoint_dcsde = materialpoint_dcsde_knownGood - if (iand(mode, CPFEM_AGERESULTS) /= 0) call CPFEM_forward + if (iand(mode, materialpoint_AGERESULTS) /= 0) call materialpoint_forward homogenization_F0(1:3,1:3,ce) = ffn homogenization_F(1:3,1:3,ce) = ffn1 - if (iand(mode, CPFEM_CALCRESULTS) /= 0) then + if (iand(mode, materialpoint_CALCRESULTS) /= 0) then validCalculation: if (terminallyIll) then call random_number(rnd) if (rnd < 0.5_pReal) rnd = rnd - 1.0_pReal - CPFEM_cs(1:6,ip,elCP) = ODD_STRESS * rnd - CPFEM_dcsde(1:6,1:6,ip,elCP) = ODD_JACOBIAN * math_eye(6) + materialpoint_cs(1:6,ip,elCP) = ODD_STRESS * rnd + materialpoint_dcsde(1:6,1:6,ip,elCP) = ODD_JACOBIAN * math_eye(6) else validCalculation - if (debugCPFEM%extensive) print'(a,i8,1x,i2)', '<< CPFEM >> calculation for elFE ip ',elFE,ip + if (debugmaterialpoint%extensive) print'(a,i8,1x,i2)', '<< materialpoint >> calculation for elFE ip ',elFE,ip call homogenization_mechanical_response(dt,(elCP-1)*discretization_nIPs + ip,(elCP-1)*discretization_nIPs + ip) if (.not. terminallyIll) & call homogenization_mechanical_response2(dt,[ip,ip],[elCP,elCP]) @@ -200,15 +200,15 @@ subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyS call random_number(rnd) if (rnd < 0.5_pReal) rnd = rnd - 1.0_pReal - CPFEM_cs(1:6,ip,elCP) = ODD_STRESS * rnd - CPFEM_dcsde(1:6,1:6,ip,elCP) = ODD_JACOBIAN * math_eye(6) + materialpoint_cs(1:6,ip,elCP) = ODD_STRESS * rnd + materialpoint_dcsde(1:6,1:6,ip,elCP) = ODD_JACOBIAN * math_eye(6) else terminalIllness ! translate from P to sigma Kirchhoff = matmul(homogenization_P(1:3,1:3,ce), transpose(homogenization_F(1:3,1:3,ce))) J_inverse = 1.0_pReal / math_det33(homogenization_F(1:3,1:3,ce)) - CPFEM_cs(1:6,ip,elCP) = math_sym33to6(J_inverse * Kirchhoff,weighted=.false.) + materialpoint_cs(1:6,ip,elCP) = math_sym33to6(J_inverse * Kirchhoff,weighted=.false.) ! translate from dP/dF to dCS/dE H = 0.0_pReal @@ -224,45 +224,45 @@ subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyS forall(i=1:3, j=1:3,k=1:3,l=1:3) & H_sym(i,j,k,l) = 0.25_pReal * (H(i,j,k,l) + H(j,i,k,l) + H(i,j,l,k) + H(j,i,l,k)) - CPFEM_dcsde(1:6,1:6,ip,elCP) = math_sym3333to66(J_inverse * H_sym,weighted=.false.) + materialpoint_dcsde(1:6,1:6,ip,elCP) = math_sym3333to66(J_inverse * H_sym,weighted=.false.) endif terminalIllness endif validCalculation - if (debugCPFEM%extensive & - .and. ((debugCPFEM%element == elCP .and. debugCPFEM%ip == ip) .or. .not. debugCPFEM%selective)) then + if (debugmaterialpoint%extensive & + .and. ((debugmaterialpoint%element == elCP .and. debugmaterialpoint%ip == ip) .or. .not. debugmaterialpoint%selective)) then print'(a,i8,1x,i2,/,12x,6(f10.3,1x)/)', & - '<< CPFEM >> stress/MPa at elFE ip ', elFE, ip, CPFEM_cs(1:6,ip,elCP)*1.0e-6_pReal + '<< materialpoint >> stress/MPa at elFE ip ', elFE, ip, materialpoint_cs(1:6,ip,elCP)*1.0e-6_pReal print'(a,i8,1x,i2,/,6(12x,6(f10.3,1x)/))', & - '<< CPFEM >> Jacobian/GPa at elFE ip ', elFE, ip, transpose(CPFEM_dcsdE(1:6,1:6,ip,elCP))*1.0e-9_pReal + '<< materialpoint >> Jacobian/GPa at elFE ip ', elFE, ip, transpose(materialpoint_dcsdE(1:6,1:6,ip,elCP))*1.0e-9_pReal flush(IO_STDOUT) endif endif - if (all(abs(CPFEM_dcsdE(1:6,1:6,ip,elCP)) < 1e-10_pReal)) call IO_warning(601,elCP,ip) + if (all(abs(materialpoint_dcsdE(1:6,1:6,ip,elCP)) < 1e-10_pReal)) call IO_warning(601,elCP,ip) - cauchyStress = CPFEM_cs (1:6, ip,elCP) - jacobian = CPFEM_dcsdE(1:6,1:6,ip,elCP) + cauchyStress = materialpoint_cs (1:6, ip,elCP) + jacobian = materialpoint_dcsdE(1:6,1:6,ip,elCP) -end subroutine CPFEM_general +end subroutine materialpoint_general !-------------------------------------------------------------------------------------------------- !> @brief Forward data for new time increment. !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_forward +subroutine materialpoint_forward call homogenization_forward call phase_forward -end subroutine CPFEM_forward +end subroutine materialpoint_forward !-------------------------------------------------------------------------------------------------- !> @brief Trigger writing of results. !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_results(inc,time) +subroutine materialpoint_results(inc,time) integer, intent(in) :: inc real(pReal), intent(in) :: time @@ -275,6 +275,6 @@ subroutine CPFEM_results(inc,time) call results_finalizeIncrement call results_closeJobFile -end subroutine CPFEM_results +end subroutine materialpoint_results -end module CPFEM +end module materialpoint diff --git a/src/CPFEM2.f90 b/src/materialpoint2.f90 similarity index 88% rename from src/CPFEM2.f90 rename to src/materialpoint2.f90 index b24ba5480..36eefefb2 100644 --- a/src/CPFEM2.f90 +++ b/src/materialpoint2.f90 @@ -3,7 +3,7 @@ !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH !> @brief needs a good name and description !-------------------------------------------------------------------------------------------------- -module CPFEM2 +module materialpoint2 use parallelization use DAMASK_interface use prec @@ -40,7 +40,7 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief Initialize all modules. !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_initAll +subroutine materialpoint_initAll call parallelization_init call DAMASK_interface_init ! Spectral and FEM interface to commandline @@ -68,21 +68,21 @@ subroutine CPFEM_initAll call material_init(restart=interface_restartInc>0) call phase_init call homogenization_init - call CPFEM_init + call materialpoint_init call config_deallocate -end subroutine CPFEM_initAll +end subroutine materialpoint_initAll !-------------------------------------------------------------------------------------------------- !> @brief Read restart information if needed. !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_init +subroutine materialpoint_init integer(HID_T) :: fileHandle - print'(/,1x,a)', '<<<+- CPFEM init -+>>>'; flush(IO_STDOUT) + print'(/,1x,a)', '<<<+- materialpoint init -+>>>'; flush(IO_STDOUT) if (interface_restartInc > 0) then @@ -96,13 +96,13 @@ subroutine CPFEM_init call HDF5_closeFile(fileHandle) endif -end subroutine CPFEM_init +end subroutine materialpoint_init !-------------------------------------------------------------------------------------------------- !> @brief Write restart information. !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_restartWrite +subroutine materialpoint_restartWrite integer(HID_T) :: fileHandle @@ -116,24 +116,24 @@ subroutine CPFEM_restartWrite call HDF5_closeFile(fileHandle) -end subroutine CPFEM_restartWrite +end subroutine materialpoint_restartWrite !-------------------------------------------------------------------------------------------------- !> @brief Forward data for new time increment. !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_forward +subroutine materialpoint_forward call homogenization_forward call phase_forward -end subroutine CPFEM_forward +end subroutine materialpoint_forward !-------------------------------------------------------------------------------------------------- !> @brief Trigger writing of results. !-------------------------------------------------------------------------------------------------- -subroutine CPFEM_results(inc,time) +subroutine materialpoint_results(inc,time) integer, intent(in) :: inc real(pReal), intent(in) :: time @@ -146,6 +146,6 @@ subroutine CPFEM_results(inc,time) call results_finalizeIncrement call results_closeJobFile -end subroutine CPFEM_results +end subroutine materialpoint_results -end module CPFEM2 +end module materialpoint2 diff --git a/src/mesh/DAMASK_mesh.f90 b/src/mesh/DAMASK_mesh.f90 index 065eca1cb..b066611d8 100644 --- a/src/mesh/DAMASK_mesh.f90 +++ b/src/mesh/DAMASK_mesh.f90 @@ -14,7 +14,7 @@ program DAMASK_mesh use parallelization use IO use math - use CPFEM2 + use materialpoint2 use config use discretization_mesh use FEM_Utilities @@ -85,7 +85,7 @@ program DAMASK_mesh !-------------------------------------------------------------------------------------------------- ! init DAMASK (all modules) - call CPFEM_initAll + call materialpoint_initAll() print'(/,1x,a)', '<<<+- DAMASK_mesh init -+>>>'; flush(IO_STDOUT) !--------------------------------------------------------------------- @@ -239,7 +239,7 @@ program DAMASK_mesh print'(/,1x,a)', '... writing initial configuration to file .................................' flush(IO_STDOUT) - call CPFEM_results(0,0.0_pReal) + call materialpoint_results(0,0.0_pReal) loadCaseLooping: do currentLoadCase = 1, size(loadCases) time0 = time ! load case start time @@ -325,7 +325,7 @@ program DAMASK_mesh if (mod(inc,loadCases(currentLoadCase)%outputFrequency) == 0) then ! at output frequency print'(/,1x,a)', '... writing results to file ...............................................' call FEM_mechanical_updateCoords - call CPFEM_results(totalIncsCounter,time) + call materialpoint_results(totalIncsCounter,time) end if From 9979062c6ed35a2c2840bbf0af480766dcde4b67 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 24 Apr 2022 17:44:20 +0200 Subject: [PATCH 045/142] use correct location and capitalized preprocessor macro --- install/MarcMentat/2020/Marc_tools/include_linux64.patch | 6 +++--- install/MarcMentat/2021.2/Marc_tools/include_linux64.patch | 6 +++--- .../MarcMentat/2021.3.1/Marc_tools/include_linux64.patch | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/install/MarcMentat/2020/Marc_tools/include_linux64.patch b/install/MarcMentat/2020/Marc_tools/include_linux64.patch index 133ca07cb..043b887f0 100644 --- a/install/MarcMentat/2020/Marc_tools/include_linux64.patch +++ b/install/MarcMentat/2020/Marc_tools/include_linux64.patch @@ -56,15 +56,15 @@ + +# DAMASK compiler calls: additional flags are in line 2 OpenMP flags in line 3 +DFORTLOWMP="$FCOMP -c -O0 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ -+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD" +DFORTRANMP="$FCOMP -c -O1 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ -+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD" +DFORTHIGHMP="$FCOMP -c -O3 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ -+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD" diff --git a/install/MarcMentat/2021.2/Marc_tools/include_linux64.patch b/install/MarcMentat/2021.2/Marc_tools/include_linux64.patch index 452618457..e8dede2ea 100644 --- a/install/MarcMentat/2021.2/Marc_tools/include_linux64.patch +++ b/install/MarcMentat/2021.2/Marc_tools/include_linux64.patch @@ -56,15 +56,15 @@ + +# DAMASK compiler calls +DFORTLOWMP="$FCOMP -c -O0 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ -+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2021.2 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" +DFORTRANMP="$FCOMP -c -O1 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ -+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2021.2 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" +DFORTHIGHMP="$FCOMP -c -O3 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ -+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2021.2 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" diff --git a/install/MarcMentat/2021.3.1/Marc_tools/include_linux64.patch b/install/MarcMentat/2021.3.1/Marc_tools/include_linux64.patch index 4adec9db1..f0276bb62 100644 --- a/install/MarcMentat/2021.3.1/Marc_tools/include_linux64.patch +++ b/install/MarcMentat/2021.3.1/Marc_tools/include_linux64.patch @@ -55,15 +55,15 @@ + +# DAMASK compiler calls +DFORTLOWMP="$FCOMP -c -O0 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ -+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2021.3.1 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" +DFORTRANMP="$FCOMP -c -O1 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ -+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2021.3.1 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" +DFORTHIGHMP="$FCOMP -c -O3 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ -+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2021.3.1 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ + $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" + From 1b9c0713cbe630ea8a67ebe534ee1a539f340268 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 24 Apr 2022 17:47:26 +0200 Subject: [PATCH 046/142] symlink was broken --- python/README | 1 - python/README.md | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 120000 python/README create mode 120000 python/README.md diff --git a/python/README b/python/README deleted file mode 120000 index 59a23c461..000000000 --- a/python/README +++ /dev/null @@ -1 +0,0 @@ -../README \ No newline at end of file diff --git a/python/README.md b/python/README.md new file mode 120000 index 000000000..32d46ee88 --- /dev/null +++ b/python/README.md @@ -0,0 +1 @@ +../README.md \ No newline at end of file From 7a4097d52bab1f7dba48f8f569e6074a5fafcdd2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 24 Apr 2022 18:50:23 +0200 Subject: [PATCH 047/142] Marc code belongs to Marc subfolder --- python/damask/solver/_marc.py | 2 +- src/CMakeLists.txt | 4 --- src/{ => Marc}/DAMASK_Marc.f90 | 59 ++++++++++++++++++++++++++++++---- src/commercialFEM_fileList.f90 | 54 ------------------------------- src/materialpoint.f90 | 2 +- 5 files changed, 55 insertions(+), 66 deletions(-) rename src/{ => Marc}/DAMASK_Marc.f90 (91%) delete mode 100644 src/commercialFEM_fileList.f90 diff --git a/python/damask/solver/_marc.py b/python/damask/solver/_marc.py index 135736d14..3d006d27b 100644 --- a/python/damask/solver/_marc.py +++ b/python/damask/solver/_marc.py @@ -64,7 +64,7 @@ class Marc: Defaults to ''. """ - usersub = (self.damask_root/'src/DAMASK_Marc').with_suffix('.f90' if compile else '.marc') + usersub = (self.damask_root/'src/Marc/DAMASK_Marc').with_suffix('.f90' if compile else '.marc') if not usersub.is_file(): raise FileNotFoundError(f'subroutine ({"source" if compile else "binary"}) "{usersub}" not found') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ff24066de..0d1f71b30 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,11 +6,7 @@ endif() file(GLOB damask-sources CONFIGURE_DEPENDS *.f90 *.c) -# probably we should have a subfolder for MSC.Marc list(FILTER damask-sources EXCLUDE REGEX ".*materialpoint.f90") -list(FILTER damask-sources EXCLUDE REGEX ".*DAMASK_Marc.*.f90") -list(FILTER damask-sources EXCLUDE REGEX ".*commercialFEM_fileList.*.f90") - if(PROJECT_NAME STREQUAL "damask-grid") set(executable-name "DAMASK_grid") diff --git a/src/DAMASK_Marc.f90 b/src/Marc/DAMASK_Marc.f90 similarity index 91% rename from src/DAMASK_Marc.f90 rename to src/Marc/DAMASK_Marc.f90 index 22e6261ca..da9702dc6 100644 --- a/src/DAMASK_Marc.f90 +++ b/src/Marc/DAMASK_Marc.f90 @@ -15,7 +15,7 @@ #define MARC4DAMASK Marc4DAMASK #endif -#include "prec.f90" +#include "../prec.f90" module DAMASK_interface use prec @@ -139,8 +139,55 @@ end function solverIsSymmetric end module DAMASK_interface - -#include "commercialFEM_fileList.f90" +#include "../parallelization.f90" +#include "../constants.f90" +#include "../IO.f90" +#include "../YAML_types.f90" +#include "../YAML_parse.f90" +#include "../HDF5_utilities.f90" +#include "../results.f90" +#include "../config.f90" +#include "../LAPACK_interface.f90" +#include "../math.f90" +#include "../rotations.f90" +#include "../polynomials.f90" +#include "../lattice.f90" +#include "../element.f90" +#include "../geometry_plastic_nonlocal.f90" +#include "../discretization.f90" +#include "discretization_Marc.f90" +#include "../material.f90" +#include "../phase.f90" +#include "../phase_mechanical.f90" +#include "../phase_mechanical_elastic.f90" +#include "../phase_mechanical_plastic.f90" +#include "../phase_mechanical_plastic_none.f90" +#include "../phase_mechanical_plastic_isotropic.f90" +#include "../phase_mechanical_plastic_phenopowerlaw.f90" +#include "../phase_mechanical_plastic_kinehardening.f90" +#include "../phase_mechanical_plastic_dislotwin.f90" +#include "../phase_mechanical_plastic_dislotungsten.f90" +#include "../phase_mechanical_plastic_nonlocal.f90" +#include "../phase_mechanical_eigen.f90" +#include "../phase_mechanical_eigen_cleavageopening.f90" +#include "../phase_mechanical_eigen_thermalexpansion.f90" +#include "../phase_thermal.f90" +#include "../phase_thermal_dissipation.f90" +#include "../phase_thermal_externalheat.f90" +#include "../phase_damage.f90" +#include "../phase_damage_isobrittle.f90" +#include "../phase_damage_anisobrittle.f90" +#include "../homogenization.f90" +#include "../homogenization_mechanical.f90" +#include "../homogenization_mechanical_pass.f90" +#include "../homogenization_mechanical_isostrain.f90" +#include "../homogenization_mechanical_RGC.f90" +#include "../homogenization_thermal.f90" +#include "../homogenization_thermal_pass.f90" +#include "../homogenization_thermal_isotemperature.f90" +#include "../homogenization_damage.f90" +#include "../homogenization_damage_pass.f90" +#include "../materialpoint.f90" !-------------------------------------------------------------------------------------------------- !> @brief This is the MSC.Marc user subroutine for defining material behavior @@ -214,8 +261,8 @@ 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 QUOTE(PASTE(./Marc/include/concom,MARC4DAMASK)) ! concom is needed for inc, lovl -#include QUOTE(PASTE(./Marc/include/creeps,MARC4DAMASK)) ! creeps is needed for timinc (time increment) +#include QUOTE(PASTE(include/concom,MARC4DAMASK)) ! concom is needed for inc, lovl +#include QUOTE(PASTE(include/creeps,MARC4DAMASK)) ! creeps is needed for timinc (time increment) logical :: cutBack real(pReal), dimension(6) :: stress @@ -367,7 +414,7 @@ subroutine uedinc(inc,incsub) integer :: n, nqncomp, nqdatatype integer, save :: inc_written real(pReal), allocatable, dimension(:,:) :: d_n -#include QUOTE(PASTE(./Marc/include/creeps,MARC4DAMASK)) ! creeps is needed for timinc (time increment) +#include QUOTE(PASTE(include/creeps,MARC4DAMASK)) ! creeps is needed for timinc (time increment) if (inc > inc_written) then diff --git a/src/commercialFEM_fileList.f90 b/src/commercialFEM_fileList.f90 deleted file mode 100644 index 8bcf2f454..000000000 --- a/src/commercialFEM_fileList.f90 +++ /dev/null @@ -1,54 +0,0 @@ -!-------------------------------------------------------------------------------------------------- -!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH -!> @brief all DAMASK files without solver -!> @details List of files needed by MSC.Marc -!-------------------------------------------------------------------------------------------------- -#include "parallelization.f90" -#include "constants.f90" -#include "IO.f90" -#include "YAML_types.f90" -#include "YAML_parse.f90" -#include "HDF5_utilities.f90" -#include "results.f90" -#include "config.f90" -#include "LAPACK_interface.f90" -#include "math.f90" -#include "rotations.f90" -#include "polynomials.f90" -#include "lattice.f90" -#include "element.f90" -#include "geometry_plastic_nonlocal.f90" -#include "discretization.f90" -#include "Marc/discretization_Marc.f90" -#include "material.f90" -#include "phase.f90" -#include "phase_mechanical.f90" -#include "phase_mechanical_elastic.f90" -#include "phase_mechanical_plastic.f90" -#include "phase_mechanical_plastic_none.f90" -#include "phase_mechanical_plastic_isotropic.f90" -#include "phase_mechanical_plastic_phenopowerlaw.f90" -#include "phase_mechanical_plastic_kinehardening.f90" -#include "phase_mechanical_plastic_dislotwin.f90" -#include "phase_mechanical_plastic_dislotungsten.f90" -#include "phase_mechanical_plastic_nonlocal.f90" -#include "phase_mechanical_eigen.f90" -#include "phase_mechanical_eigen_cleavageopening.f90" -#include "phase_mechanical_eigen_thermalexpansion.f90" -#include "phase_thermal.f90" -#include "phase_thermal_dissipation.f90" -#include "phase_thermal_externalheat.f90" -#include "phase_damage.f90" -#include "phase_damage_isobrittle.f90" -#include "phase_damage_anisobrittle.f90" -#include "homogenization.f90" -#include "homogenization_mechanical.f90" -#include "homogenization_mechanical_pass.f90" -#include "homogenization_mechanical_isostrain.f90" -#include "homogenization_mechanical_RGC.f90" -#include "homogenization_thermal.f90" -#include "homogenization_thermal_pass.f90" -#include "homogenization_thermal_isotemperature.f90" -#include "homogenization_damage.f90" -#include "homogenization_damage_pass.f90" -#include "materialpoint.f90" diff --git a/src/materialpoint.f90 b/src/materialpoint.f90 index 743113036..1bf572bb0 100644 --- a/src/materialpoint.f90 +++ b/src/materialpoint.f90 @@ -131,7 +131,7 @@ end subroutine materialpoint_init !-------------------------------------------------------------------------------------------------- -!> @brief perform initialization at first call, update variables and call the actual material model +!> @brief Update variables and call the material model. !-------------------------------------------------------------------------------------------------- subroutine materialpoint_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyStress, jacobian) From b7a70ffe61f49cd05b2bea636aa4ca7146814803 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 24 Apr 2022 20:35:37 +0200 Subject: [PATCH 048/142] new location --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3c736136c..2c21b8d88 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -164,8 +164,8 @@ setup_Marc: - cd $(mktemp -d) - cp ${CI_PROJECT_DIR}/examples/Marc/* . - python3 -c "import damask;damask.solver.Marc().submit_job('r-value','texture',True,'h')" - - mkdir ${TESTROOT}/src - - mv ${CI_PROJECT_DIR}/src/DAMASK_Marc.marc ${TESTROOT}/src + - mkdir -p ${TESTROOT}/src/Marc + - mv ${CI_PROJECT_DIR}/src/Marc/DAMASK_Marc.marc ${TESTROOT}/src/Marc ################################################################################################### From b4c6ca64fcfabdd98a8819e44281edeb1dbc3cdc Mon Sep 17 00:00:00 2001 From: Daniel Otto de Mentock Date: Mon, 25 Apr 2022 12:00:54 +0200 Subject: [PATCH 049/142] replaced setup.py with setup.cfg file modified .gitlab-ci.yml file to strip away "v" from git describe result --- .gitlab-ci.yml | 3 ++- python/setup.cfg | 31 +++++++++++++++++++++++++++++++ python/setup.py | 36 ------------------------------------ 3 files changed, 33 insertions(+), 37 deletions(-) create mode 100644 python/setup.cfg delete mode 100644 python/setup.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3c736136c..89c22a2f8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -233,7 +233,8 @@ update_revision: - cd $(mktemp -d) - git clone -q git@git.damask.mpie.de:damask/DAMASK.git . - git pull - - export VERSION=$(git describe ${CI_COMMIT_SHA}) + - VERSION=$(git describe ${CI_COMMIT_SHA}) + - export VERSION="${VERSION:1:-1}" - echo ${VERSION} > python/damask/VERSION - > git diff-index --quiet HEAD || diff --git a/python/setup.cfg b/python/setup.cfg new file mode 100644 index 000000000..89a3cacf5 --- /dev/null +++ b/python/setup.cfg @@ -0,0 +1,31 @@ +[metadata] +name = damask +version = file: damask/VERSION +author = The DAMASK team +author_email = damask@mpie.de +url = https://damask.mpie.de +description = DAMASK processing tools +long_description = Pre- and post-processing tools for DAMASK +license: AGPL3 +classifiers = + Intended Audience :: Science/Research + Topic :: Scientific/Engineering + Programming Language :: Python :: 3 + License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+) + Operating System :: OS Independent + +[options] +packages = damask +zip_safe = false +include_package_data = true +python_requires = >= 3.8 +install_requires = + importlib-metadata; python_version<"3.8" + pandas; python_version<="0.24" # requires numpy + numpy; python_version<="1.17" # needed for default_rng + scipy; python_version<="1.2" + h5py; python_version<="2.9" # requires numpy + vtk; python_version<="8.1" + matplotlib; python_version<="3.0" # requires numpy, pillow + pyyaml; python_version<="3.12" +setup_requires = setuptools diff --git a/python/setup.py b/python/setup.py deleted file mode 100644 index abb8053a9..000000000 --- a/python/setup.py +++ /dev/null @@ -1,36 +0,0 @@ -import setuptools -from pathlib import Path -import re - -# https://www.python.org/dev/peps/pep-0440 -with open(Path(__file__).parent/'damask/VERSION') as f: - version = re.sub(r'(-([^-]*)).*$',r'.\2',re.sub(r'^v(\d+\.\d+(\.\d+)?)',r'\1',f.readline().strip())) - -setuptools.setup( - name='damask', - version=version, - author='The DAMASK team', - author_email='damask@mpie.de', - description='DAMASK processing tools', - long_description='Pre- and post-processing tools for DAMASK', - url='https://damask.mpie.de', - packages=setuptools.find_packages(), - include_package_data=True, - python_requires = '>=3.8', - install_requires = [ - 'pandas>=0.24', # requires numpy - 'numpy>=1.17', # needed for default_rng - 'scipy>=1.2', - 'h5py>=2.9', # requires numpy - 'vtk>=8.1', - 'matplotlib>=3.0', # requires numpy, pillow - 'pyyaml>=3.12' - ], - classifiers = [ - 'Intended Audience :: Science/Research', - 'Topic :: Scientific/Engineering', - 'Programming Language :: Python :: 3', - 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)', - 'Operating System :: OS Independent', - ], -) From 59668d2910d203e570a7361f312fbbb130d79cf8 Mon Sep 17 00:00:00 2001 From: Daniel Otto de Mentock Date: Mon, 25 Apr 2022 14:58:15 +0200 Subject: [PATCH 050/142] removed zip_safe = false entry from setup.cfg --- .gitlab-ci.yml | 2 +- python/setup.cfg | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 89c22a2f8..07bad3a12 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -234,7 +234,7 @@ update_revision: - git clone -q git@git.damask.mpie.de:damask/DAMASK.git . - git pull - VERSION=$(git describe ${CI_COMMIT_SHA}) - - export VERSION="${VERSION:1:-1}" + - export VERSION="${VERSION:1}" - echo ${VERSION} > python/damask/VERSION - > git diff-index --quiet HEAD || diff --git a/python/setup.cfg b/python/setup.cfg index 89a3cacf5..30107fd10 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -16,16 +16,15 @@ classifiers = [options] packages = damask -zip_safe = false include_package_data = true python_requires = >= 3.8 install_requires = importlib-metadata; python_version<"3.8" - pandas; python_version<="0.24" # requires numpy - numpy; python_version<="1.17" # needed for default_rng + pandas; python_version<="0.24" # requires numpy + numpy; python_version<="1.17" # needed for default_rng scipy; python_version<="1.2" - h5py; python_version<="2.9" # requires numpy + h5py; python_version<="2.9" # requires numpy vtk; python_version<="8.1" - matplotlib; python_version<="3.0" # requires numpy, pillow + matplotlib; python_version<="3.0" # requires numpy, pillow pyyaml; python_version<="3.12" setup_requires = setuptools From 51996a707e33bbadeb4df5abeefe50e4bbd03af0 Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 26 Apr 2022 11:05:02 +0200 Subject: [PATCH 051/142] [skip ci] updated version information after successful test of 3.0.0-alpha6-252-g59668d291 --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index 17295dc62..cd494347c 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha6-249-gd2cf972b2 +3.0.0-alpha6-252-g59668d291 From dece12a1a6536ad74c15238fe7f37df3e177c09c Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 26 Apr 2022 12:19:13 -0400 Subject: [PATCH 052/142] remove unused CLI module inclusion --- src/config.f90 | 2 +- src/mesh/mesh_mech_FEM.f90 | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/config.f90 b/src/config.f90 index 767e3e6c9..78723c19f 100644 --- a/src/config.f90 +++ b/src/config.f90 @@ -1,6 +1,6 @@ !-------------------------------------------------------------------------------------------------- !> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH -!> @brief Read in the material, numerics & debug configuration from their respective file +!> @brief Read in the configuration of material, numerics, and debug from their respective file !-------------------------------------------------------------------------------------------------- module config use IO diff --git a/src/mesh/mesh_mech_FEM.f90 b/src/mesh/mesh_mech_FEM.f90 index 474faa4ae..5f02011eb 100644 --- a/src/mesh/mesh_mech_FEM.f90 +++ b/src/mesh/mesh_mech_FEM.f90 @@ -20,7 +20,6 @@ module mesh_mechanical_FEM use FEM_utilities use discretization use discretization_mesh - use CLI use config use IO use FEM_quadrature From af8003525a9f51107a236530bd8a6fb4df8d6099 Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 27 Apr 2022 01:01:01 +0200 Subject: [PATCH 053/142] [skip ci] updated version information after successful test of 3.0.0-alpha6-258-gea7c8ef23 --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index cd494347c..b162a769d 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -3.0.0-alpha6-252-g59668d291 +3.0.0-alpha6-258-gea7c8ef23 From 8b3a0982c6cdc052062c9a576bb60dc69cd7cba8 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 27 Apr 2022 05:58:05 +0200 Subject: [PATCH 054/142] rename was missing (is already in code) --- examples/config/debug.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/config/debug.yaml b/examples/config/debug.yaml index 900873b25..fef3cedeb 100644 --- a/examples/config/debug.yaml +++ b/examples/config/debug.yaml @@ -1,5 +1,5 @@ phase: [basic, extensive, selective] -CPFEM: [basic, extensive, selective] +materialpoint: [basic, extensive, selective] # options for selective debugging element: 1 From 45fdd03ecdd56f26d8589d18f38b073d6b63efbb Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 27 Apr 2022 06:05:06 +0200 Subject: [PATCH 055/142] main file at root --- .gitlab-ci.yml | 7 +++---- VERSION | 2 +- python/damask/VERSION | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) mode change 120000 => 100644 VERSION mode change 100644 => 120000 python/damask/VERSION diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 07bad3a12..d740bb2eb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -233,12 +233,11 @@ update_revision: - cd $(mktemp -d) - git clone -q git@git.damask.mpie.de:damask/DAMASK.git . - git pull - - VERSION=$(git describe ${CI_COMMIT_SHA}) - - export VERSION="${VERSION:1}" - - echo ${VERSION} > python/damask/VERSION + - exportVERSION=$(git describe ${CI_COMMIT_SHA}) + - echo ${VERSION:1} > VERSION - > git diff-index --quiet HEAD || - git commit python/damask/VERSION -m "[skip ci] updated version information after successful test of $VERSION" + git commit VERSION -m "[skip ci] updated version information after successful test of $VERSION" - if [ ${CI_COMMIT_SHA} == $(git rev-parse HEAD^) ]; then git push origin HEAD:master HEAD:development; fi only: - development diff --git a/VERSION b/VERSION deleted file mode 120000 index 5d364b3ae..000000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -python/damask/VERSION \ No newline at end of file diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..b162a769d --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +3.0.0-alpha6-258-gea7c8ef23 diff --git a/python/damask/VERSION b/python/damask/VERSION deleted file mode 100644 index b162a769d..000000000 --- a/python/damask/VERSION +++ /dev/null @@ -1 +0,0 @@ -3.0.0-alpha6-258-gea7c8ef23 diff --git a/python/damask/VERSION b/python/damask/VERSION new file mode 120000 index 000000000..558194c5a --- /dev/null +++ b/python/damask/VERSION @@ -0,0 +1 @@ +../../VERSION \ No newline at end of file From ae9ffe99248184d6d3938003056a80c31ee2128d Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 27 Apr 2022 06:50:22 +0200 Subject: [PATCH 056/142] pip-compatible version string --- .github/workflows/Python.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/Python.yml b/.github/workflows/Python.yml index 3b6bb0df4..9329fb6fc 100644 --- a/.github/workflows/Python.yml +++ b/.github/workflows/Python.yml @@ -26,6 +26,12 @@ jobs: python -m pip install --upgrade pip pip install pytest pandas scipy h5py vtk matplotlib pyyaml + - name: Strip git hash (Unix) + if: runner.os != 'Windows' + run: | + export VERSION=$(cat VERSION) + echo ${VERSION%-*} > VERSION + - name: Install and run unit tests (Unix) if: runner.os != 'Windows' run: | From 831cd42842cf99e161fd3e7c6d77a0a348de2276 Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 27 Apr 2022 10:09:51 +0200 Subject: [PATCH 057/142] [skip ci] updated version information after successful test of --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index b162a769d..8b1378917 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-258-gea7c8ef23 + From 8f0240c67bd6ff832b22c77435e790732b71f245 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Wed, 27 Apr 2022 08:59:55 -0400 Subject: [PATCH 058/142] avoid option clash in Orientation.from_fiber_component --- python/damask/_rotation.py | 14 +++++++------- python/tests/test_Orientation.py | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index 2963925c4..c0fea6a92 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -1096,8 +1096,8 @@ class Rotation: @staticmethod - def from_fiber_component(alpha: IntSequence, - beta: IntSequence, + def from_fiber_component(crystal: IntSequence, + sample: IntSequence, sigma: float = 0.0, shape: Union[int, IntSequence] = None, degrees: bool = True, @@ -1107,9 +1107,9 @@ class Rotation: Parameters ---------- - alpha : numpy.ndarray, shape (2) + crystal : numpy.ndarray, shape (2) Polar coordinates (phi from x, theta from z) of fiber direction in crystal frame. - beta : numpy.ndarray, shape (2) + sample : numpy.ndarray, shape (2) Polar coordinates (phi from x, theta from z) of fiber direction in sample frame. sigma : float, optional Standard deviation of (Gaussian) misorientation distribution. @@ -1117,15 +1117,15 @@ class Rotation: shape : int or sequence of ints, optional Shape of the returned array. Defaults to None, which gives a scalar. degrees : bool, optional - sigma, alpha, and beta are given in degrees. + sigma and polar coordinates are given in degrees. rng_seed : {None, int, array_like[ints], SeedSequence, BitGenerator, Generator}, optional A seed to initialize the BitGenerator. Defaults to None, i.e. unpredictable entropy will be pulled from the OS. """ rng = np.random.default_rng(rng_seed) - sigma_,alpha_,beta_ = (np.radians(coordinate) for coordinate in (sigma,alpha,beta)) if degrees else \ - map(np.array, (sigma,alpha,beta)) + sigma_,alpha_,beta_ = (np.radians(coordinate) for coordinate in (sigma,crystal,sample)) if degrees else \ + map(np.array, (sigma,crystal,sample)) d_cr = np.array([np.sin(alpha_[0])*np.cos(alpha_[1]), np.sin(alpha_[0])*np.sin(alpha_[1]), np.cos(alpha_[0])]) d_lab = np.array([np.sin( beta_[0])*np.cos( beta_[1]), np.sin( beta_[0])*np.sin( beta_[1]), np.cos( beta_[0])]) diff --git a/python/tests/test_Orientation.py b/python/tests/test_Orientation.py index 4a7b549fd..f1dcdc478 100644 --- a/python/tests/test_Orientation.py +++ b/python/tests/test_Orientation.py @@ -150,9 +150,9 @@ class TestOrientation: == np.eye(3)) def test_from_fiber_component(self): - r = Rotation.from_fiber_component(alpha=np.zeros(2),beta=np.zeros(2), + r = Rotation.from_fiber_component(crystal=np.zeros(2),sample=np.zeros(2), sigma=0.0,shape=1,rng_seed=0) - assert np.all(Orientation.from_fiber_component(alpha=np.zeros(2),beta=np.zeros(2), + assert np.all(Orientation.from_fiber_component(crystal=np.zeros(2),sample=np.zeros(2), sigma=0.0,shape=None,rng_seed=0,family='triclinic').quaternion == r.quaternion) From e0d285920226c53634ced57b42582736a3a68031 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 27 Apr 2022 17:25:39 +0200 Subject: [PATCH 059/142] better test coverage --- python/damask/_rotation.py | 2 +- python/tests/test_Orientation.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index c0fea6a92..f138fbb8a 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -551,7 +551,7 @@ class Rotation: Parameters ---------- degrees : bool, optional - Return angles in degrees. + Return angles in degrees. Defaults to False. Returns ------- diff --git a/python/tests/test_Orientation.py b/python/tests/test_Orientation.py index f1dcdc478..729967539 100644 --- a/python/tests/test_Orientation.py +++ b/python/tests/test_Orientation.py @@ -150,10 +150,12 @@ class TestOrientation: == np.eye(3)) def test_from_fiber_component(self): - r = Rotation.from_fiber_component(crystal=np.zeros(2),sample=np.zeros(2), + crystal = np.random.rand(2) * [180,360] + sample = np.random.rand(2) * [180,360] + r = Rotation.from_fiber_component(crystal=crystal,sample=sample, sigma=0.0,shape=1,rng_seed=0) - assert np.all(Orientation.from_fiber_component(crystal=np.zeros(2),sample=np.zeros(2), - sigma=0.0,shape=None,rng_seed=0,family='triclinic').quaternion + assert np.all(Orientation.from_fiber_component(crystal=crystal,sample=sample, + sigma=0.0,shape=None,rng_seed=0,lattice='cI').quaternion == r.quaternion) @pytest.mark.parametrize('kwargs',[ From 5776891b7585507cd23053d2888b6725de7b3ab8 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 27 Apr 2022 22:49:33 +0200 Subject: [PATCH 060/142] typo: missing space --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d740bb2eb..c19d36f35 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -233,7 +233,7 @@ update_revision: - cd $(mktemp -d) - git clone -q git@git.damask.mpie.de:damask/DAMASK.git . - git pull - - exportVERSION=$(git describe ${CI_COMMIT_SHA}) + - export VERSION=$(git describe ${CI_COMMIT_SHA}) - echo ${VERSION:1} > VERSION - > git diff-index --quiet HEAD || From 07b95a3decc8fc1089ce948f0480a5425116cf73 Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 28 Apr 2022 01:12:34 +0200 Subject: [PATCH 061/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-266-g5776891b7 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 8b1378917..c5ac07ef6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ - +3.0.0-alpha6-266-g5776891b7 From 5c4d48115517b3dff0f353f1ba8d1cea5d12838b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 28 Apr 2022 01:33:33 +0200 Subject: [PATCH 062/142] common order is theta,phi --- python/damask/_rotation.py | 24 ++++++++++++++++++------ python/tests/test_Rotation.py | 4 ++-- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index f138fbb8a..083bea72a 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -1108,9 +1108,11 @@ class Rotation: Parameters ---------- crystal : numpy.ndarray, shape (2) - Polar coordinates (phi from x, theta from z) of fiber direction in crystal frame. + Polar coordinates (polar angle θ from [0 0 1], azimuthal angle φ from [1 0 0]) + of fiber direction in crystal frame. sample : numpy.ndarray, shape (2) - Polar coordinates (phi from x, theta from z) of fiber direction in sample frame. + Polar coordinates (polar angle θ from z, azimuthal angle φ from x) + of fiber direction in sample frame. sigma : float, optional Standard deviation of (Gaussian) misorientation distribution. Defaults to 0. @@ -1122,13 +1124,23 @@ class Rotation: A seed to initialize the BitGenerator. Defaults to None, i.e. unpredictable entropy will be pulled from the OS. + Notes + ----- + Polar coordinates follow the conventions typically used in physics, + see https://en.wikipedia.org/wiki/Spherical_coordinate_system. + + The common ranges are 0≤θ≤π and 0≤φ≤2π for a unique set of coordinates. + + Examples + -------- + """ rng = np.random.default_rng(rng_seed) - sigma_,alpha_,beta_ = (np.radians(coordinate) for coordinate in (sigma,crystal,sample)) if degrees else \ - map(np.array, (sigma,crystal,sample)) + sigma_,alpha,beta = (np.radians(coordinate) for coordinate in (sigma,crystal,sample)) if degrees else \ + map(np.array, (sigma,crystal,sample)) - d_cr = np.array([np.sin(alpha_[0])*np.cos(alpha_[1]), np.sin(alpha_[0])*np.sin(alpha_[1]), np.cos(alpha_[0])]) - d_lab = np.array([np.sin( beta_[0])*np.cos( beta_[1]), np.sin( beta_[0])*np.sin( beta_[1]), np.cos( beta_[0])]) + d_cr = np.array([np.sin(alpha[1])*np.cos(alpha[0]), np.sin(alpha[1])*np.sin(alpha[0]), np.cos(alpha[1])]) + d_lab = np.array([np.sin( beta[1])*np.cos( beta[0]), np.sin( beta[1])*np.sin( beta[0]), np.cos( beta[1])]) ax_align = np.append(np.cross(d_lab,d_cr), np.arccos(np.dot(d_lab,d_cr))) if np.isclose(ax_align[3],0.0): ax_align[:3] = np.array([1,0,0]) R_align = Rotation.from_axis_angle(ax_align if ax_align[3] > 0.0 else -ax_align,normalize=True) # rotate fiber axis from sample to crystal frame diff --git a/python/tests/test_Rotation.py b/python/tests/test_Rotation.py index a9b8b36f0..cb58c4452 100644 --- a/python/tests/test_Rotation.py +++ b/python/tests/test_Rotation.py @@ -1080,8 +1080,8 @@ class TestRotation: alpha = np.random.random()*2*np.pi,np.arccos(np.random.random()) beta = np.random.random()*2*np.pi,np.arccos(np.random.random()) - f_in_C = np.array([np.sin(alpha[0])*np.cos(alpha[1]), np.sin(alpha[0])*np.sin(alpha[1]), np.cos(alpha[0])]) - f_in_S = np.array([np.sin(beta[0] )*np.cos(beta[1] ), np.sin(beta[0] )*np.sin(beta[1] ), np.cos(beta[0] )]) + f_in_C = np.array([np.sin(alpha[1])*np.cos(alpha[0]), np.sin(alpha[1])*np.sin(alpha[0]), np.cos(alpha[1])]) + f_in_S = np.array([np.sin(beta[1] )*np.cos(beta[0] ), np.sin(beta[1] )*np.sin(beta[0] ), np.cos(beta[1] )]) ax = np.append(np.cross(f_in_C,f_in_S), - np.arccos(np.dot(f_in_C,f_in_S))) n = Rotation.from_axis_angle(ax if ax[3] > 0.0 else ax*-1.0 ,normalize=True) # rotation to align fiber axis in crystal and sample system From a0455cadf32edad084f85c4f4cb3b57d1b5ff624 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 28 Apr 2022 15:35:50 +0200 Subject: [PATCH 063/142] consistently have input in radians --- python/damask/_rotation.py | 16 ++++++++++------ python/tests/test_Rotation.py | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index 083bea72a..7c183ff98 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -1010,7 +1010,7 @@ class Rotation: def from_ODF(weights: np.ndarray, phi: np.ndarray, shape: Union[int, IntSequence] = None, - degrees: bool = True, + degrees: bool = False, fractions: bool = True, rng_seed: NumpyRngSeed = None) -> 'Rotation': """ @@ -1063,7 +1063,7 @@ class Rotation: def from_spherical_component(center: 'Rotation', sigma: float, shape: Union[int, IntSequence] = None, - degrees: bool = True, + degrees: bool = False, rng_seed: NumpyRngSeed = None) -> 'Rotation': """ Initialize with samples from a Gaussian distribution around a given center. @@ -1100,7 +1100,7 @@ class Rotation: sample: IntSequence, sigma: float = 0.0, shape: Union[int, IntSequence] = None, - degrees: bool = True, + degrees: bool = False, rng_seed: NumpyRngSeed = None): """ Initialize with samples from a Gaussian distribution around a given direction. @@ -1126,10 +1126,14 @@ class Rotation: Notes ----- - Polar coordinates follow the conventions typically used in physics, - see https://en.wikipedia.org/wiki/Spherical_coordinate_system. + The default crystal direction (θ=0,φ=0) direction is [0 0 1], + the default sample direction (θ=0,φ=0) is z. - The common ranges are 0≤θ≤π and 0≤φ≤2π for a unique set of coordinates. + Polar coordinates follow the ISO 80000-2:2019 convention + typically used in physics. + See https://en.wikipedia.org/wiki/Spherical_coordinate_system. + + Ranges 0≤θ≤π and 0≤φ≤2π give a unique set of coordinates. Examples -------- diff --git a/python/tests/test_Rotation.py b/python/tests/test_Rotation.py index cb58c4452..2db08bc69 100644 --- a/python/tests/test_Rotation.py +++ b/python/tests/test_Rotation.py @@ -1061,7 +1061,7 @@ class TestRotation: p = [] for run in range(5): c = Rotation.from_random() - o = Rotation.from_spherical_component(c,sigma,shape) + o = Rotation.from_spherical_component(c,sigma,shape,degrees=True) _, angles = c.misorientation(o).as_axis_angle(pair=True,degrees=True) angles[::2] *= -1 # flip angle for every second to symmetrize distribution From 06cef4292767d067a3b57c25de909f21ad65790e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 28 Apr 2022 15:56:24 +0200 Subject: [PATCH 064/142] use physical/ISO convention --- python/damask/_rotation.py | 5 +++-- python/tests/test_Rotation.py | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index 7c183ff98..a0baf1a0b 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -1137,14 +1137,15 @@ class Rotation: Examples -------- + tbd """ rng = np.random.default_rng(rng_seed) sigma_,alpha,beta = (np.radians(coordinate) for coordinate in (sigma,crystal,sample)) if degrees else \ map(np.array, (sigma,crystal,sample)) - d_cr = np.array([np.sin(alpha[1])*np.cos(alpha[0]), np.sin(alpha[1])*np.sin(alpha[0]), np.cos(alpha[1])]) - d_lab = np.array([np.sin( beta[1])*np.cos( beta[0]), np.sin( beta[1])*np.sin( beta[0]), np.cos( beta[1])]) + d_cr = np.array([np.sin(alpha[0])*np.cos(alpha[1]), np.sin(alpha[0])*np.sin(alpha[1]), np.cos(alpha[0])]) + d_lab = np.array([np.sin( beta[0])*np.cos( beta[1]), np.sin( beta[0])*np.sin( beta[1]), np.cos( beta[0])]) ax_align = np.append(np.cross(d_lab,d_cr), np.arccos(np.dot(d_lab,d_cr))) if np.isclose(ax_align[3],0.0): ax_align[:3] = np.array([1,0,0]) R_align = Rotation.from_axis_angle(ax_align if ax_align[3] > 0.0 else -ax_align,normalize=True) # rotate fiber axis from sample to crystal frame diff --git a/python/tests/test_Rotation.py b/python/tests/test_Rotation.py index 2db08bc69..c9dfc68b8 100644 --- a/python/tests/test_Rotation.py +++ b/python/tests/test_Rotation.py @@ -1077,11 +1077,11 @@ class TestRotation: def test_from_fiber_component(self,sigma,shape): p = [] for run in range(5): - alpha = np.random.random()*2*np.pi,np.arccos(np.random.random()) - beta = np.random.random()*2*np.pi,np.arccos(np.random.random()) + alpha = np.arccos(np.random.random()),np.random.random()*2*np.pi + beta = np.arccos(np.random.random()),np.random.random()*2*np.pi - f_in_C = np.array([np.sin(alpha[1])*np.cos(alpha[0]), np.sin(alpha[1])*np.sin(alpha[0]), np.cos(alpha[1])]) - f_in_S = np.array([np.sin(beta[1] )*np.cos(beta[0] ), np.sin(beta[1] )*np.sin(beta[0] ), np.cos(beta[1] )]) + f_in_C = np.array([np.sin(alpha[0])*np.cos(alpha[1]), np.sin(alpha[0])*np.sin(alpha[1]), np.cos(alpha[0])]) + f_in_S = np.array([np.sin( beta[0])*np.cos( beta[1]), np.sin( beta[0])*np.sin( beta[1]), np.cos( beta[0])]) ax = np.append(np.cross(f_in_C,f_in_S), - np.arccos(np.dot(f_in_C,f_in_S))) n = Rotation.from_axis_angle(ax if ax[3] > 0.0 else ax*-1.0 ,normalize=True) # rotation to align fiber axis in crystal and sample system From 730cda2020b5b4d7bff3fb1da8d41ff5a54a9070 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 29 Apr 2022 14:50:27 +0200 Subject: [PATCH 065/142] more explicit name --- src/Marc/DAMASK_Marc.f90 | 2 +- src/{materialpoint.f90 => Marc/materialpoint_Marc.f90} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/{materialpoint.f90 => Marc/materialpoint_Marc.f90} (100%) diff --git a/src/Marc/DAMASK_Marc.f90 b/src/Marc/DAMASK_Marc.f90 index da9702dc6..64b529aeb 100644 --- a/src/Marc/DAMASK_Marc.f90 +++ b/src/Marc/DAMASK_Marc.f90 @@ -187,7 +187,7 @@ end module DAMASK_interface #include "../homogenization_thermal_isotemperature.f90" #include "../homogenization_damage.f90" #include "../homogenization_damage_pass.f90" -#include "../materialpoint.f90" +#include "materialpoint_Marc.f90" !-------------------------------------------------------------------------------------------------- !> @brief This is the MSC.Marc user subroutine for defining material behavior diff --git a/src/materialpoint.f90 b/src/Marc/materialpoint_Marc.f90 similarity index 100% rename from src/materialpoint.f90 rename to src/Marc/materialpoint_Marc.f90 From e29a732d9fadbb606cb0cefd7de22005a7ce7259 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 29 Apr 2022 14:58:12 +0200 Subject: [PATCH 066/142] improved naming --- src/CMakeLists.txt | 2 -- src/{materialpoint2.f90 => materialpoint.f90} | 0 2 files changed, 2 deletions(-) rename src/{materialpoint2.f90 => materialpoint.f90} (100%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0d1f71b30..a473069b9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,8 +6,6 @@ endif() file(GLOB damask-sources CONFIGURE_DEPENDS *.f90 *.c) -list(FILTER damask-sources EXCLUDE REGEX ".*materialpoint.f90") - if(PROJECT_NAME STREQUAL "damask-grid") set(executable-name "DAMASK_grid") file(GLOB solver-sources CONFIGURE_DEPENDS grid/*.f90) diff --git a/src/materialpoint2.f90 b/src/materialpoint.f90 similarity index 100% rename from src/materialpoint2.f90 rename to src/materialpoint.f90 From 8168d435535bde5548f4d6027fad50f1fb558005 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 30 Apr 2022 19:44:50 +0200 Subject: [PATCH 067/142] use libyaml-based loader factor 10 faster on my laptop --- python/damask/_config.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/python/damask/_config.py b/python/damask/_config.py index 6dd6a8328..79fa228cc 100644 --- a/python/damask/_config.py +++ b/python/damask/_config.py @@ -6,6 +6,10 @@ from typing import Union, Dict, Any, Type, TypeVar import numpy as np import yaml +try: + from yaml import CSafeLoader as SafeLoader +except ImportError: + from yaml import SafeLoader from ._typehints import FileHandle from . import Rotation @@ -53,7 +57,7 @@ class Config(dict): **kwargs): """Initialize from YAML, dict, or key=value pairs.""" if isinstance(yml,str): - kwargs.update(yaml.safe_load(yml)) + kwargs.update(yaml.load(yml, Loader=SafeLoader)) elif isinstance(yml,dict): kwargs.update(yml) @@ -144,7 +148,7 @@ class Config(dict): Configuration from file. """ - return cls(yaml.safe_load(util.open_text(fname))) + return cls(yaml.load(util.open_text(fname), Loader=SafeLoader)) def save(self, fname: FileHandle, From 575de4b89b8ec6a0e62d8b281b93f8bcedd0e55f Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 30 Apr 2022 23:15:21 +0200 Subject: [PATCH 068/142] mypy does not like an import that can result in two types --- python/damask/_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/_config.py b/python/damask/_config.py index 79fa228cc..ff889bf5d 100644 --- a/python/damask/_config.py +++ b/python/damask/_config.py @@ -9,7 +9,7 @@ import yaml try: from yaml import CSafeLoader as SafeLoader except ImportError: - from yaml import SafeLoader + from yaml import SafeLoader # type: ignore from ._typehints import FileHandle from . import Rotation From be39865ff7adad51805f9cbda70ac521241d04a9 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 2 May 2022 09:51:10 +0200 Subject: [PATCH 069/142] more systematic naming --- src/Marc/DAMASK_Marc.f90 | 8 ++++---- src/Marc/discretization_Marc.f90 | 1 - src/Marc/materialpoint_Marc.f90 | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Marc/DAMASK_Marc.f90 b/src/Marc/DAMASK_Marc.f90 index 64b529aeb..cc68dbbb1 100644 --- a/src/Marc/DAMASK_Marc.f90 +++ b/src/Marc/DAMASK_Marc.f90 @@ -205,9 +205,9 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & use DAMASK_interface use config use YAML_types - use discretization_marc + use discretization_Marc use homogenization - use materialpoint + use materialpoint_Marc implicit none include "omp_lib.h" ! the openMP function library @@ -406,8 +406,8 @@ subroutine flux(f,ts,n,time) !-------------------------------------------------------------------------------------------------- subroutine uedinc(inc,incsub) use prec - use materialpoint - use discretization_marc + use materialpoint_Marc + use discretization_Marc implicit none integer, intent(in) :: inc, incsub diff --git a/src/Marc/discretization_Marc.f90 b/src/Marc/discretization_Marc.f90 index fd6b8699d..53be07a6f 100644 --- a/src/Marc/discretization_Marc.f90 +++ b/src/Marc/discretization_Marc.f90 @@ -1212,5 +1212,4 @@ logical function containsRange(str,chunkPos) end function containsRange - end module discretization_Marc diff --git a/src/Marc/materialpoint_Marc.f90 b/src/Marc/materialpoint_Marc.f90 index 1bf572bb0..1501d981d 100644 --- a/src/Marc/materialpoint_Marc.f90 +++ b/src/Marc/materialpoint_Marc.f90 @@ -3,7 +3,7 @@ !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH !> @brief materialpoint engine !-------------------------------------------------------------------------------------------------- -module materialpoint +module materialpoint_Marc use DAMASK_interface use prec use IO @@ -277,4 +277,4 @@ subroutine materialpoint_results(inc,time) end subroutine materialpoint_results -end module materialpoint +end module materialpoint_Marc From 0a42dba4537a1dba15c1b322d7ca1f70c3edade1 Mon Sep 17 00:00:00 2001 From: "d.mentock" Date: Mon, 2 May 2022 10:25:11 +0200 Subject: [PATCH 070/142] modified setup.cfg to include solver dir --- python/setup.cfg | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/setup.cfg b/python/setup.cfg index 30107fd10..bdc7cbb52 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -15,7 +15,9 @@ classifiers = Operating System :: OS Independent [options] -packages = damask +packages = + damask + damask.solver include_package_data = true python_requires = >= 3.8 install_requires = From 60190e8992339bb1dba62336a562e7a851c278b2 Mon Sep 17 00:00:00 2001 From: "d.mentock" Date: Mon, 2 May 2022 18:00:21 +0200 Subject: [PATCH 071/142] modified setup.cfg to automatically detect main package and subpackages --- python/setup.cfg | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/python/setup.cfg b/python/setup.cfg index bdc7cbb52..321040658 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -15,9 +15,7 @@ classifiers = Operating System :: OS Independent [options] -packages = - damask - damask.solver +packages = find: include_package_data = true python_requires = >= 3.8 install_requires = From fc4619189f3236d777125bb2eabc531aca23d051 Mon Sep 17 00:00:00 2001 From: Franz Roters Date: Tue, 3 May 2022 12:55:27 +0200 Subject: [PATCH 072/142] unified capitalization --- src/Marc/DAMASK_Marc.f90 | 6 +++--- src/Marc/discretization_Marc.f90 | 4 ++-- src/Marc/materialpoint_Marc.f90 | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Marc/DAMASK_Marc.f90 b/src/Marc/DAMASK_Marc.f90 index cc68dbbb1..4a42120ee 100644 --- a/src/Marc/DAMASK_Marc.f90 +++ b/src/Marc/DAMASK_Marc.f90 @@ -46,7 +46,7 @@ subroutine DAMASK_interface_init integer :: ierr character(len=pPathLen) :: wd - print'(/,1x,a)', '<<<+- DAMASK_marc init -+>>>' + print'(/,1x,a)', '<<<+- DAMASK_Marc init -+>>>' print*, 'Roters et al., Computational Materials Science 158:420–478, 2019' print*, 'https://doi.org/10.1016/j.commatsci.2018.04.030' @@ -380,7 +380,7 @@ end subroutine hypela2 subroutine flux(f,ts,n,time) use prec use homogenization - use discretization_marc + use discretization_Marc implicit none real(pReal), dimension(6), intent(in) :: & @@ -426,7 +426,7 @@ subroutine uedinc(inc,incsub) endif enddo - call discretization_marc_UpdateNodeAndIpCoords(d_n) + call discretization_Marc_UpdateNodeAndIpCoords(d_n) call materialpoint_results(inc,cptim) inc_written = inc diff --git a/src/Marc/discretization_Marc.f90 b/src/Marc/discretization_Marc.f90 index 53be07a6f..c1525b05e 100644 --- a/src/Marc/discretization_Marc.f90 +++ b/src/Marc/discretization_Marc.f90 @@ -136,7 +136,7 @@ end subroutine discretization_Marc_updateNodeAndIpCoords !-------------------------------------------------------------------------------------------------- !> @brief Calculate and set current nodal and IP positions (including cell nodes) !-------------------------------------------------------------------------------------------------- -function discretization_marc_FEM2DAMASK_cell(IP_FEM,elem_FEM) result(cell) +function discretization_Marc_FEM2DAMASK_cell(IP_FEM,elem_FEM) result(cell) integer, intent(in) :: IP_FEM, elem_FEM integer :: cell @@ -147,7 +147,7 @@ function discretization_marc_FEM2DAMASK_cell(IP_FEM,elem_FEM) result(cell) cell = (discretization_Marc_FEM2DAMASK_elem(elem_FEM)-1)*discretization_nIPs + IP_FEM -end function discretization_marc_FEM2DAMASK_cell +end function discretization_Marc_FEM2DAMASK_cell !-------------------------------------------------------------------------------------------------- diff --git a/src/Marc/materialpoint_Marc.f90 b/src/Marc/materialpoint_Marc.f90 index 1501d981d..79b06b80d 100644 --- a/src/Marc/materialpoint_Marc.f90 +++ b/src/Marc/materialpoint_Marc.f90 @@ -21,7 +21,7 @@ module materialpoint_Marc use homogenization use discretization - use discretization_marc + use discretization_Marc implicit none private @@ -86,7 +86,7 @@ subroutine materialpoint_initAll call rotations_init call polynomials_init call lattice_init - call discretization_marc_init + call discretization_Marc_init call material_init(.false.) call phase_init call homogenization_init From 6236ad52d17462e0a6b356a990ef0af9e12e38ac Mon Sep 17 00:00:00 2001 From: Franz Roters Date: Tue, 3 May 2022 13:00:28 +0200 Subject: [PATCH 073/142] consistent naming --- src/grid/DAMASK_grid.f90 | 2 +- src/materialpoint.f90 | 4 ++-- src/mesh/DAMASK_mesh.f90 | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index 8bce2bc93..835e18b34 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -20,7 +20,7 @@ program DAMASK_grid use IO use config use math - use materialpoint2 + use materialpoint use material use spectral_utilities use grid_mechanical_spectral_basic diff --git a/src/materialpoint.f90 b/src/materialpoint.f90 index 90f6e9f4f..d83307738 100644 --- a/src/materialpoint.f90 +++ b/src/materialpoint.f90 @@ -3,7 +3,7 @@ !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH !> @brief needs a good name and description !-------------------------------------------------------------------------------------------------- -module materialpoint2 +module materialpoint use parallelization use signals use CLI @@ -149,4 +149,4 @@ subroutine materialpoint_results(inc,time) end subroutine materialpoint_results -end module materialpoint2 +end module materialpoint diff --git a/src/mesh/DAMASK_mesh.f90 b/src/mesh/DAMASK_mesh.f90 index 20e797eba..f0f2a872e 100644 --- a/src/mesh/DAMASK_mesh.f90 +++ b/src/mesh/DAMASK_mesh.f90 @@ -14,7 +14,7 @@ program DAMASK_mesh use parallelization use IO use math - use materialpoint2 + use materialpoint use config use discretization_mesh use FEM_Utilities From f13691fadc1d0dd0f711ccacad6c756542099c42 Mon Sep 17 00:00:00 2001 From: Franz Roters Date: Wed, 4 May 2022 14:55:03 +0200 Subject: [PATCH 074/142] adjust permissions of all modified files --- install/MarcMentat/apply_DAMASK_modifications.py | 1 + 1 file changed, 1 insertion(+) diff --git a/install/MarcMentat/apply_DAMASK_modifications.py b/install/MarcMentat/apply_DAMASK_modifications.py index 9ffe187c5..a17120895 100755 --- a/install/MarcMentat/apply_DAMASK_modifications.py +++ b/install/MarcMentat/apply_DAMASK_modifications.py @@ -76,6 +76,7 @@ damask.util.run(f'xvfb-run -a {executable} -compile {menu_file}') print('setting file access rights...') for file in (glob.glob(str(marc_root/f'marc{marc_version}/tools/*_damask*')) + + glob.glob(str(marc_root/f'mentat{marc_version}/bin/edit_window')) + glob.glob(str(marc_root/f'mentat{marc_version}/bin/kill[4-6]')) + glob.glob(str(marc_root/f'mentat{marc_version}/bin/submit[4-6]'))): os.chmod(file , 0o755) From da595d46db29b6c22d3ddcbf7160f729d5de0647 Mon Sep 17 00:00:00 2001 From: Franz Roters Date: Wed, 4 May 2022 14:56:50 +0200 Subject: [PATCH 075/142] add support for Marc2022.1 --- .../2022.1/Marc_tools/comp_damask_hmp.patch | 49 ++ .../2022.1/Marc_tools/comp_damask_lmp.patch | 49 ++ .../2022.1/Marc_tools/comp_damask_mp.patch | 49 ++ .../2022.1/Marc_tools/include_linux64.patch | 100 +++ .../2022.1/Marc_tools/run_damask_hmp.patch | 710 +++++++++++++++++ .../2022.1/Marc_tools/run_damask_lmp.patch | 710 +++++++++++++++++ .../2022.1/Marc_tools/run_damask_mp.patch | 730 ++++++++++++++++++ .../2022.1/Mentat_bin/edit_window.patch | 24 + .../MarcMentat/2022.1/Mentat_bin/kill4.patch | 0 .../MarcMentat/2022.1/Mentat_bin/kill5.patch | 0 .../MarcMentat/2022.1/Mentat_bin/kill6.patch | 0 .../2022.1/Mentat_bin/submit4.patch | 38 + .../2022.1/Mentat_bin/submit5.patch | 38 + .../2022.1/Mentat_bin/submit6.patch | 38 + .../2022.1/Mentat_menus/job_run.ms.patch | 158 ++++ src/Marc/include/concom2022.1 | 464 +++++++++++ src/Marc/include/creeps2022.1 | 72 ++ 17 files changed, 3229 insertions(+) create mode 100644 install/MarcMentat/2022.1/Marc_tools/comp_damask_hmp.patch create mode 100644 install/MarcMentat/2022.1/Marc_tools/comp_damask_lmp.patch create mode 100644 install/MarcMentat/2022.1/Marc_tools/comp_damask_mp.patch create mode 100644 install/MarcMentat/2022.1/Marc_tools/include_linux64.patch create mode 100644 install/MarcMentat/2022.1/Marc_tools/run_damask_hmp.patch create mode 100644 install/MarcMentat/2022.1/Marc_tools/run_damask_lmp.patch create mode 100644 install/MarcMentat/2022.1/Marc_tools/run_damask_mp.patch create mode 100644 install/MarcMentat/2022.1/Mentat_bin/edit_window.patch create mode 100644 install/MarcMentat/2022.1/Mentat_bin/kill4.patch create mode 100644 install/MarcMentat/2022.1/Mentat_bin/kill5.patch create mode 100644 install/MarcMentat/2022.1/Mentat_bin/kill6.patch create mode 100644 install/MarcMentat/2022.1/Mentat_bin/submit4.patch create mode 100644 install/MarcMentat/2022.1/Mentat_bin/submit5.patch create mode 100644 install/MarcMentat/2022.1/Mentat_bin/submit6.patch create mode 100644 install/MarcMentat/2022.1/Mentat_menus/job_run.ms.patch create mode 100644 src/Marc/include/concom2022.1 create mode 100644 src/Marc/include/creeps2022.1 diff --git a/install/MarcMentat/2022.1/Marc_tools/comp_damask_hmp.patch b/install/MarcMentat/2022.1/Marc_tools/comp_damask_hmp.patch new file mode 100644 index 000000000..8dda8e1ce --- /dev/null +++ b/install/MarcMentat/2022.1/Marc_tools/comp_damask_hmp.patch @@ -0,0 +1,49 @@ +--- ++++ +@@ -6,18 +6,27 @@ + DIR=$1 + user=$3 + program=$4 ++usernoext=$user ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` ++ ++# add BLAS options for linking ++ BLAS="%BLAS%" ++ + . $DIR/tools/include + DIRJOB=$2 + cd $DIRJOB +-echo "Compiling and linking user subroutine $user.f on host `hostname`" ++echo "Compiling and linking user subroutine $user on host `hostname`" + echo "program: $program" +- $FORTRAN $user.f || \ ++ $DFORTHIGHMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null +- userobj=$user.o ++ userobj=$usernoext.o + + + $LOAD ${program} $DIR/lib/main.o\ +@@ -33,9 +42,13 @@ echo "program: $program" + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $BLAS \ + $SYSLIBS || \ + { +- echo "$0: link failed for $user.o on host `hostname`" ++ echo "$0: link failed for $usernoext.o on host `hostname`" + exit 1 + } + /bin/rm $userobj ++ /bin/rm $DIRJOB/*.mod ++ /bin/rm $DIRJOB/*.smod ++ /bin/rm $DIRJOB/*_genmod.f90 diff --git a/install/MarcMentat/2022.1/Marc_tools/comp_damask_lmp.patch b/install/MarcMentat/2022.1/Marc_tools/comp_damask_lmp.patch new file mode 100644 index 000000000..6ea9c098f --- /dev/null +++ b/install/MarcMentat/2022.1/Marc_tools/comp_damask_lmp.patch @@ -0,0 +1,49 @@ +--- ++++ +@@ -6,18 +6,27 @@ + DIR=$1 + user=$3 + program=$4 ++usernoext=$user ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` ++ ++# add BLAS options for linking ++ BLAS="%BLAS%" ++ + . $DIR/tools/include + DIRJOB=$2 + cd $DIRJOB +-echo "Compiling and linking user subroutine $user.f on host `hostname`" ++echo "Compiling and linking user subroutine $user on host `hostname`" + echo "program: $program" +- $FORTRAN $user.f || \ ++ $DFORTRANLOWMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null +- userobj=$user.o ++ userobj=$usernoext.o + + + $LOAD ${program} $DIR/lib/main.o\ +@@ -33,9 +42,13 @@ echo "program: $program" + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $BLAS \ + $SYSLIBS || \ + { +- echo "$0: link failed for $user.o on host `hostname`" ++ echo "$0: link failed for $usernoext.o on host `hostname`" + exit 1 + } + /bin/rm $userobj ++ /bin/rm $DIRJOB/*.mod ++ /bin/rm $DIRJOB/*.smod ++ /bin/rm $DIRJOB/*_genmod.f90 diff --git a/install/MarcMentat/2022.1/Marc_tools/comp_damask_mp.patch b/install/MarcMentat/2022.1/Marc_tools/comp_damask_mp.patch new file mode 100644 index 000000000..3316227d6 --- /dev/null +++ b/install/MarcMentat/2022.1/Marc_tools/comp_damask_mp.patch @@ -0,0 +1,49 @@ +--- ++++ +@@ -6,18 +6,27 @@ + DIR=$1 + user=$3 + program=$4 ++usernoext=$user ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` ++ ++# add BLAS options for linking ++ BLAS="%BLAS%" ++ + . $DIR/tools/include + DIRJOB=$2 + cd $DIRJOB +-echo "Compiling and linking user subroutine $user.f on host `hostname`" ++echo "Compiling and linking user subroutine $user on host `hostname`" + echo "program: $program" +- $FORTRAN $user.f || \ ++ $DFORTRANMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null +- userobj=$user.o ++ userobj=$usernoext.o + + + $LOAD ${program} $DIR/lib/main.o\ +@@ -33,9 +42,13 @@ echo "program: $program" + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $BLAS \ + $SYSLIBS || \ + { +- echo "$0: link failed for $user.o on host `hostname`" ++ echo "$0: link failed for $usernoext.o on host `hostname`" + exit 1 + } + /bin/rm $userobj ++ /bin/rm $DIRJOB/*.mod ++ /bin/rm $DIRJOB/*.smod ++ /bin/rm $DIRJOB/*_genmod.f90 diff --git a/install/MarcMentat/2022.1/Marc_tools/include_linux64.patch b/install/MarcMentat/2022.1/Marc_tools/include_linux64.patch new file mode 100644 index 000000000..d16e21403 --- /dev/null +++ b/install/MarcMentat/2022.1/Marc_tools/include_linux64.patch @@ -0,0 +1,100 @@ +--- ++++ +@@ -166,6 +166,11 @@ if test -n "$MSCCOSIM_HOME"; then + MARC_COSIM_LIB="$MSCCOSIM_HOME/Cosim$MSCCOSIM_VERSION/Dcosim$MSCCOSIM_VERSION/lib" + fi + ++# DAMASK uses the HDF5 compiler wrapper around the Intel compiler ++H5FC="$(h5fc -shlib -show)" ++HDF5_LIB=${H5FC//ifort/} ++FCOMP="$H5FC -DDAMASK_HDF5" ++ + # AEM + if test "$MARCDLLOUTDIR" = ""; then + DLLOUTDIR="$MARC_LIB" +@@ -477,8 +482,8 @@ if test "$MARC_INTEGER_SIZE" = "i4" ; then + I8DEFINES= + I8CDEFINES= + else +- I8FFLAGS="-i8" +- I8DEFINES="-DI64" ++ I8FFLAGS="-i8 -integer-size 64" ++ I8DEFINES="-DI64 -DINT=8" + I8CDEFINES="-U_DOUBLE -D_SINGLE" + fi + +@@ -594,7 +599,7 @@ then + PROFILE=" $PROFILE -pg" + fi + +-FORT_OPT="-c -assume byterecl -safe_cray_ptr -mp1 -WB -fp-model source" ++FORT_OPT="-c -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr -mp1 -WB -fp-model source" + if test "$MTHREAD" = "OPENMP" + then + FORT_OPT=" $FORT_OPT -qopenmp" +@@ -607,7 +612,7 @@ else + FORT_OPT=" $FORT_OPT -save -zero" + fi + if test "$MARCHDF_HDF" = "HDF"; then +- FORT_OPT="$FORT_OPT -DMARCHDF_HDF=$MARCHDF_HDF $HDF_INCLUDE" ++ FORT_OPT="$FORT_OPT -DMARCHDF=$MARCHDF_HDF" + fi + + FORTLOW="$FCOMP $FORT_OPT $PROFILE -O0 $I8FFLAGS -I$MARC_SOURCE/common \ +@@ -621,6 +626,29 @@ FORTNA="$FCOMP $FORT_OPT -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ + # for compiling free form f90 files. high opt, integer(4) + FORTF90="$FCOMP -c -O3" + ++# determine DAMASK version ++if test -n "$DAMASK_USER"; then ++ DAMASKROOT=`dirname $DAMASK_USER`/.. ++ read DAMASKVERSION < $DAMASKROOT/VERSION ++ DAMASKVERSION="'"$DAMASKVERSION"'" ++else ++ DAMASKVERSION="'N/A'" ++fi ++ ++# DAMASK compiler calls ++DFORTLOWMP="$FCOMP -c -O0 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2022.1 -DDAMASKVERSION=$DAMASKVERSION \ ++ -qopenmp -qopenmp-threadprivate=compat\ ++ $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" ++DFORTRANMP="$FCOMP -c -O1 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2022.1 -DDAMASKVERSION=$DAMASKVERSION \ ++ -qopenmp -qopenmp-threadprivate=compat\ ++ $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" ++DFORTHIGHMP="$FCOMP -c -O3 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ ++ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2022.1 -DDAMASKVERSION=$DAMASKVERSION \ ++ -qopenmp -qopenmp-threadprivate=compat\ ++ $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD" ++ + if test "$MARCDEBUG" = "ON" + then + FORTLOW="$FCOMP $FORT_OPT $PROFILE $I8FFLAGS -I$MARC_SOURCE/common \ +@@ -778,7 +806,7 @@ SECLIBS="-L$MARC_LIB -llapi" + + SOLVERLIBS="${BCSSOLVERLIBS} ${VKISOLVERLIBS} ${CASISOLVERLIBS} ${MF2SOLVERLIBS} \ + -L$MARC_MKL \ +- $MARC_LIB/blas_src.a ${ACSI_LIB}/ACSI_MarcLib.a $KDTREE2_LIB/libkdtree2.a $MARC_LIB/libtetmeshinterface.a $MARC_LIB/libcaefatigueinterface.a -L$MARC_LIB -lmkl_blacs_intelmpi_ilp64 -lmkl_scalapack_ilp64 -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -ltetmesh -lmeshgems -lmg-tetra -lmeshgems_stubs $HDF_LIBS $SOLVER2LIBS" ++ $MARC_LIB/blas_src.a ${ACSI_LIB}/ACSI_MarcLib.a $KDTREE2_LIB/libkdtree2.a $MARC_LIB/libtetmeshinterface.a $MARC_LIB/libcaefatigueinterface.a -L$MARC_LIB -lmkl_blacs_intelmpi_ilp64 -lmkl_scalapack_ilp64 -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -ltetmesh -lmeshgems -lmg-tetra -lmeshgems_stubs $HDF5_LIB $SOLVER2LIBS" + + SOLVERLIBS_DLL=${SOLVERLIBS} + if test "$AEM_DLL" -eq 1 +@@ -802,7 +830,7 @@ then + OPENSSL=NONE + fi + +-SYSLIBS=" $OPENMP -lpthread -shared-intel -cxxlib $MARC_RPC_LIB" ++SYSLIBS=" $OPENMP -lpthread -cxxlib $MARC_RPC_LIB" + + # Uncomment the following lines to turn on the trace and comment out the next 4 lines + # if test $MPITYPE = intelmpi +@@ -812,7 +840,7 @@ SYSLIBS=" $OPENMP -lpthread -shared-intel -cxxlib $MARC_RPC_LIB" + # fi + if test $MPITYPE = intelmpi + then +- SYSLIBS="-L${MPI_ROOT}/lib/release -lmpi -L${MPI_ROOT}/lib -lmpifort -lrt $OPENMP -threads -lpthread -shared-intel -cxxlib $MARC_RPC_LIB" ++ SYSLIBS="-L${MPI_ROOT}/lib/release -lmpi -L${MPI_ROOT}/lib -lmpifort -lrt $OPENMP -threads -lpthread -cxxlib $MARC_RPC_LIB" + fi + + if test "$ZLIB" = "ZLIB"; then diff --git a/install/MarcMentat/2022.1/Marc_tools/run_damask_hmp.patch b/install/MarcMentat/2022.1/Marc_tools/run_damask_hmp.patch new file mode 100644 index 000000000..e3a364e00 --- /dev/null +++ b/install/MarcMentat/2022.1/Marc_tools/run_damask_hmp.patch @@ -0,0 +1,710 @@ +--- ++++ +@@ -302,7 +302,23 @@ fi + + . "$DIR/getarch" + ++ ++# getting user subroutine file name ++found=0 ++for i in "$@"; do ++ if test $found = 1; then ++ DAMASK_USER=$i ++ found=0 ++ fi ++ case $i in ++ -u* | -U*) ++ found=1 ++ ;; ++ esac ++done ++# sourcing include_linux64 (needs DAMASK_USER to be set) + . $MARC_INCLUDE ++ + # + + # +@@ -405,7 +421,7 @@ sid= + did= + vid= + user= +-usersubname= ++usernoext= + objs= + qid=background + cpu= +@@ -573,7 +589,7 @@ do + justlist=yes + ;; + -fe* | -FE*) +- feature=$value ++ feature=$value + + ;; + -pr* | -PR*) +@@ -676,50 +692,19 @@ do + esac + ;; + -u* | -U*) +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user +- basefile=`$BASENAME $value` +- if test ${basefile##*.} = f +- then +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user.f +- elif test ${basefile##*.} = F +- then +- user=`dirname $value`/`$BASENAME $value .F` +- usersubname=$user.F +- elif test ${basefile##*.} = f90 +- then +- user=`dirname $value`/`$BASENAME $value .f90` +- usersubname=$user.f90 +- elif test ${basefile##*.} = F90 +- then +- user=`dirname $value`/`$BASENAME $value .F90` +- usersubname=$user.F90 +- fi ++ user=$value + case $user in + \/*) + ;; + *) + user=`pwd`/$user +- usersubname=`pwd`/$usersubname + ;; + esac +- if test ! -f $usersubname +- then +- if test -f $usersubname.f +- then +- usersubname=$usersubname.f +- elif test -f $usersubname.F +- then +- usersubname=$usersubname.F +- elif test -f $usersubname.f90 +- then +- usersubname=$usersubname.f90 +- elif test -f $usersubname.F90 +- then +- usersubname=$usersubname.F90 +- fi +- fi ++ usernoext=$user ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` + ;; + -obj | -OBJ) + objs="$value" +@@ -739,19 +724,19 @@ do + ;; + esac + ;; +- -dl | -DL) +- case $value in +- y* | Y*) +- deletelog=yes +- ;; +- n* | N*) +- deletelog=no +- ;; +- *) +- ;; +- esac ++ -dl | -DL) ++ case $value in ++ y* | Y*) ++ deletelog=yes ++ ;; ++ n* | N*) ++ deletelog=no ++ ;; ++ *) ++ ;; ++ esac + +- ;; ++ ;; + -at | -AT) + att=$value + ;; +@@ -1207,12 +1192,12 @@ post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 or $DIRPID/$pid.h5 not accessible + fi + fi + fi +- if test "$usersubname" ++ if test "$user" + then +- if test ! -f $usersubname ++ if test ! -f $user + then + error="$error +-user subroutine file $usersubname not accessible" ++user subroutine file $user not accessible" + fi + fi + if test "$objs" +@@ -1386,7 +1371,7 @@ else + else + error="$error + job id required" +- fi ++fi + fi + + case $qid in +@@ -1531,7 +1516,7 @@ Program name : $prog + Marc shared lib : $progdll + Version type : $mode + Job ID : $DIRJID/$jid$extra_job_info +-User subroutine name : $usersubname ++User subroutine name : $user + User objects/libs : $objs + Restart file job ID : $rid + Substructure file ID : $sid +@@ -1564,7 +1549,7 @@ Program name : $prog + Marc shared lib : $progdll + Version type : $mode + Job ID : $DIRJID/$jid$extra_job_info +-User subroutine name : $usersubname ++User subroutine name : $user + User objects/libs : $objs + Restart file job ID : $rid + Substructure file ID : $sid +@@ -1687,7 +1672,7 @@ Program name ($prog)? $ECHOTXT" + ;; + esac + fi +- $ECHO "User subroutine name ($usersubname)? $ECHOTXT" ++ $ECHO "User subroutine name ($user)? $ECHOTXT" + read value + if test "$value" + then +@@ -1696,50 +1681,19 @@ Program name ($prog)? $ECHOTXT" + user= + ;; + *) +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user +- basefile=`$BASENAME $value` +- if test ${basefile##*.} = f +- then +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user.f +- elif test ${basefile##*.} = F +- then +- user=`dirname $value`/`$BASENAME $value .F` +- usersubname=$user.F +- elif test ${basefile##*.} = f90 +- then +- user=`dirname $value`/`$BASENAME $value .f90` +- usersubname=$user.f90 +- elif test ${basefile##*.} = F90 +- then +- user=`dirname $value`/`$BASENAME $value .F90` +- usersubname=$user.F90 +- fi ++ user=$value + case $user in +- \/*) +- ;; +- *) ++ \/*) ++ ;; ++ *) + user=`pwd`/$user +- usersubname=`pwd`/$usersubname +- ;; +- esac +- if test ! -f $usersubname +- then +- if test -f $usersubname.f +- then +- usersubname=$usersubname.f +- elif test -f $usersubname.F +- then +- usersubname=$usersubname.F +- elif test -f $usersubname.f90 +- then +- usersubname=$usersubname.f90 +- elif test -f $usersubname.F90 +- then +- usersubname=$usersubname.F90 +- fi +- fi ++ ;; ++ esac ++ usernoext=$user ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` + ;; + esac + fi +@@ -2274,11 +2228,12 @@ fi + # + # user subroutine used + # ++# add DAMASK options for linking ++ DAMASK="-lstdc++" + + if test "$user" + then +-# program=$user.marc +- program=$DIRJOB/`$BASENAME $user .f`.marc ++ program=$usernoext.marc + case $program in + \/* | \.\/*) + bd= +@@ -2391,7 +2346,7 @@ fi + fi + if test "$user" + then +- execpath=$DIRJOB/`$BASENAME $user .f`.marc ++ execpath=$usernoext.marc + usersub=1 + fi + export execpath +@@ -3274,44 +3229,27 @@ then + echo + if test "$user" + then +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname +- fi +- ++ userobj=$usermoext.o + fi + cat > $jid.runmarcscript << END4 + if test "$user" + then +- if test ${basefile##*.} = f +- then +- ln -sf "$user.f" "$usersub" +- fi + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTHIGHMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTHIGHMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi + + +@@ -3331,10 +3269,11 @@ then + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ +- $SFLIB \ ++ $DAMASK \ ++ $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +- $SECLIBS || \ ++ $SECLIBS || \ + { + echo "$0: link failed for ${user:+$userobj }$objs" + exit 1 +@@ -3344,6 +3283,9 @@ else + prgsav=yes + fi + /bin/rm $userobj 2>/dev/null ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + + # + # run marc +@@ -3390,7 +3332,7 @@ if test $dllrun -eq 0; then + fi + else + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes +@@ -3556,7 +3498,7 @@ then + # first copy over the user sub if local directories + if test ${dirstatus[$counter]} = "local" + then +- $RCP $user.f $i:$DIR1/ ++ $RCP $user $i:$DIR1/ + fi + # do the compilation on the other machine + if test ${dirstatus[$counter]} = "shared" +@@ -3569,21 +3511,21 @@ then + remoteuser=$DIR1/`$BASENAME $user` + $RSH $i /bin/rm $remoteprog 2> /dev/null + echo +- $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog ++ $RSH $i $DIR2/tools/comp_damask_hmp $DIR2 $DIR1 $remoteuser $remoteprog + # check if successful, the new executable should be there + line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` + if test "$line" + then + echo compilation and linking successful on host $i + else +- echo "$0: compile failed for $user.f on host $i" ++ echo "$0: compile failed for $user on host $i" + echo " $PRODUCT Exit number 3" + exit 1 + fi + # remove the user subroutine on remote machine + if test ${dirstatus[$counter]} = "local" + then +- $RSH $i /bin/rm $remoteuser.f 2> /dev/null ++ $RSH $i /bin/rm $remoteuser 2> /dev/null + fi + fi + fi +@@ -3593,39 +3535,27 @@ then + if test "$userhost" + then + echo +- echo "Compiling and linking user subroutine $user.f on host `hostname`" +- fi +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname ++ echo "Compiling and linking user subroutine $user on host `hostname`" + fi ++ userobj=$usernoext.o + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTHIGHMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + echo " $PRODUCT Exit number 3" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTHIGHMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + echo " $PRODUCT Exit number 3" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi # if test $user + + +@@ -3645,10 +3575,11 @@ then + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ +- $SFLIB \ ++ $DAMASK \ ++ $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +- $SECLIBS || \ ++ $SECLIBS || \ + { + echo "$0: link failed for ${user:+$userobj }$objs" + echo " $PRODUCT Exit number 3" +@@ -3686,6 +3617,9 @@ else # if test $link + prgsav=yes + fi # if test $link + /bin/rm $userobj 2>/dev/null ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + + # + # run marc +@@ -3744,42 +3678,42 @@ then + counter=0 + if test -f "$host_filt" + then +- for i in `$AWK -v n=$numfield '{print $n}' $host_filt` +- do +- ibase=${i%%.*} +- if test $ibase != $thishost ++ for i in `$AWK -v n=$numfield '{print $n}' $host_filt` ++ do ++ ibase=${i%%.*} ++ if test $ibase != $thishost ++ then ++ counter=$((counter+1)) ++ DIR1=$DIRJOB ++ line=`grep -v '^#' $userhost | grep "^$ibase "` ++ workdir=`echo $line | $AWK '{print $3}'` ++ if test -n "$workdir" + then +- counter=$((counter+1)) +- DIR1=$DIRJOB +- line=`grep -v '^#' $userhost | grep "^$ibase "` +- workdir=`echo $line | $AWK '{print $3}'` +- if test -n "$workdir" +- then +- DIR1=$workdir +- fi +- # if an incompatible host uses shared directory, +- # then the root machine deletes the executable +- if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" +- then +- hname=_$ibase +- /bin/rm ${execname}$hname +- fi +- # if local directory used, the remote machine +- # deletes the executable +- if test ${dirstatus[$counter]} = "local" +- then +- $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null +- fi ++ DIR1=$workdir + fi +- done +- fi ++ # if an incompatible host uses shared directory, ++ # then the root machine deletes the executable ++ if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" ++ then ++ hname=_$ibase ++ /bin/rm ${execname}$hname ++ fi ++ # if local directory used, the remote machine ++ # deletes the executable ++ if test ${dirstatus[$counter]} = "local" ++ then ++ $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null ++ fi ++ fi ++ done + fi + fi + fi ++fi + else + #dllrun >0 + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes;then +@@ -3904,7 +3838,7 @@ then + # first copy over the user sub if local directories + if test ${dirstatus[$counter]} = "local" + then +- $RCP $user.f $i:$DIR1/ ++ $RCP $user $i:$DIR1/ + fi + # do the compilation on the other machine + if test ${dirstatus[$counter]} = "shared" +@@ -3917,20 +3851,20 @@ then + remoteuser=$DIR1/`$BASENAME $user` + $RSH $i /bin/rm $remoteprog 2> /dev/null + echo +- $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog ++ $RSH $i $DIR2/tools/comp_damask_hmp $DIR2 $DIR1 $remoteuser $remoteprog + # check if successful, the new executable should be there + line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` + if test "$line" + then + echo compilation and linking successful on host $i + else +- echo "$0: compile failed for $user.f on host $i" ++ echo "$0: compile failed for $user on host $i" + exit 1 + fi + # remove the user subroutine on remote machine + if test ${dirstatus[$counter]} = "local" + then +- $RSH $i /bin/rm $remoteuser.f 2> /dev/null ++ $RSH $i /bin/rm $remoteuser 2> /dev/null + fi + fi + fi +@@ -3940,37 +3874,25 @@ then + if test "$userhost" + then + echo +- echo "Compiling and linking user subroutine $user.f on host `hostname`" +- fi +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname ++ echo "Compiling and linking user subroutine $user on host `hostname`" + fi ++ userobj=$usernoext.o + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTHIGHMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTHIGHMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi # if test $user + + +@@ -3990,10 +3912,11 @@ then + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $DAMASK \ + $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +- $SECLIBS || \ ++ $SECLIBS || \ + { + echo "$0: link failed for ${user:+$userobj }$objs" + exit 1 +@@ -4030,7 +3953,9 @@ else # if test $link + prgsav=yes + fi # if test $link + /bin/rm $userobj 2>/dev/null +- ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + # done if no job id given + if test -z "$jid" + then +@@ -4070,7 +3995,7 @@ if test $ddm_arc -gt 0; then + RUN_JOB="$BINDIR/exeddm $RUN_JOB -ddm $ddm_arc " + fi + +-$RUN_JOB ++ $RUN_JOB + + if test $nprocd -gt 1 + then +@@ -4114,42 +4039,42 @@ then + counter=0 + if test -f "$host_filt" + then +- for i in `$AWK -v n=$numfield '{print $n}' $host_filt` +- do +- ibase=${i%%.*} +- if test $ibase != $thishost ++ for i in `$AWK -v n=$numfield '{print $n}' $host_filt` ++ do ++ ibase=${i%%.*} ++ if test $ibase != $thishost ++ then ++ counter=$((counter+1)) ++ DIR1=$DIRJOB ++ line=`grep -v '^#' $userhost | grep "^$ibase "` ++ workdir=`echo $line | $AWK '{print $3}'` ++ if test -n "$workdir" + then +- counter=$((counter+1)) +- DIR1=$DIRJOB +- line=`grep -v '^#' $userhost | grep "^$ibase "` +- workdir=`echo $line | $AWK '{print $3}'` +- if test -n "$workdir" +- then +- DIR1=$workdir +- fi +- # if an incompatible host uses shared directory, +- # then the root machine deletes the executable +- if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" +- then +- hname=_$ibase +- /bin/rm ${execname}$hname +- fi +- # if local directory used, the remote machine +- # deletes the executable +- if test ${dirstatus[$counter]} = "local" +- then +- $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null +- fi ++ DIR1=$workdir + fi +- done +- fi ++ # if an incompatible host uses shared directory, ++ # then the root machine deletes the executable ++ if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" ++ then ++ hname=_$ibase ++ /bin/rm ${execname}$hname ++ fi ++ # if local directory used, the remote machine ++ # deletes the executable ++ if test ${dirstatus[$counter]} = "local" ++ then ++ $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null ++ fi ++ fi ++ done + fi + fi + fi ++fi + else + #dllrun >0 + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes;then diff --git a/install/MarcMentat/2022.1/Marc_tools/run_damask_lmp.patch b/install/MarcMentat/2022.1/Marc_tools/run_damask_lmp.patch new file mode 100644 index 000000000..a5989bfca --- /dev/null +++ b/install/MarcMentat/2022.1/Marc_tools/run_damask_lmp.patch @@ -0,0 +1,710 @@ +--- ++++ +@@ -302,7 +302,23 @@ fi + + . "$DIR/getarch" + ++ ++# getting user subroutine file name ++found=0 ++for i in "$@"; do ++ if test $found = 1; then ++ DAMASK_USER=$i ++ found=0 ++ fi ++ case $i in ++ -u* | -U*) ++ found=1 ++ ;; ++ esac ++done ++# sourcing include_linux64 (needs DAMASK_USER to be set) + . $MARC_INCLUDE ++ + # + + # +@@ -405,7 +421,7 @@ sid= + did= + vid= + user= +-usersubname= ++usernoext= + objs= + qid=background + cpu= +@@ -573,7 +589,7 @@ do + justlist=yes + ;; + -fe* | -FE*) +- feature=$value ++ feature=$value + + ;; + -pr* | -PR*) +@@ -676,50 +692,19 @@ do + esac + ;; + -u* | -U*) +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user +- basefile=`$BASENAME $value` +- if test ${basefile##*.} = f +- then +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user.f +- elif test ${basefile##*.} = F +- then +- user=`dirname $value`/`$BASENAME $value .F` +- usersubname=$user.F +- elif test ${basefile##*.} = f90 +- then +- user=`dirname $value`/`$BASENAME $value .f90` +- usersubname=$user.f90 +- elif test ${basefile##*.} = F90 +- then +- user=`dirname $value`/`$BASENAME $value .F90` +- usersubname=$user.F90 +- fi ++ user=$value + case $user in + \/*) + ;; + *) + user=`pwd`/$user +- usersubname=`pwd`/$usersubname + ;; + esac +- if test ! -f $usersubname +- then +- if test -f $usersubname.f +- then +- usersubname=$usersubname.f +- elif test -f $usersubname.F +- then +- usersubname=$usersubname.F +- elif test -f $usersubname.f90 +- then +- usersubname=$usersubname.f90 +- elif test -f $usersubname.F90 +- then +- usersubname=$usersubname.F90 +- fi +- fi ++ usernoext=$user ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` + ;; + -obj | -OBJ) + objs="$value" +@@ -739,19 +724,19 @@ do + ;; + esac + ;; +- -dl | -DL) +- case $value in +- y* | Y*) +- deletelog=yes +- ;; +- n* | N*) +- deletelog=no +- ;; +- *) +- ;; +- esac ++ -dl | -DL) ++ case $value in ++ y* | Y*) ++ deletelog=yes ++ ;; ++ n* | N*) ++ deletelog=no ++ ;; ++ *) ++ ;; ++ esac + +- ;; ++ ;; + -at | -AT) + att=$value + ;; +@@ -1207,12 +1192,12 @@ post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 or $DIRPID/$pid.h5 not accessible + fi + fi + fi +- if test "$usersubname" ++ if test "$user" + then +- if test ! -f $usersubname ++ if test ! -f $user + then + error="$error +-user subroutine file $usersubname not accessible" ++user subroutine file $user not accessible" + fi + fi + if test "$objs" +@@ -1386,7 +1371,7 @@ else + else + error="$error + job id required" +- fi ++fi + fi + + case $qid in +@@ -1531,7 +1516,7 @@ Program name : $prog + Marc shared lib : $progdll + Version type : $mode + Job ID : $DIRJID/$jid$extra_job_info +-User subroutine name : $usersubname ++User subroutine name : $user + User objects/libs : $objs + Restart file job ID : $rid + Substructure file ID : $sid +@@ -1564,7 +1549,7 @@ Program name : $prog + Marc shared lib : $progdll + Version type : $mode + Job ID : $DIRJID/$jid$extra_job_info +-User subroutine name : $usersubname ++User subroutine name : $user + User objects/libs : $objs + Restart file job ID : $rid + Substructure file ID : $sid +@@ -1687,7 +1672,7 @@ Program name ($prog)? $ECHOTXT" + ;; + esac + fi +- $ECHO "User subroutine name ($usersubname)? $ECHOTXT" ++ $ECHO "User subroutine name ($user)? $ECHOTXT" + read value + if test "$value" + then +@@ -1696,50 +1681,19 @@ Program name ($prog)? $ECHOTXT" + user= + ;; + *) +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user +- basefile=`$BASENAME $value` +- if test ${basefile##*.} = f +- then +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user.f +- elif test ${basefile##*.} = F +- then +- user=`dirname $value`/`$BASENAME $value .F` +- usersubname=$user.F +- elif test ${basefile##*.} = f90 +- then +- user=`dirname $value`/`$BASENAME $value .f90` +- usersubname=$user.f90 +- elif test ${basefile##*.} = F90 +- then +- user=`dirname $value`/`$BASENAME $value .F90` +- usersubname=$user.F90 +- fi ++ user=$value + case $user in +- \/*) +- ;; +- *) ++ \/*) ++ ;; ++ *) + user=`pwd`/$user +- usersubname=`pwd`/$usersubname +- ;; +- esac +- if test ! -f $usersubname +- then +- if test -f $usersubname.f +- then +- usersubname=$usersubname.f +- elif test -f $usersubname.F +- then +- usersubname=$usersubname.F +- elif test -f $usersubname.f90 +- then +- usersubname=$usersubname.f90 +- elif test -f $usersubname.F90 +- then +- usersubname=$usersubname.F90 +- fi +- fi ++ ;; ++ esac ++ usernoext=$user ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` + ;; + esac + fi +@@ -2274,11 +2228,12 @@ fi + # + # user subroutine used + # ++# add DAMASK options for linking ++ DAMASK="-lstdc++" + + if test "$user" + then +-# program=$user.marc +- program=$DIRJOB/`$BASENAME $user .f`.marc ++ program=$usernoext.marc + case $program in + \/* | \.\/*) + bd= +@@ -2391,7 +2346,7 @@ fi + fi + if test "$user" + then +- execpath=$DIRJOB/`$BASENAME $user .f`.marc ++ execpath=$usernoext.marc + usersub=1 + fi + export execpath +@@ -3274,44 +3229,27 @@ then + echo + if test "$user" + then +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname +- fi +- ++ userobj=$usermoext.o + fi + cat > $jid.runmarcscript << END4 + if test "$user" + then +- if test ${basefile##*.} = f +- then +- ln -sf "$user.f" "$usersub" +- fi + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTLOWMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTLOWMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi + + +@@ -3331,10 +3269,11 @@ then + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ +- $SFLIB \ ++ $DAMASK \ ++ $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +- $SECLIBS || \ ++ $SECLIBS || \ + { + echo "$0: link failed for ${user:+$userobj }$objs" + exit 1 +@@ -3344,6 +3283,9 @@ else + prgsav=yes + fi + /bin/rm $userobj 2>/dev/null ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + + # + # run marc +@@ -3390,7 +3332,7 @@ if test $dllrun -eq 0; then + fi + else + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes +@@ -3556,7 +3498,7 @@ then + # first copy over the user sub if local directories + if test ${dirstatus[$counter]} = "local" + then +- $RCP $user.f $i:$DIR1/ ++ $RCP $user $i:$DIR1/ + fi + # do the compilation on the other machine + if test ${dirstatus[$counter]} = "shared" +@@ -3569,21 +3511,21 @@ then + remoteuser=$DIR1/`$BASENAME $user` + $RSH $i /bin/rm $remoteprog 2> /dev/null + echo +- $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog ++ $RSH $i $DIR2/tools/comp_damask_lmp $DIR2 $DIR1 $remoteuser $remoteprog + # check if successful, the new executable should be there + line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` + if test "$line" + then + echo compilation and linking successful on host $i + else +- echo "$0: compile failed for $user.f on host $i" ++ echo "$0: compile failed for $user on host $i" + echo " $PRODUCT Exit number 3" + exit 1 + fi + # remove the user subroutine on remote machine + if test ${dirstatus[$counter]} = "local" + then +- $RSH $i /bin/rm $remoteuser.f 2> /dev/null ++ $RSH $i /bin/rm $remoteuser 2> /dev/null + fi + fi + fi +@@ -3593,39 +3535,27 @@ then + if test "$userhost" + then + echo +- echo "Compiling and linking user subroutine $user.f on host `hostname`" +- fi +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname ++ echo "Compiling and linking user subroutine $user on host `hostname`" + fi ++ userobj=$usernoext.o + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTLOWMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + echo " $PRODUCT Exit number 3" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTLOWMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + echo " $PRODUCT Exit number 3" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi # if test $user + + +@@ -3645,10 +3575,11 @@ then + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ +- $SFLIB \ ++ $DAMASK \ ++ $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +- $SECLIBS || \ ++ $SECLIBS || \ + { + echo "$0: link failed for ${user:+$userobj }$objs" + echo " $PRODUCT Exit number 3" +@@ -3686,6 +3617,9 @@ else # if test $link + prgsav=yes + fi # if test $link + /bin/rm $userobj 2>/dev/null ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + + # + # run marc +@@ -3744,42 +3678,42 @@ then + counter=0 + if test -f "$host_filt" + then +- for i in `$AWK -v n=$numfield '{print $n}' $host_filt` +- do +- ibase=${i%%.*} +- if test $ibase != $thishost ++ for i in `$AWK -v n=$numfield '{print $n}' $host_filt` ++ do ++ ibase=${i%%.*} ++ if test $ibase != $thishost ++ then ++ counter=$((counter+1)) ++ DIR1=$DIRJOB ++ line=`grep -v '^#' $userhost | grep "^$ibase "` ++ workdir=`echo $line | $AWK '{print $3}'` ++ if test -n "$workdir" + then +- counter=$((counter+1)) +- DIR1=$DIRJOB +- line=`grep -v '^#' $userhost | grep "^$ibase "` +- workdir=`echo $line | $AWK '{print $3}'` +- if test -n "$workdir" +- then +- DIR1=$workdir +- fi +- # if an incompatible host uses shared directory, +- # then the root machine deletes the executable +- if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" +- then +- hname=_$ibase +- /bin/rm ${execname}$hname +- fi +- # if local directory used, the remote machine +- # deletes the executable +- if test ${dirstatus[$counter]} = "local" +- then +- $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null +- fi ++ DIR1=$workdir + fi +- done +- fi ++ # if an incompatible host uses shared directory, ++ # then the root machine deletes the executable ++ if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" ++ then ++ hname=_$ibase ++ /bin/rm ${execname}$hname ++ fi ++ # if local directory used, the remote machine ++ # deletes the executable ++ if test ${dirstatus[$counter]} = "local" ++ then ++ $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null ++ fi ++ fi ++ done + fi + fi + fi ++fi + else + #dllrun >0 + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes;then +@@ -3904,7 +3838,7 @@ then + # first copy over the user sub if local directories + if test ${dirstatus[$counter]} = "local" + then +- $RCP $user.f $i:$DIR1/ ++ $RCP $user $i:$DIR1/ + fi + # do the compilation on the other machine + if test ${dirstatus[$counter]} = "shared" +@@ -3917,20 +3851,20 @@ then + remoteuser=$DIR1/`$BASENAME $user` + $RSH $i /bin/rm $remoteprog 2> /dev/null + echo +- $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog ++ $RSH $i $DIR2/tools/comp_damask_lmp $DIR2 $DIR1 $remoteuser $remoteprog + # check if successful, the new executable should be there + line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` + if test "$line" + then + echo compilation and linking successful on host $i + else +- echo "$0: compile failed for $user.f on host $i" ++ echo "$0: compile failed for $user on host $i" + exit 1 + fi + # remove the user subroutine on remote machine + if test ${dirstatus[$counter]} = "local" + then +- $RSH $i /bin/rm $remoteuser.f 2> /dev/null ++ $RSH $i /bin/rm $remoteuser 2> /dev/null + fi + fi + fi +@@ -3940,37 +3874,25 @@ then + if test "$userhost" + then + echo +- echo "Compiling and linking user subroutine $user.f on host `hostname`" +- fi +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname ++ echo "Compiling and linking user subroutine $user on host `hostname`" + fi ++ userobj=$usernoext.o + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTLOWMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTLOWMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi # if test $user + + +@@ -3990,10 +3912,11 @@ then + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $DAMASK \ + $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +- $SECLIBS || \ ++ $SECLIBS || \ + { + echo "$0: link failed for ${user:+$userobj }$objs" + exit 1 +@@ -4030,7 +3953,9 @@ else # if test $link + prgsav=yes + fi # if test $link + /bin/rm $userobj 2>/dev/null +- ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + # done if no job id given + if test -z "$jid" + then +@@ -4070,7 +3995,7 @@ if test $ddm_arc -gt 0; then + RUN_JOB="$BINDIR/exeddm $RUN_JOB -ddm $ddm_arc " + fi + +-$RUN_JOB ++ $RUN_JOB + + if test $nprocd -gt 1 + then +@@ -4114,42 +4039,42 @@ then + counter=0 + if test -f "$host_filt" + then +- for i in `$AWK -v n=$numfield '{print $n}' $host_filt` +- do +- ibase=${i%%.*} +- if test $ibase != $thishost ++ for i in `$AWK -v n=$numfield '{print $n}' $host_filt` ++ do ++ ibase=${i%%.*} ++ if test $ibase != $thishost ++ then ++ counter=$((counter+1)) ++ DIR1=$DIRJOB ++ line=`grep -v '^#' $userhost | grep "^$ibase "` ++ workdir=`echo $line | $AWK '{print $3}'` ++ if test -n "$workdir" + then +- counter=$((counter+1)) +- DIR1=$DIRJOB +- line=`grep -v '^#' $userhost | grep "^$ibase "` +- workdir=`echo $line | $AWK '{print $3}'` +- if test -n "$workdir" +- then +- DIR1=$workdir +- fi +- # if an incompatible host uses shared directory, +- # then the root machine deletes the executable +- if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" +- then +- hname=_$ibase +- /bin/rm ${execname}$hname +- fi +- # if local directory used, the remote machine +- # deletes the executable +- if test ${dirstatus[$counter]} = "local" +- then +- $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null +- fi ++ DIR1=$workdir + fi +- done +- fi ++ # if an incompatible host uses shared directory, ++ # then the root machine deletes the executable ++ if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" ++ then ++ hname=_$ibase ++ /bin/rm ${execname}$hname ++ fi ++ # if local directory used, the remote machine ++ # deletes the executable ++ if test ${dirstatus[$counter]} = "local" ++ then ++ $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null ++ fi ++ fi ++ done + fi + fi + fi ++fi + else + #dllrun >0 + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes;then diff --git a/install/MarcMentat/2022.1/Marc_tools/run_damask_mp.patch b/install/MarcMentat/2022.1/Marc_tools/run_damask_mp.patch new file mode 100644 index 000000000..924af6fbd --- /dev/null +++ b/install/MarcMentat/2022.1/Marc_tools/run_damask_mp.patch @@ -0,0 +1,730 @@ +diff --git "a/C:\\Users\\f.roters\\Documents\\Forschung\\FEM\\Kristallplastizit\303\244t\\Programme\\Userroutinen\\Marc\\Marc_mods\\2022.1\\Marc_tools\\run_marc.original" "b/C:\\Users\\f.roters\\Documents\\Forschung\\FEM\\Kristallplastizit\303\244t\\Programme\\Userroutinen\\Marc\\Marc_mods\\2022.1\\Marc_tools\\run_damask_mp" +index 88a3027..85beabe 100644 +--- "a/C:\\Users\\f.roters\\Documents\\Forschung\\FEM\\Kristallplastizit\303\244t\\Programme\\Userroutinen\\Marc\\Marc_mods\\2022.1\\Marc_tools\\run_marc.original" ++++ "b/C:\\Users\\f.roters\\Documents\\Forschung\\FEM\\Kristallplastizit\303\244t\\Programme\\Userroutinen\\Marc\\Marc_mods\\2022.1\\Marc_tools\\run_damask_mp" +@@ -302,7 +302,23 @@ fi + + . "$DIR/getarch" + ++ ++# getting user subroutine file name ++found=0 ++for i in "$@"; do ++ if test $found = 1; then ++ DAMASK_USER=$i ++ found=0 ++ fi ++ case $i in ++ -u* | -U*) ++ found=1 ++ ;; ++ esac ++done ++# sourcing include_linux64 (needs DAMASK_USER to be set) + . $MARC_INCLUDE ++ + # + + # +@@ -405,7 +421,7 @@ sid= + did= + vid= + user= +-usersubname= ++usernoext= + objs= + qid=background + cpu= +@@ -573,7 +589,7 @@ do + justlist=yes + ;; + -fe* | -FE*) +- feature=$value ++ feature=$value + + ;; + -pr* | -PR*) +@@ -676,50 +692,19 @@ do + esac + ;; + -u* | -U*) +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user +- basefile=`$BASENAME $value` +- if test ${basefile##*.} = f +- then +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user.f +- elif test ${basefile##*.} = F +- then +- user=`dirname $value`/`$BASENAME $value .F` +- usersubname=$user.F +- elif test ${basefile##*.} = f90 +- then +- user=`dirname $value`/`$BASENAME $value .f90` +- usersubname=$user.f90 +- elif test ${basefile##*.} = F90 +- then +- user=`dirname $value`/`$BASENAME $value .F90` +- usersubname=$user.F90 +- fi ++ user=$value + case $user in + \/*) + ;; + *) + user=`pwd`/$user +- usersubname=`pwd`/$usersubname + ;; + esac +- if test ! -f $usersubname +- then +- if test -f $usersubname.f +- then +- usersubname=$usersubname.f +- elif test -f $usersubname.F +- then +- usersubname=$usersubname.F +- elif test -f $usersubname.f90 +- then +- usersubname=$usersubname.f90 +- elif test -f $usersubname.F90 +- then +- usersubname=$usersubname.F90 +- fi +- fi ++ usernoext=$user ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` + ;; + -obj | -OBJ) + objs="$value" +@@ -739,19 +724,19 @@ do + ;; + esac + ;; +- -dl | -DL) +- case $value in +- y* | Y*) +- deletelog=yes +- ;; +- n* | N*) +- deletelog=no +- ;; +- *) +- ;; +- esac ++ -dl | -DL) ++ case $value in ++ y* | Y*) ++ deletelog=yes ++ ;; ++ n* | N*) ++ deletelog=no ++ ;; ++ *) ++ ;; ++ esac + +- ;; ++ ;; + -at | -AT) + att=$value + ;; +@@ -1207,12 +1192,12 @@ post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 or $DIRPID/$pid.h5 not accessible + fi + fi + fi +- if test "$usersubname" ++ if test "$user" + then +- if test ! -f $usersubname ++ if test ! -f $user + then + error="$error +-user subroutine file $usersubname not accessible" ++user subroutine file $user not accessible" + fi + fi + if test "$objs" +@@ -1386,7 +1371,7 @@ else + else + error="$error + job id required" +- fi ++fi + fi + + case $qid in +@@ -1531,7 +1516,7 @@ Program name : $prog + Marc shared lib : $progdll + Version type : $mode + Job ID : $DIRJID/$jid$extra_job_info +-User subroutine name : $usersubname ++User subroutine name : $user + User objects/libs : $objs + Restart file job ID : $rid + Substructure file ID : $sid +@@ -1548,8 +1533,6 @@ GPGPU option : $gpuids + Host file name : $host" > $jid.log + if test "$iprintsimufact" = true ; then + echo "DDM with ARC Mapper : $ddm_arc" >> $jid.log +- echo "Mapper directory : $MESHERDIR" >> $jid.log +- echo "Meshing directory : $MESHERDIR" >> $jid.log + fi + echo \ + "Message passing type : $itree +@@ -1564,7 +1547,7 @@ Program name : $prog + Marc shared lib : $progdll + Version type : $mode + Job ID : $DIRJID/$jid$extra_job_info +-User subroutine name : $usersubname ++User subroutine name : $user + User objects/libs : $objs + Restart file job ID : $rid + Substructure file ID : $sid +@@ -1579,6 +1562,8 @@ Solver processes : $nsolverprint + Solver threads : $ntsprint" + if test "$iprintsimufact" = true ; then + echo "DDM with ARC Mapper : $ddm_arc" ++ echo "Mapper directory : $MESHERDIR" >> $jid.log ++ echo "Meshing directory : $MESHERDIR" >> $jid.log + fi + echo \ + "GPGPU option : $gpuids +@@ -1687,7 +1672,7 @@ Program name ($prog)? $ECHOTXT" + ;; + esac + fi +- $ECHO "User subroutine name ($usersubname)? $ECHOTXT" ++ $ECHO "User subroutine name ($user)? $ECHOTXT" + read value + if test "$value" + then +@@ -1696,50 +1681,19 @@ Program name ($prog)? $ECHOTXT" + user= + ;; + *) +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user +- basefile=`$BASENAME $value` +- if test ${basefile##*.} = f +- then +- user=`dirname $value`/`$BASENAME $value .f` +- usersubname=$user.f +- elif test ${basefile##*.} = F +- then +- user=`dirname $value`/`$BASENAME $value .F` +- usersubname=$user.F +- elif test ${basefile##*.} = f90 +- then +- user=`dirname $value`/`$BASENAME $value .f90` +- usersubname=$user.f90 +- elif test ${basefile##*.} = F90 +- then +- user=`dirname $value`/`$BASENAME $value .F90` +- usersubname=$user.F90 +- fi ++ user=$value + case $user in +- \/*) +- ;; +- *) ++ \/*) ++ ;; ++ *) + user=`pwd`/$user +- usersubname=`pwd`/$usersubname +- ;; +- esac +- if test ! -f $usersubname +- then +- if test -f $usersubname.f +- then +- usersubname=$usersubname.f +- elif test -f $usersubname.F +- then +- usersubname=$usersubname.F +- elif test -f $usersubname.f90 +- then +- usersubname=$usersubname.f90 +- elif test -f $usersubname.F90 +- then +- usersubname=$usersubname.F90 +- fi +- fi ++ ;; ++ esac ++ usernoext=$user ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` ++ usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` + ;; + esac + fi +@@ -2274,11 +2228,12 @@ fi + # + # user subroutine used + # ++# add DAMASK options for linking ++ DAMASK="-lstdc++" + + if test "$user" + then +-# program=$user.marc +- program=$DIRJOB/`$BASENAME $user .f`.marc ++ program=$usernoext.marc + case $program in + \/* | \.\/*) + bd= +@@ -2391,7 +2346,7 @@ fi + fi + if test "$user" + then +- execpath=$DIRJOB/`$BASENAME $user .f`.marc ++ execpath=$usernoext.marc + usersub=1 + fi + export execpath +@@ -3274,44 +3229,27 @@ then + echo + if test "$user" + then +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname +- fi +- ++ userobj=$usermoext.o + fi + cat > $jid.runmarcscript << END4 + if test "$user" + then +- if test ${basefile##*.} = f +- then +- ln -sf "$user.f" "$usersub" +- fi + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTRANMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTRANMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi + + +@@ -3331,10 +3269,11 @@ then + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ +- $SFLIB \ ++ $DAMASK \ ++ $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +- $SECLIBS || \ ++ $SECLIBS || \ + { + echo "$0: link failed for ${user:+$userobj }$objs" + exit 1 +@@ -3344,6 +3283,9 @@ else + prgsav=yes + fi + /bin/rm $userobj 2>/dev/null ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + + # + # run marc +@@ -3390,7 +3332,7 @@ if test $dllrun -eq 0; then + fi + else + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes +@@ -3556,7 +3498,7 @@ then + # first copy over the user sub if local directories + if test ${dirstatus[$counter]} = "local" + then +- $RCP $user.f $i:$DIR1/ ++ $RCP $user $i:$DIR1/ + fi + # do the compilation on the other machine + if test ${dirstatus[$counter]} = "shared" +@@ -3569,21 +3511,21 @@ then + remoteuser=$DIR1/`$BASENAME $user` + $RSH $i /bin/rm $remoteprog 2> /dev/null + echo +- $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog ++ $RSH $i $DIR2/tools/comp_damask_mp $DIR2 $DIR1 $remoteuser $remoteprog + # check if successful, the new executable should be there + line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` + if test "$line" + then + echo compilation and linking successful on host $i + else +- echo "$0: compile failed for $user.f on host $i" ++ echo "$0: compile failed for $user on host $i" + echo " $PRODUCT Exit number 3" + exit 1 + fi + # remove the user subroutine on remote machine + if test ${dirstatus[$counter]} = "local" + then +- $RSH $i /bin/rm $remoteuser.f 2> /dev/null ++ $RSH $i /bin/rm $remoteuser 2> /dev/null + fi + fi + fi +@@ -3593,39 +3535,27 @@ then + if test "$userhost" + then + echo +- echo "Compiling and linking user subroutine $user.f on host `hostname`" +- fi +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname ++ echo "Compiling and linking user subroutine $user on host `hostname`" + fi ++ userobj=$usernoext.o + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTRANMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + echo " $PRODUCT Exit number 3" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTRANMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + echo " $PRODUCT Exit number 3" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi # if test $user + + +@@ -3645,10 +3575,11 @@ then + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ +- $SFLIB \ ++ $DAMASK \ ++ $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +- $SECLIBS || \ ++ $SECLIBS || \ + { + echo "$0: link failed for ${user:+$userobj }$objs" + echo " $PRODUCT Exit number 3" +@@ -3686,6 +3617,9 @@ else # if test $link + prgsav=yes + fi # if test $link + /bin/rm $userobj 2>/dev/null ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + + # + # run marc +@@ -3744,42 +3678,42 @@ then + counter=0 + if test -f "$host_filt" + then +- for i in `$AWK -v n=$numfield '{print $n}' $host_filt` +- do +- ibase=${i%%.*} +- if test $ibase != $thishost ++ for i in `$AWK -v n=$numfield '{print $n}' $host_filt` ++ do ++ ibase=${i%%.*} ++ if test $ibase != $thishost ++ then ++ counter=$((counter+1)) ++ DIR1=$DIRJOB ++ line=`grep -v '^#' $userhost | grep "^$ibase "` ++ workdir=`echo $line | $AWK '{print $3}'` ++ if test -n "$workdir" + then +- counter=$((counter+1)) +- DIR1=$DIRJOB +- line=`grep -v '^#' $userhost | grep "^$ibase "` +- workdir=`echo $line | $AWK '{print $3}'` +- if test -n "$workdir" +- then +- DIR1=$workdir +- fi +- # if an incompatible host uses shared directory, +- # then the root machine deletes the executable +- if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" +- then +- hname=_$ibase +- /bin/rm ${execname}$hname +- fi +- # if local directory used, the remote machine +- # deletes the executable +- if test ${dirstatus[$counter]} = "local" +- then +- $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null +- fi ++ DIR1=$workdir + fi +- done +- fi ++ # if an incompatible host uses shared directory, ++ # then the root machine deletes the executable ++ if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" ++ then ++ hname=_$ibase ++ /bin/rm ${execname}$hname ++ fi ++ # if local directory used, the remote machine ++ # deletes the executable ++ if test ${dirstatus[$counter]} = "local" ++ then ++ $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null ++ fi ++ fi ++ done + fi + fi + fi ++fi + else + #dllrun >0 + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes;then +@@ -3904,7 +3838,7 @@ then + # first copy over the user sub if local directories + if test ${dirstatus[$counter]} = "local" + then +- $RCP $user.f $i:$DIR1/ ++ $RCP $user $i:$DIR1/ + fi + # do the compilation on the other machine + if test ${dirstatus[$counter]} = "shared" +@@ -3917,20 +3851,20 @@ then + remoteuser=$DIR1/`$BASENAME $user` + $RSH $i /bin/rm $remoteprog 2> /dev/null + echo +- $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog ++ $RSH $i $DIR2/tools/comp_damask_mp $DIR2 $DIR1 $remoteuser $remoteprog + # check if successful, the new executable should be there + line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` + if test "$line" + then + echo compilation and linking successful on host $i + else +- echo "$0: compile failed for $user.f on host $i" ++ echo "$0: compile failed for $user on host $i" + exit 1 + fi + # remove the user subroutine on remote machine + if test ${dirstatus[$counter]} = "local" + then +- $RSH $i /bin/rm $remoteuser.f 2> /dev/null ++ $RSH $i /bin/rm $remoteuser 2> /dev/null + fi + fi + fi +@@ -3940,37 +3874,25 @@ then + if test "$userhost" + then + echo +- echo "Compiling and linking user subroutine $user.f on host `hostname`" +- fi +- userobj=$DIRJOB/`$BASENAME $user .f`.o +- basefile=`$BASENAME $usersubname` +- if test ${basefile##*.} = f +- then +- usersub=$DIRJOB/`$BASENAME $user .f`.F +- ln -sf "$user.f" "$usersub" +- else +- usersub=$usersubname ++ echo "Compiling and linking user subroutine $user on host `hostname`" + fi ++ userobj=$usernoext.o + if test $MACHINENAME = "CRAY" + then +- $FORTRAN $usersub || \ ++ $DFORTRANMP $user || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + else +- $FORTRAN $usersub -o $userobj || \ ++ $DFORTRANMP $user -o $userobj || \ + { +- echo "$0: compile failed for $user.f" ++ echo "$0: compile failed for $user" + exit 1 + } + /bin/rm $program 2>/dev/null + fi +- if test ${basefile##*.} = f +- then +- /bin/rm -f "$usersub" +- fi + fi # if test $user + + +@@ -3990,10 +3912,11 @@ then + $TKLIBS \ + $MRCLIBS \ + $METISLIBS \ ++ $DAMASK \ + $SFLIB \ + $OPENSSL_LIB \ + $SYSLIBS \ +- $SECLIBS || \ ++ $SECLIBS || \ + { + echo "$0: link failed for ${user:+$userobj }$objs" + exit 1 +@@ -4030,7 +3953,9 @@ else # if test $link + prgsav=yes + fi # if test $link + /bin/rm $userobj 2>/dev/null +- ++/bin/rm $DIRJOB/*.mod 2>/dev/null ++/bin/rm $DIRJOB/*.smod 2>/dev/null ++/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null + # done if no job id given + if test -z "$jid" + then +@@ -4070,7 +3995,7 @@ if test $ddm_arc -gt 0; then + RUN_JOB="$BINDIR/exeddm $RUN_JOB -ddm $ddm_arc " + fi + +-$RUN_JOB ++ $RUN_JOB + + if test $nprocd -gt 1 + then +@@ -4114,42 +4039,42 @@ then + counter=0 + if test -f "$host_filt" + then +- for i in `$AWK -v n=$numfield '{print $n}' $host_filt` +- do +- ibase=${i%%.*} +- if test $ibase != $thishost ++ for i in `$AWK -v n=$numfield '{print $n}' $host_filt` ++ do ++ ibase=${i%%.*} ++ if test $ibase != $thishost ++ then ++ counter=$((counter+1)) ++ DIR1=$DIRJOB ++ line=`grep -v '^#' $userhost | grep "^$ibase "` ++ workdir=`echo $line | $AWK '{print $3}'` ++ if test -n "$workdir" + then +- counter=$((counter+1)) +- DIR1=$DIRJOB +- line=`grep -v '^#' $userhost | grep "^$ibase "` +- workdir=`echo $line | $AWK '{print $3}'` +- if test -n "$workdir" +- then +- DIR1=$workdir +- fi +- # if an incompatible host uses shared directory, +- # then the root machine deletes the executable +- if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" +- then +- hname=_$ibase +- /bin/rm ${execname}$hname +- fi +- # if local directory used, the remote machine +- # deletes the executable +- if test ${dirstatus[$counter]} = "local" +- then +- $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null +- fi ++ DIR1=$workdir + fi +- done +- fi ++ # if an incompatible host uses shared directory, ++ # then the root machine deletes the executable ++ if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" ++ then ++ hname=_$ibase ++ /bin/rm ${execname}$hname ++ fi ++ # if local directory used, the remote machine ++ # deletes the executable ++ if test ${dirstatus[$counter]} = "local" ++ then ++ $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null ++ fi ++ fi ++ done + fi + fi + fi ++fi + else + #dllrun >0 + if test $cpdll = yes; then +- filename=`basename $usersubname .f` ++ filename=$usernoext + /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null + fi + if test $rmdll = yes;then diff --git a/install/MarcMentat/2022.1/Mentat_bin/edit_window.patch b/install/MarcMentat/2022.1/Mentat_bin/edit_window.patch new file mode 100644 index 000000000..915af9bf6 --- /dev/null +++ b/install/MarcMentat/2022.1/Mentat_bin/edit_window.patch @@ -0,0 +1,24 @@ +--- ++++ +@@ -1,18 +1,5 @@ + #!/bin/sh +-# This script opens a window running an editor. The default window is an +-# xterm, and the default editor is vi. These may be customized. ++# This script opens a window running an editor. ++# The command to invoke the editor is specified during DAMASK installation + +-dir= +-for d in /usr/bin /usr/bin/X11; do +- if test -x "$d/xterm"; then +- dir="$d" +- break +- fi +-done +- +-if test -z "$dir"; then +- echo "$0: Could not find xterm" +- exit 1 +-fi +- +-"$dir/xterm" -T "vi $*" -n "vi $*" -e vi $* ++%EDITOR% $* diff --git a/install/MarcMentat/2022.1/Mentat_bin/kill4.patch b/install/MarcMentat/2022.1/Mentat_bin/kill4.patch new file mode 100644 index 000000000..e69de29bb diff --git a/install/MarcMentat/2022.1/Mentat_bin/kill5.patch b/install/MarcMentat/2022.1/Mentat_bin/kill5.patch new file mode 100644 index 000000000..e69de29bb diff --git a/install/MarcMentat/2022.1/Mentat_bin/kill6.patch b/install/MarcMentat/2022.1/Mentat_bin/kill6.patch new file mode 100644 index 000000000..e69de29bb diff --git a/install/MarcMentat/2022.1/Mentat_bin/submit4.patch b/install/MarcMentat/2022.1/Mentat_bin/submit4.patch new file mode 100644 index 000000000..3f1371fdb --- /dev/null +++ b/install/MarcMentat/2022.1/Mentat_bin/submit4.patch @@ -0,0 +1,38 @@ +--- ++++ +@@ -63,10 +64,10 @@ doe_nparallel=$6 + if [ "$slv" != "" -a "$slv" != "marc" -a "$slv" != "datfit" ]; then + slv="-iam sfm" + fi +-if [ "$slv" == "marc" ]; then ++if [ "$slv" = "marc" ]; then + slv="" + fi +-if [ "$slv" == "datfit" ]; then ++if [ "$slv" = "datfit" ]; then + slv="-iam datfit" + fi + +@@ -91,6 +92,7 @@ if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then + srcfile="-u $srcfile -save y" + ;; + runsaved) ++ srcfile=${srcfile%.*}".marc" + srcfile="-prog $srcfile" + ;; + esac +@@ -189,12 +191,12 @@ unset PYTHONHOME + unset PYTHONPATH + + if [ "$doe_first" = "-" ]; then # submit of regular Marc job +- "${DIR}/tools/run_marc" $slv -j $job -v n -b y $nprocds $nprocd \ ++ "${DIR}/tools/run_damask_hmp" $slv -j $job -v n -b y $nprocds $nprocd \ + $srcfile $restart $postfile $viewfactorsfile $hostfile \ + $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ + $assem_recov_nthread $nthread $nsolver $mode $gpu > /dev/null 2>&1 + else # submit of a DoE Marc job +- "${DIR}/tools/run_marc" $slv -j $job -v n -b n $nprocds $nprocd \ ++ "${DIR}/tools/run_damask_hmp" $slv -j $job -v n -b n $nprocds $nprocd \ + $srcfile $restart $postfile $viewfactorsfile $hostfile \ + $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ + $assem_recov_nthread $nthread $nsolver $mode $gpu diff --git a/install/MarcMentat/2022.1/Mentat_bin/submit5.patch b/install/MarcMentat/2022.1/Mentat_bin/submit5.patch new file mode 100644 index 000000000..9614d8c69 --- /dev/null +++ b/install/MarcMentat/2022.1/Mentat_bin/submit5.patch @@ -0,0 +1,38 @@ +--- ++++ +@@ -63,10 +64,10 @@ doe_nparallel=$6 + if [ "$slv" != "" -a "$slv" != "marc" -a "$slv" != "datfit" ]; then + slv="-iam sfm" + fi +-if [ "$slv" == "marc" ]; then ++if [ "$slv" = "marc" ]; then + slv="" + fi +-if [ "$slv" == "datfit" ]; then ++if [ "$slv" = "datfit" ]; then + slv="-iam datfit" + fi + +@@ -91,6 +92,7 @@ if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then + srcfile="-u $srcfile -save y" + ;; + runsaved) ++ srcfile=${srcfile%.*}".marc" + srcfile="-prog $srcfile" + ;; + esac +@@ -189,12 +191,12 @@ unset PYTHONHOME + unset PYTHONPATH + + if [ "$doe_first" = "-" ]; then # submit of regular Marc job +- "${DIR}/tools/run_marc" $slv -j $job -v n -b y $nprocds $nprocd \ ++ "${DIR}/tools/run_damask_mp" $slv -j $job -v n -b y $nprocds $nprocd \ + $srcfile $restart $postfile $viewfactorsfile $hostfile \ + $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ + $assem_recov_nthread $nthread $nsolver $mode $gpu > /dev/null 2>&1 + else # submit of a DoE Marc job +- "${DIR}/tools/run_marc" $slv -j $job -v n -b n $nprocds $nprocd \ ++ "${DIR}/tools/run_damask_mp" $slv -j $job -v n -b n $nprocds $nprocd \ + $srcfile $restart $postfile $viewfactorsfile $hostfile \ + $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ + $assem_recov_nthread $nthread $nsolver $mode $gpu diff --git a/install/MarcMentat/2022.1/Mentat_bin/submit6.patch b/install/MarcMentat/2022.1/Mentat_bin/submit6.patch new file mode 100644 index 000000000..a3ed16135 --- /dev/null +++ b/install/MarcMentat/2022.1/Mentat_bin/submit6.patch @@ -0,0 +1,38 @@ +--- ++++ +@@ -63,10 +64,10 @@ doe_nparallel=$6 + if [ "$slv" != "" -a "$slv" != "marc" -a "$slv" != "datfit" ]; then + slv="-iam sfm" + fi +-if [ "$slv" == "marc" ]; then ++if [ "$slv" = "marc" ]; then + slv="" + fi +-if [ "$slv" == "datfit" ]; then ++if [ "$slv" = "datfit" ]; then + slv="-iam datfit" + fi + +@@ -91,6 +92,7 @@ if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then + srcfile="-u $srcfile -save y" + ;; + runsaved) ++ srcfile=${srcfile%.*}".marc" + srcfile="-prog $srcfile" + ;; + esac +@@ -189,12 +191,12 @@ unset PYTHONHOME + unset PYTHONPATH + + if [ "$doe_first" = "-" ]; then # submit of regular Marc job +- "${DIR}/tools/run_marc" $slv -j $job -v n -b y $nprocds $nprocd \ ++ "${DIR}/tools/run_damask_lmp" $slv -j $job -v n -b y $nprocds $nprocd \ + $srcfile $restart $postfile $viewfactorsfile $hostfile \ + $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ + $assem_recov_nthread $nthread $nsolver $mode $gpu > /dev/null 2>&1 + else # submit of a DoE Marc job +- "${DIR}/tools/run_marc" $slv -j $job -v n -b n $nprocds $nprocd \ ++ "${DIR}/tools/run_damask_lmp" $slv -j $job -v n -b n $nprocds $nprocd \ + $srcfile $restart $postfile $viewfactorsfile $hostfile \ + $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ + $assem_recov_nthread $nthread $nsolver $mode $gpu diff --git a/install/MarcMentat/2022.1/Mentat_menus/job_run.ms.patch b/install/MarcMentat/2022.1/Mentat_menus/job_run.ms.patch new file mode 100644 index 000000000..6cbcf895c --- /dev/null +++ b/install/MarcMentat/2022.1/Mentat_menus/job_run.ms.patch @@ -0,0 +1,158 @@ +--- ++++ +@@ -261,11 +261,18 @@ popmenu job_run_popmenu { + } + button { + position +25 = +- size 25 4 ++ size 18 4 + text "ADVANCED JOB SUBMISSION" + help "job_run#Job Submission And Control" + popmenu job_submit_adv_pm + } ++ button { ++ position +18 = ++ size 7 4 ++ text "DAMASK" ++ help "damask_run#Job Submission And Control" ++ popmenu damask ++ } + button { + position 0 +4 + size 12 4 +@@ -1189,6 +1196,135 @@ popmenu job_submit_adv_pm { + } + + ++#-------------------------------------------------------------------------------------------------- ++popmenu damask { ++ ++#ifdef QT_MENTAT ++ text "DAMASK.MPIE.DE" ++#endif ++ ++ group { ++#ifndef QT_MENTAT ++ label { ++ position 0 0 ++ size 50 4 ++ text "DAMASK.MPIE.DE" ++ } ++#endif ++ ++ label { ++ position 1 6 ++ size 13 6 ++ text "Optimzation" ++ border_width 1 ++ border_color black ++ } ++ ++ label { ++ position +13 = ++ size 20 6 ++ text "write Input" ++ border_width 1 ++ border_color black ++ } ++ ++ label { ++ position +18 = ++ size 30 6 ++ text "do not write Inp." ++ border_width 1 ++ border_color black ++ } ++ ++ label { ++ position -32 +6 ++ size 12 6 ++ text "O2 / OpenMP" ++ border_width 1 ++ border_color black ++ } ++ ++ popdown { ++ position +12 = ++ size 20 6 ++ text "Submit" ++ command "*submit_job 4 *monitor_job" ++ } ++ ++ popdown { ++ position +20 = ++ size 20 6 ++ text "Execute" ++ command "*execute_job 4 *monitor_job" ++ } ++ ++ label { ++ position -32 +6 ++ size 12 6 ++ text "O1 / OpenMP" ++ border_width 1 ++ border_color black ++ } ++ ++ popdown { ++ position +12 = ++ size 20 6 ++ text "Submit" ++ command "*submit_job 5 *monitor_job" ++ } ++ ++ popdown { ++ position +20 = ++ size 20 6 ++ text "Execute" ++ command "*execute_job 5 *monitor_job" ++ } ++ ++ label { ++ position -32 +6 ++ size 12 6 ++ text "O0 / OpenMP" ++ border_width 1 ++ border_color black ++ } ++ ++ popdown { ++ position +12 = ++ size 20 6 ++ text "Submit" ++ command "*submit_job 6 *monitor_job" ++ } ++ ++ popdown { ++ position +20 = ++ size 20 6 ++ text "Execute" ++ command "*execute_job 6 *monitor_job" ++ } ++ ++ popdown { ++ position 19 +8 ++ size 12 8 ++ text "CANCEL" ++ } ++} ++ ++ window { ++ parent mentat ++ origin 38 8 ++#ifdef DCOM ++ size 50 100 ++#else ++ size 50 94 ++#endif ++ background_color body ++ border_width 1 ++ border_color border ++ buffering single ++ } ++ mode permanent ++} ++ + #-------------------------------------------------------------------------------------------------- + popmenu job_exit_msg_pm { + diff --git a/src/Marc/include/concom2022.1 b/src/Marc/include/concom2022.1 new file mode 100644 index 000000000..86cd4440c --- /dev/null +++ b/src/Marc/include/concom2022.1 @@ -0,0 +1,464 @@ +! common block definition file taken from respective MSC.Marc release and reformated to free format +!*********************************************************************** +! +! File: concom.cmn +! +! MSC.Marc include file +! +integer & + iacous, iasmbl, iautth, ibear, icompl, iconj, icreep, ideva, idyn, idynt,& + ielas, ielcma, ielect, iform, ifour, iharm, ihcps, iheat, iheatt, ihresp,& + ijoule, ilem, ilnmom, iloren, inc, incext, incsub, ipass, iplres, ipois,& + ipoist, irpflo, ismall, ismalt, isoil, ispect, ispnow, istore, iswep, ithcrp,& + itherm, iupblg, iupdat, jacflg, jel, jparks, largst, lfond, loadup, loaduq,& + lodcor, lovl, lsub, magnet, ncycle, newtnt, newton, noshr, linear, ivscpl,& + icrpim, iradrt, ipshft, itshr, iangin, iupmdr, iconjf, jincfl, jpermg, jhour,& + isolvr, jritz, jtable, jshell, jdoubl, jform, jcentr, imini, kautth, iautof,& + ibukty, iassum, icnstd, icnstt, kmakmas, imethvp, iradrte, iradrtp, iupdate, iupdatp,& + ncycnt, marmen , idynme, ihavca, ispf, kmini, imixex, largtt, kdoela, iautofg,& + ipshftp, idntrc, ipore, jtablm, jtablc, isnecma, itrnspo, imsdif, jtrnspo, mcnear,& + imech, imecht, ielcmat, ielectt, magnett, imsdift, noplas, jtabls, jactch, jtablth,& + kgmsto , jpzo, ifricsh, iremkin, iremfor, ishearp, jspf, machining, jlshell, icompsol,& + iupblgfo, jcondir, nstcrp, nactive, ipassref, nstspnt, ibeart, icheckmpc, noline, icuring,& + ishrink, ioffsflg, isetoff, ioffsetm,iharmt, inc_incdat, iautspc, ibrake, icbush, istream_input,& + iprsinp, ivlsinp, ifirst_time,ipin_m, jgnstr_glb, imarc_return,iqvcinp, nqvceid, istpnx, imicro1,& + iaxisymm, jbreakglue,iglstif, jfastasm,iwear, iwearcf, imixmeth, ielcmadyn, idinout, igena_meth,& + magf_meth, non_assumed, iredoboudry, ioffsz0,icomplt, mesh_dual, iactrp, mgnewton, iusedens,igsigd0,& + iaem, icosim, inodels, nlharm, iampini, iphasetr, inonlcl, inonlct, iforminp,ispecerror,& + icsprg, imol, imolt, idatafit,iharmpar, inclcase, imultifreq,init_elas, ifatig, iftgmat,& + nchybrid, ibuckle +dimension :: ideva(60) +integer num_concom +parameter(num_concom=262) +common/marc_concom/& + iacous, iasmbl, iautth, ibear, icompl, iconj, icreep, ideva, idyn, idynt,& + ielas, ielcma, ielect, iform, ifour, iharm, ihcps, iheat, iheatt, ihresp,& + ijoule, ilem, ilnmom, iloren, inc, incext, incsub, ipass, iplres, ipois,& + ipoist, irpflo, ismall, ismalt, isoil, ispect, ispnow, istore, iswep, ithcrp,& + itherm, iupblg, iupdat, jacflg, jel, jparks, largst, lfond, loadup, loaduq,& + lodcor, lovl, lsub, magnet, ncycle, newtnt, newton, noshr, linear, ivscpl,& + icrpim, iradrt, ipshft, itshr, iangin, iupmdr, iconjf, jincfl, jpermg, jhour,& + isolvr, jritz, jtable, jshell, jdoubl, jform, jcentr, imini, kautth, iautof,& + ibukty, iassum, icnstd, icnstt, kmakmas, imethvp, iradrte, iradrtp, iupdate, iupdatp,& + ncycnt, marmen, idynme, ihavca, ispf, kmini, imixex, largtt, kdoela, iautofg,& + ipshftp, idntrc, ipore, jtablm, jtablc, isnecma, itrnspo, imsdif, jtrnspo, mcnear,& + imech, imecht, ielcmat, ielectt, magnett, imsdift, noplas, jtabls, jactch, jtablth,& + kgmsto , jpzo, ifricsh, iremkin, iremfor, ishearp, jspf, machining, jlshell, icompsol,& + iupblgfo, jcondir, nstcrp, nactive, ipassref, nstspnt, ibeart, icheckmpc, noline, icuring,& + ishrink, ioffsflg, isetoff, ioffsetm,iharmt, inc_incdat, iautspc, ibrake, icbush, istream_input,& + iprsinp, ivlsinp, ifirst_time,ipin_m, jgnstr_glb, imarc_return,iqvcinp, nqvceid, istpnx, imicro1,& + iaxisymm, jbreakglue,iglstif, jfastasm,iwear, iwearcf, imixmeth, ielcmadyn, idinout, igena_meth,& + magf_meth, non_assumed, iredoboudry, ioffsz0,icomplt, mesh_dual, iactrp, mgnewton, iusedens,igsigd0,& + iaem, icosim, inodels, nlharm, iampini, iphasetr, inonlcl, inonlct, iforminp,ispecerror,& + icsprg, imol, imolt, idatafit,iharmpar, inclcase, imultifreq,init_elas, ifatig, iftgmat,& + nchybrid, ibuckle +! +! comments of variables: +! +! iacous Control flag for acoustic analysis. Input data. +! iacous=1 modal acoustic analysis. +! iacous=2 harmonic acoustic-structural analysis. +! iasmbl Control flag to indicate that operator matrix should be +! recalculated. +! iautth Control flag for AUTO THERM option. +! ibear Control flag for bearing analysis. Input data. +! icompl Control variable to indicate that a complex analysis is +! being performed. Either a Harmonic analysis with damping, +! or a harmonic electro-magnetic analysis. Input data. +! iconj Flag for EBE conjugate gradient solver (=solver 1, retired) +! Also used for VKI iterative solver. +! icreep Control flag for creep analysis. Input data. +! ideva(60) - debug print out flag +! 1 print element stiffness matrices, mass matrix +! 2 output matrices used in tying +! 3 force the solution of a nonpositive definite matrix +! 4 print info of connections to each node +! 5 info of gap convergence, internal heat generated, contact +! touching and separation +! 6 nodal value array during rezoning +! 7 tying info in CONRAD GAP option, fluid element numbers in +! CHANNEL option +! 8 output incremental displacements in local coord. system +! 9 latent heat output +! 10 stress-strain in local coord. system +! 11 additional info on interlaminar stress +! 12 output right hand side and solution vector +! 13 info of CPU resources used and memory available on NT +! 14 info of mesh adaption process, 2D outline information +! info of penetration checking for remeshing +! save .fem files after afmesh3d meshing +! print local adaptivity info +! 15 surface energy balance flag +! 16 print info regarding pyrolysis +! 17 print info of "streamline topology" +! 18 print mesh data changes after remeshing +! 19 print material flow stress data read in from *.mat file +! if unit flag is on, print out flow stress after conversion +! 20 print information on table input +! 21 print out information regarding kinematic boundary conditions +! 22 print out information regarding dist loads, point loads, film +! and foundations +! 23 print out information about automatic domain decomposition +! 24 print out iteration information in SuperForm status report file +! 25 print out information for ablation +! 26 print out information for films - Table input +! 27 print out the tying forces +! 28 print out for CASI solver, convection, +! 29 DDM single file debug printout +! 30 print out cavity debug info +! 31 print out welding related info +! 32 prints categorized DDM memory usage +! 33 print out the cutting info regarding machining feature +! 34 print out the list of quantities which can be defined via a table +! and for each quantity the supported independent variables +! 35 print out detailed coupling region info +! 36 print out solver debug info level 1 (Least Detailed) +! 37 print out solver debug info level 1 (Medium Detailed) +! 38 print out solver debug info level 1 (Very Detailed) +! 39 print detailed memory allocation info +! 40 print out marc-adams debug info +! 41 output rezone mapping post file for debugging +! 42 output post file after calling oprofos() for debugging +! 43 debug printout for vcct +! 44 debug printout for progressive failure +! 45 print out automatically generated midside node coordinates (arecrd) +! 46 print out message about routine and location, where the ibort is raised (ibort_inc) +! 47 print out summary message of element variables on a +! group-basis after all the automatic changes have been +! made (em_ellibp) +! 48 Automatically generate check results based on max and min vals. +! These vals are stored in the checkr file, which is inserted +! into the *dat file by the generate_check_results script from /marc/tools +! 49 Automatically generate check results based on the real calculated values +! at the sppecified check result locations. +! These vals are stored in the checkr file, which is inserted +! into the *dat file by the update_check_results script from /marc/tools +! 50 generate a file containing the resistance or capacity matrix; +! this file can be used to compare results with a reference file +! 51 print out detailed information for segment-to-segment contact +! 52 print out detailed relative displacement information +! for uniaxial sliding contact +! 53 print out detailed sliding direction information for +! uniaxial sliding contact +! 54 print out detailed information for edges attached to a curve +! 55 print information related to viscoelasticity calculations +! 56 print out detailed information for element coloring for multithreading +! 57 print out extra overheads due to multi-threading. +! These overhead includes (i) time and (ii) memory. +! The memory report will be summed over all the children. +! 58 debug output for ELSTO usage +! 59 print out contact body forces and nodes in contact +! +! idyn Control flag for dynamics. Input data. +! 1 = eigenvalue extraction and / or modal superposition +! 2 = Newmark Beta and Single Step Houbolt (ssh with idynme=1) +! 3 = Houbolt +! 4 = Central difference +! 5 = Newer central difference +! idynt Copy of idyn at begining of increment +! ielas Control flag for ELASTIC analysis. Input data. +! Set by user or automatically turned on by Fourier option. +! Implies that each load case is treated separately. +! In Adaptive meshing analysis , forces re-analysis until +! convergence obtained. +! Also seriously misused to indicate no convergence. +! = 1 elastic option with fourier analysis +! = 2 elastic option without fourier analysis +! =-1 no convergence in recycles or max # increments reached +! Set to 1 if ELASTIC or SUBSTRUC parameter cards are used, +! or if fourier option is used. +! Then set to 2 if not fourier analysis. +! ielcma Control flag for electromagnetic analysis. Input data. +! ielcma = 1 Harmonic formulation +! ielcma = 2 Transient formulation +! ielect Control flag for electrostatic option. Input data. +! iform Control flag indicating that contact will be performed. +! ifour Control flag for Fourier analysis. +! 0 = Odd and even terms. +! 1 = symmetric (cosine) terms +! 2 = antisymmetric (sine) terms. +! iharm Control flag to indicate that a harmonic analysis will +! be performed. May change between passes. +! ihcps Control flag for coupled thermal - stress analysis. +! iheat Control flag for heat transfer analysis. Input data. +! iheatt Permanent control flag for heat transfer analysis. +! Note in coupled analysis iheatt will remain as one, +! but iheat will be zero in stress pass. +! ihresp Control flag to indicate to perform a harmonic subincrement. +! ijoule Control flag for Joule heating. +! ilem Control flag to determin which vector is to be transformed. +! Control flag to see where one is: +! ilem = 1 - elem.f +! ilem = 2 - initst.f +! ilem = 3 - pressr.f +! ilem = 3 - fstif.f +! ilem = 4 - jflux.f +! ilem = 4 - strass.f +! ilem = 5 - mass.f +! ilem = 5 - osolty.f +! ilnmom Control flag for soil - pore pressure calculation. Input data. +! ilnmom = 0 - perform only pore pressure calculation. +! = 1 - couples pore pressure - displacement analysis +! iloren Control flag for DeLorenzi J-Integral evaluation. Input data. +! inc Increment number. +! incext Control flag indicating that currently working on a +! subincrement. +! Could be due to harmonics , damping component (bearing), +! stiffness component (bearing), auto therm creep or +! old viscoplaticity +! incsub Sub-increment number. +! inonlcl control flag for nonlocal pass +! inonlct permanent control flag for nonlocal pass +! ipass Control flag for which part of coupled analysis. +! ipass = -1 - reset to base values +! ipass = 0 - do nothing +! ipass = 1 - stress part +! ipass = 2 - heat transfer part +! 3 - fluid pass +! 4 - joule heating pass +! 5 - pore pressure pass +! 6 - electrostatic pass +! 7 - magnetostatic pass +! 8 - electromagnetic pass +! 9 - diffusion pass +! ipass = 10 - nonlocal part +! iplres Flag indicating that either second matrix is stored. +! dynamic analysis - mass matrix +! heat transfer - specific heat matrix +! buckle - initial stress stiffness +! ipois Control flag indicating Poisson type analysis +! ipois = 1 for heat transfer +! = 1 for heat transfer part of coupled +! = 1 for bearing +! = 1 for electrostatic +! = 1 for magnetostatic +! = 1 for nonlocal part +! ipoist Permanent copy of ipois. In coupled analysis , ipois = 0 +! in stress portion, yet ipoist will still =1. +! irpflo global flag for rigid plastic flow analysis +! = 1 eularian formulation +! = 2 regular formulation; rigid material present in the analysis +! ismall control flag to indicate small displacement analysis. input data. +! ismall = 0 - large disp included. +! ismall = 1 - small displacement. +! the flag is changing between passes. +! ismalt permanent copy of ismall . in heat transfer portion of +! coupled analysis ismall =0 , but ismalt remains the same. +! isoil control flag indicating that soil / pore pressure +! calculation . input data. +! ispect control flag for response spectrum calculation. input data. +! ispnow control flag to indicate to perform a spectrum response +! calculation now. +! istore store stresses flag. +! istore = 0 in elem.f and if first pass of creep +! convergence checking in ogetst.f +! or harmonic analysis or thruc.f if not +! converged. +! iswep control flag for eigenvalue analysis. +! iswep=1 - go do extraction process +! ithcrp control flag for auto therm creep option. input data. +! itherm control flag for either temperature dependent material +! properties and/or thermal loads. +! iupblg control flag for follower force option. input data. +! iupdat control flag for update lagrange option for current element. +! jacflg control flag for lanczos iteration method. input data. +! jel control flag indicating that total load applied in +! increment, ignore previous solution. +! jel = 1 in increment 0 +! = 1 if elastic or fourier +! = 1 in subincrements with elastic and adaptive +! jparks control flag for j integral by parks method. input data. +! largst control flag for finite strain plasticity. input data. +! lfond control variable that indicates if doing elastic +! foundation or film calculation. influences whether +! this is volumetric or surface integration. +! loadup control flag that indicates that nonlinearity occurred +! during previous increment. +! loaduq control flag that indicates that nonlinearity occurred. +! lodcor control flag for switching on the residual load correction. +! notice in input stage lodcor=0 means no loadcor, +! after omarc lodcor=1 means no loadcor +! lovl control flag for determining which "overlay" is to +! be called from ellib. +! lovl = 1 omarc +! = 2 oaread +! = 3 opress +! = 4 oasemb +! = 5 osolty +! = 6 ogetst +! = 7 oscinc +! = 8 odynam +! = 9 opmesh +! = 10 omesh2 +! = 11 osetz +! = 12 oass +! = 13 oincdt +! = 14 oasmas +! = 15 ofluas +! = 16 ofluso +! = 17 oshtra +! = 18 ocass +! = 19 osoltc +! = 20 orezon +! = 21 otest +! = 22 oeigen +! lsub control variable to determine which part of element +! assembly function is being done. +! lsub = 1 - no longer used +! = 2 - beta* +! = 3 - cons* +! = 4 - ldef* +! = 5 - posw* +! = 6 - theta* +! = 7 - tmarx* +! = 8 - geom* +! magnet control flag for magnetostatic analysis. input data. +! ncycle cycle number. accumulated in osolty.f +! note first time through oasemb.f , ncycle = 0. +! newtnt control flag for permanent copy of newton. +! newton iteration type. input data. +! newton : = 1 full newton raphson +! 2 modified newton raphson +! 3 newton raphson with strain correct. +! 4 direct substitution +! 5 direct substitution followed by n.r. +! 6 direct substitution with line search +! 7 full newton raphson with secant initial stress +! 8 secant method +! 9 full newton raphson with line search +! noshr control flag for calculation interlaminar shears for +! elements 22,45, and 75. input data. +!ees +! +! jactch = 1 or 2 if elements are activated or deactivated +! = 3 if elements are adaptively remeshed or rezoned +! = 0 normally / reset to 0 when assembly is done +! ifricsh = 0 call to fricsh in otest not needed +! = 1 call to fricsh (nodal friction) in otest needed +! iremkin = 0 remove deactivated kinematic boundary conditions +! immediately - only in new input format (this is default) +! = 1 remove deactivated kinematic boundary conditions +! gradually - only in new input format +! iremfor = 0 remove force boundary conditions immediately - +! only in new input format (this is default) +! = 1 remove force boundary conditions gradually - +! only in new input format (this is default) +! ishearp set to 1 if shear panel elements are present in the model +! +! jspf = 0 not in spf loadcase +! > 0 in spf loadcase (jspf=1 during first increment) +! machining = 1 if the metal cutting feature is used, for memory allocation purpose +! = 0 (default) if no metal cutting feature required +! +! jlshell = 1 if there is a shell element in the mesh +! icompsol = 1 if there is a composite solid element in the mesh +! iupblgfo = 1 if follower force for point loads +! jcondir = 1 if contact priority option is used +! nstcrp = 0 (default) steady state creep flag (undocumented feature. +! if not 0, turns off special ncycle = 0 code in radial.f) +! nactive = number of active passes, if =1 then it's not a coupled analysis +! ipassref = reference ipass, if not in a multiphysics pass ipass=ipassref +! icheckmpc = value of mpc-check parameter option +! noline = set to 1 in osolty if no line seacrh should be done in ogetst +! icuring = set to 1 if the curing is included for the heat transfer analysis. +! ishrink = set to 1 if shrinkage strain is included for mechancial analysis. +! ioffsflg = 1 for small displacement beam/shell offsets +! = 2 for large displacement beam/shell offsets +! isetoff = 0 - do not apply beam/shell offsets +! = 1 - apply beam/shell offsets +! ioffsetm = min. value of offset flag +! iharmt = 1 global flag if a coupled analysis contains an harmonic pass +! inc_incdat = flag to record increment number of a new loadcase in incdat.f +! iautspc = flag for AutoSPC option +! ibrake = brake squeal in this increment +! icbush = set to 1 if cbush elements present in model +! istream_input = set to 1 for streaming input calling Marc as library +! iprsinp = set to 1 if pressure input, introduced so other variables +! such as h could be a function of pressure +! ivlsinp = set to 1 if velocity input, introduced so other variables +! such as h could be a function of velocity +! ipin_m = # of beam element with PIN flag +! jgnstr_glb = global control over pre or fast integrated composite shells +! imarc_return = Marc return flag for streaming input control +! iqvcimp = if non-zero, then the number of QVECT boundary conditions +! nqvceid = number of QVECT boundary conditions, where emisivity/absorbtion id entered +! istpnx = 1 if to stop at end of increment +! imicro1 = 1 if micro1 interface is used +! iaxisymm = set to 1 if axisymmetric analysis +! jbreakglue = set to 1 if breaking glued option is used +! iglstif = 1 if ddm and global stiffness matrix formed (sgi solver 6 or solver9) +! jfastasm = 1 do fast assembly using SuperForm code +! iwear = set to 1 if wear model, set to 2 if wear model and coordinates updated +! iwearcf = set to 1 to store nodal coefficient of friction for wear calculation +! imixmeth = set=1 then use nonlinear mixture material - allocate memory +! ielcmadyn = flag for magnetodynamics +! 0 - electromagnetics using newmark beta +! 1 - transient magnetics using backward euler +! idinout = flag to control if inside out elements should be deactivated +! igena_meth = 0 - generalized alpha parameters depend on whether or not contact +! is flagged (dynamic,7) +! 10 - generalized alpha parameters are optimized for a contact +! analysis (dynamic,8) +! 11 - generalized alpha parameters are optimized for an analysis +! without contact (dynamic,8) +! magf_meth = - Method to compute force in magnetostatic - structural +! = 1 - Virtual work method based on finite difference for the force computation +! = 2 - Maxwell stress tensor +! = 3 - Virtual work method based on local derivative for the force computation +! non_assumed = 1 no assumed strain formulation (forced) +! iredoboudry set to 1 if contact boundary needs to be recalculated +! ioffsz0 = 1 if composite are used with reference position.ne.0 +! icomplt = 1 global flag if a coupled analysis contains an complex pass +! mesh_dual = 1 two independent meshes are used in magnetodynamic/thermal/structural +! one for magnetodynamic and the other for the remaining passes +! iactrp = 1 in an analysis with global remeshing, include inactive +! rigid bodies on post file +! mgnewton = 1 Use full Newton Raphson iteration for magnetostatic pass +! +! iusedens > 0 if mass density is used in the analysis (dynamics, mass dependent loading) +! igsigd0 = 1 set varselem(igsigd) to zero in next oasemb +! iaem = 1 if marc is called from aem (0 - off - default) +! icosim = 1 if marc is used in co-simulation analysis with ADAMS using the CosimEngine +! = 2 if marc is used in co-simulation analysis with ADAMS using the ACSI interface +! = 3 if marc is used in co-simulation analysis with scFLOW using the CosimEngine +! = 4 if marc is used in co-simulation analysis with scFLOW and ADAMS using the CosimEngine +! inodels = 1 nodal integration elements 239/240/241 present +! nlharm = 0 harmonic subincrements are linear +! = 1 harmonic subincrements are nonlinear +! iampini = 0 amplitude of previous harmonic subinc is initial estimate (default) +! = 1 zero amplitude is initial estimate +! iphasetr = 1 phase transformation material model is used +! iforminp flag indicating that contact is switched on via the CONTACT +! option in the input file (as opposed to the case that contact +! is switched on internally due to cyclic symmetry or model +! section creation) +! ispecerror = a+10*b (only for spectrum response analysis with missing mass option) +! a=0 or a=1 (modal shape with non-zero shift) +! b=0 or b=1 (recover with new assembly of stiffness matrix) +! icsprg = set to 1 if spring elements present in model +! imol Control flag for molecualr diffusion pass +! imolt Permanent control flag for molecualr diffusion pass +! Note in coupled analysis imolt will remain as one, +! but imol will be zero in stress pass or thermal pass. +! idatafit = run Marc to fit parameters +! iharmpar = 1 if harmonic parameter option is used +! inclcase load case increment use for cyclic plasticity data fitting +! imultifreq flag to indicate how many harmonic magnetodynamic passes are computed in coupled +! magnetodynamic/thermal(/structural) analyses. +! 0 or 1 one pass 2 two passes 3 or more is not supported +! init_elas use elastic stress-strain law as the material tangent for +! the first cycle of an increment +! ifatig packed integer telling which fatigue mode is active +! 1 = elastomer +! 10 = stress-life +! 100 = strain-life +! = 2 strain-life fatigue +! iftgmat = 0 no fatigue material properties in the dat file +! = 1 fatigue material properties in the dat file +! nchybrid cycle count used for hybrid contact; meant to force an extra iteration +! if the overlap for a node in hybrid contact is too large +! ibuckle buckle parameter option is active +! +!*********************************************************************** +!$omp threadprivate(/marc_concom/) +!! diff --git a/src/Marc/include/creeps2022.1 b/src/Marc/include/creeps2022.1 new file mode 100644 index 000000000..8fa4c8401 --- /dev/null +++ b/src/Marc/include/creeps2022.1 @@ -0,0 +1,72 @@ +! common block definition file taken from respective MSC.Marc release and reformated to free format +!*********************************************************************** +! +! File: creeps.cmn +! +! MSC.Marc include file +! +real(pReal) cptim,timinc,timinc_p,timinc_s,timincm,timinc_a,timinc_b +integer icfte,icfst,icfeq,icftm,icetem,mcreep,jcreep,icpa,icftmp,icfstr,& + icfqcp,icfcpm,icrppr,icrcha,icpb,iicpmt,iicpa +real(pReal) time_beg_lcase,time_beg_inc,fractol,time_beg_pst +real(pReal) fraction_donn,timinc_ol2 +! +integer num_creepsr,num_creepsi,num_creeps2r +parameter(num_creepsr=7) +parameter(num_creepsi=17) +parameter(num_creeps2r=6) +common/marc_creeps/cptim,timinc,timinc_p,timinc_s,timincm,timinc_a,timinc_b,icfte,icfst,& + icfeq,icftm,icetem,mcreep,jcreep,icpa,icftmp,icfstr,icfqcp,icfcpm,icrppr,icrcha,icpb,iicpmt,iicpa +common/marc_creeps2/time_beg_lcase,time_beg_inc,fractol,time_beg_pst,fraction_donn,timinc_ol2 +! +! cptim Total time at begining of increment. +! timinc Incremental time for this step. +! icfte Local copy number of slopes of creep strain rate function +! versus temperature. Is -1 if exponent law used. +! icfst Local copy number of slopes of creep strain rate function +! versus equivalent stress. Is -1 if exponent law used. +! icfeq Local copy number of slopes of creep strain rate function +! versus equivalent strain. Is -1 if exponent law used. +! icftm Local copy number of slopes of creep strain rate function +! versus time. Is -1 if exponent law used. +! icetem Element number that needs to be checked for creep convergence +! or, if negative, the number of elements that need to +! be checked. In the latter case the elements to check +! are stored in ielcp. +! mcreep Maximum nuber of iterations for explicit creep. +! jcreep Counter of number of iterations for explicit creep +! procedure. jcreep must be .le. mcreep +! icpa(1-6) Pointer to constants in creep strain rate expression. +! icftmp Pointer to temperature dependent creep strain rate data. +! icfstr Pointer to equivalent stress dependent creep strain rate data. +! icfqcp Pointer to equivalent creep strain dependent creep strain +! rate data. +! icfcpm Pointer to equivalent creep strain rate dependent +! creep strain rate data. +! icrppr Permanent copy of icreep +! icrcha Control flag for creep convergence checking , if set to +! 1 then testing on absolute change in stress and creep +! strain, not relative testing. Input data. +! icpb(1-4) Pointer to storage of material id cross reference numbers. +! iicpmt creep law type ID +! =1 - power law +! =2 - solder +! =3 - steady-creep +! =4 - hyperbolic steady-creep +! iicpa Pointer to table IDs for constants in creep strain rate +! expression +! +! +! time_beg_lcase time at the beginning of the current load case +! time_beg_inc time at the beginning of the current increment +! fractol fraction of loadcase or increment time when we +! consider it to be finished +! time_beg_pst time corresponding to first increment to be +! read in from thermal post file for auto step +! +! timinc_old Time step of the previous increment +! +!*********************************************************************** +!!$omp threadprivate(/marc_creeps/) +!!$omp threadprivate(/marc_creeps2/) +!! From c58bbaa9add158bcad6bbb641d00964500c1d0f4 Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 5 May 2022 03:50:41 +0200 Subject: [PATCH 076/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-270-gc6030f30d --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index c5ac07ef6..8af106d0b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-266-g5776891b7 +3.0.0-alpha6-270-gc6030f30d From ca95282911261b546bfaa7cb41e750c9d1670667 Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 6 May 2022 12:01:24 +0200 Subject: [PATCH 077/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-285-g4d131ec7b --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 8af106d0b..1485aa8b8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-270-gc6030f30d +3.0.0-alpha6-285-g4d131ec7b From 58fab14c6c396a9778e7b03f402235e802a7e2fb Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 6 May 2022 12:34:32 +0200 Subject: [PATCH 078/142] PETSc 3.17.1 adjustments --- .github/workflows/Fortran.yml | 2 +- CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Fortran.yml b/.github/workflows/Fortran.yml index d93cdd27f..e9175bd53 100644 --- a/.github/workflows/Fortran.yml +++ b/.github/workflows/Fortran.yml @@ -2,7 +2,7 @@ name: Grid and Mesh Solver on: [push] env: - PETSC_VERSION: '3.17.0' + PETSC_VERSION: '3.17.1' HOMEBREW_NO_ANALYTICS: 'ON' # Make Homebrew installation a little quicker HOMEBREW_NO_AUTO_UPDATE: 'ON' HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: 'ON' diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b341dbbe..d24d9b8b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ message("\nBuilding ${CMAKE_PROJECT_NAME} ${DAMASK_VERSION}\n") add_definitions(-DPETSC) add_definitions(-DDAMASKVERSION="${DAMASK_VERSION}") add_definitions(-DCMAKE_SYSTEM="${CMAKE_SYSTEM}") -if(PETSC_VERSION VERSION_GREATER_EQUAL 3.17.0) +if(PETSC_VERSION VERSION_EQUAL 3.17.0) add_definitions("-DCHKERRQ=PetscCall") endif() From 7cf3bcb9c9976c331c0dd1fb657d187a5e71e666 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 7 May 2022 21:39:43 +0200 Subject: [PATCH 079/142] easier to read --- src/polynomials.f90 | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/polynomials.f90 b/src/polynomials.f90 index 155f54bf8..55aadf948 100644 --- a/src/polynomials.f90 +++ b/src/polynomials.f90 @@ -46,14 +46,14 @@ end subroutine polynomials_init !-------------------------------------------------------------------------------------------------- !> @brief Initialize a Polynomial from Coefficients. !-------------------------------------------------------------------------------------------------- -function polynomial_from_coef(coef,x_ref) result(p) +pure function polynomial_from_coef(coef,x_ref) result(p) - real(pReal), dimension(:), intent(in) :: coef + real(pReal), dimension(0:), intent(in) :: coef real(pReal), intent(in) :: x_ref type(tPolynomial) :: p - allocate(p%coef(0:size(coef)-1),source=coef) ! should be zero based + p%coef = coef p%x_ref = x_ref end function polynomial_from_coef @@ -77,9 +77,7 @@ function polynomial_from_dict(dict,y,x) result(p) if (dict%contains(y//','//x)) then x_ref = dict%get_asFloat(x//'_ref') coef = [coef,dict%get_asFloat(y//','//x)] - if (dict%contains(y//','//x//'^2')) then - coef = [coef,dict%get_asFloat(y//','//x//'^2')] - end if + if (dict%contains(y//','//x//'^2')) coef = [coef,dict%get_asFloat(y//','//x//'^2')] else x_ref = huge(0.0_pReal) ! Simplify debugging end if @@ -173,7 +171,6 @@ subroutine selfTest if (dNeq(p1%at(x_ref+x),p1%at(x_ref-x),1e-10_pReal)) error stop 'polynomials: eval(even)' if (dNeq(p1%der1_at(x_ref+x),-p1%der1_at(x_ref-x),1e-10_pReal)) error stop 'polynomials: eval_der(even)' - end subroutine selfTest end module polynomials From 45dc3d8f2beb744c9a426f55f4f3cdc3150bee94 Mon Sep 17 00:00:00 2001 From: Test User Date: Sat, 7 May 2022 22:20:56 +0200 Subject: [PATCH 080/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-288-g2792153ca --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 1485aa8b8..ff467c7e1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-285-g4d131ec7b +3.0.0-alpha6-288-g2792153ca From 70b9943920d17043e9cbd27eab7d3c2a5834b053 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 7 May 2022 22:47:13 +0200 Subject: [PATCH 081/142] allow to specify only quadratic term in Dict --- src/polynomials.f90 | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/polynomials.f90 b/src/polynomials.f90 index 55aadf948..6c11c4598 100644 --- a/src/polynomials.f90 +++ b/src/polynomials.f90 @@ -13,7 +13,7 @@ module polynomials type, public :: tPolynomial real(pReal), dimension(:), allocatable :: coef - real(pReal) :: x_ref + real(pReal) :: x_ref = huge(0.0_pReal) contains procedure, public :: at => eval procedure, public :: der1_at => eval_der1 @@ -70,6 +70,7 @@ function polynomial_from_dict(dict,y,x) result(p) real(pReal), dimension(:), allocatable :: coef real(pReal) :: x_ref + integer :: i allocate(coef(1),source=dict%get_asFloat(y)) @@ -77,9 +78,10 @@ function polynomial_from_dict(dict,y,x) result(p) if (dict%contains(y//','//x)) then x_ref = dict%get_asFloat(x//'_ref') coef = [coef,dict%get_asFloat(y//','//x)] - if (dict%contains(y//','//x//'^2')) coef = [coef,dict%get_asFloat(y//','//x//'^2')] - else - x_ref = huge(0.0_pReal) ! Simplify debugging + end if + if (dict%contains(y//','//x//'^2')) then + x_ref = dict%get_asFloat(x//'_ref') + coef = [coef,[(0.0_pReal,i=size(coef),2-1)],dict%get_asFloat(y//','//x//'^2')] end if p = Polynomial(coef,x_ref) @@ -130,15 +132,17 @@ end function eval_der1 !-------------------------------------------------------------------------------------------------- !> @brief Check correctness of polynomical functionality. !-------------------------------------------------------------------------------------------------- -subroutine selfTest +subroutine selfTest() type(tPolynomial) :: p1, p2 real(pReal), dimension(3) :: coef + integer :: i real(pReal) :: x_ref, x class(tNode), pointer :: dict - character(len=pStringLen), dimension(3) :: coef_s + character(len=pStringLen), dimension(size(coef)) :: coef_s character(len=pStringLen) :: x_ref_s, x_s, YAML_s + call random_number(coef) call random_number(x_ref) call random_number(x) @@ -150,9 +154,9 @@ subroutine selfTest p1 = polynomial(coef,x_ref) if (dNeq(p1%at(x_ref),coef(1))) error stop 'polynomial: @ref' - write(coef_s(1),*) coef(1) - write(coef_s(2),*) coef(2) - write(coef_s(3),*) coef(3) + do i = 1, size(coef_s) + write(coef_s(i),*) coef(i) + end do write(x_ref_s,*) x_ref write(x_s,*) x YAML_s = 'C: '//trim(adjustl(coef_s(1)))//IO_EOL//& @@ -163,11 +167,19 @@ subroutine selfTest p2 = polynomial(dict%asDict(),'C','T') if (dNeq(p1%at(x),p2%at(x),1.0e-10_pReal)) error stop 'polynomials: init' - p1 = polynomial(coef*[0.0_pReal,1.0_pReal,0.0_pReal],x_ref) + YAML_s = 'C: 0.0'//IO_EOL//& + 'C,T: '//trim(adjustl(coef_s(2)))//IO_EOL//& + 'T_ref: '//trim(adjustl(x_ref_s))//IO_EOL + Dict => YAML_parse_str(trim(YAML_s)) + p1 = polynomial(dict%asDict(),'C','T') if (dNeq(p1%at(x_ref+x),-p1%at(x_ref-x),1.0e-10_pReal)) error stop 'polynomials: eval(odd)' if (dNeq(p1%der1_at(x),p1%der1_at(5.0_pReal*x),1.0e-10_pReal)) error stop 'polynomials: eval_der(odd)' - p1 = polynomial(coef*[0.0_pReal,0.0_pReal,1.0_pReal],x_ref) + YAML_s = 'C: 0.0'//IO_EOL//& + 'C,T^2: '//trim(adjustl(coef_s(3)))//IO_EOL//& + 'T_ref: '//trim(adjustl(x_ref_s))//IO_EOL + Dict => YAML_parse_str(trim(YAML_s)) + p1 = polynomial(dict%asDict(),'C','T') if (dNeq(p1%at(x_ref+x),p1%at(x_ref-x),1e-10_pReal)) error stop 'polynomials: eval(even)' if (dNeq(p1%der1_at(x_ref+x),-p1%der1_at(x_ref-x),1e-10_pReal)) error stop 'polynomials: eval_der(even)' From 71e4fa222c6938033b03e16783c5f0e64bc4b314 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 7 May 2022 22:53:31 +0200 Subject: [PATCH 082/142] generic code for variable order --- src/polynomials.f90 | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/polynomials.f90 b/src/polynomials.f90 index 6c11c4598..9f30fe5ac 100644 --- a/src/polynomials.f90 +++ b/src/polynomials.f90 @@ -70,7 +70,8 @@ function polynomial_from_dict(dict,y,x) result(p) real(pReal), dimension(:), allocatable :: coef real(pReal) :: x_ref - integer :: i + integer :: i, o + character(len=1) :: o_s allocate(coef(1),source=dict%get_asFloat(y)) @@ -79,10 +80,13 @@ function polynomial_from_dict(dict,y,x) result(p) x_ref = dict%get_asFloat(x//'_ref') coef = [coef,dict%get_asFloat(y//','//x)] end if - if (dict%contains(y//','//x//'^2')) then - x_ref = dict%get_asFloat(x//'_ref') - coef = [coef,[(0.0_pReal,i=size(coef),2-1)],dict%get_asFloat(y//','//x//'^2')] - end if + do o = 2,2 + write(o_s,'(I0.0)') o + if (dict%contains(y//','//x//'^'//o_s)) then + x_ref = dict%get_asFloat(x//'_ref') + coef = [coef,[(0.0_pReal,i=size(coef),o-1)],dict%get_asFloat(y//','//x//'^'//o_s)] + end if + end do p = Polynomial(coef,x_ref) From 9605a5c2decec34d7f133831cbc612eabe9d30f9 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 7 May 2022 23:04:06 +0200 Subject: [PATCH 083/142] polynomial expansion up to order 4 --- src/polynomials.f90 | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/polynomials.f90 b/src/polynomials.f90 index 9f30fe5ac..321c24fb8 100644 --- a/src/polynomials.f90 +++ b/src/polynomials.f90 @@ -80,7 +80,7 @@ function polynomial_from_dict(dict,y,x) result(p) x_ref = dict%get_asFloat(x//'_ref') coef = [coef,dict%get_asFloat(y//','//x)] end if - do o = 2,2 + do o = 2,4 write(o_s,'(I0.0)') o if (dict%contains(y//','//x//'^'//o_s)) then x_ref = dict%get_asFloat(x//'_ref') @@ -139,7 +139,7 @@ end function eval_der1 subroutine selfTest() type(tPolynomial) :: p1, p2 - real(pReal), dimension(3) :: coef + real(pReal), dimension(5) :: coef integer :: i real(pReal) :: x_ref, x class(tNode), pointer :: dict @@ -166,6 +166,8 @@ subroutine selfTest() YAML_s = 'C: '//trim(adjustl(coef_s(1)))//IO_EOL//& 'C,T: '//trim(adjustl(coef_s(2)))//IO_EOL//& 'C,T^2: '//trim(adjustl(coef_s(3)))//IO_EOL//& + 'C,T^3: '//trim(adjustl(coef_s(4)))//IO_EOL//& + 'C,T^4: '//trim(adjustl(coef_s(5)))//IO_EOL//& 'T_ref: '//trim(adjustl(x_ref_s))//IO_EOL Dict => YAML_parse_str(trim(YAML_s)) p2 = polynomial(dict%asDict(),'C','T') @@ -176,16 +178,32 @@ subroutine selfTest() 'T_ref: '//trim(adjustl(x_ref_s))//IO_EOL Dict => YAML_parse_str(trim(YAML_s)) p1 = polynomial(dict%asDict(),'C','T') - if (dNeq(p1%at(x_ref+x),-p1%at(x_ref-x),1.0e-10_pReal)) error stop 'polynomials: eval(odd)' - if (dNeq(p1%der1_at(x),p1%der1_at(5.0_pReal*x),1.0e-10_pReal)) error stop 'polynomials: eval_der(odd)' + if (dNeq(p1%at(x_ref+x),-p1%at(x_ref-x),1.0e-10_pReal)) error stop 'polynomials: eval(linear)' + if (dNeq(p1%der1_at(x),p1%der1_at(5.0_pReal*x),1.0e-10_pReal)) error stop 'polynomials: eval_der(linear)' YAML_s = 'C: 0.0'//IO_EOL//& 'C,T^2: '//trim(adjustl(coef_s(3)))//IO_EOL//& 'T_ref: '//trim(adjustl(x_ref_s))//IO_EOL Dict => YAML_parse_str(trim(YAML_s)) p1 = polynomial(dict%asDict(),'C','T') - if (dNeq(p1%at(x_ref+x),p1%at(x_ref-x),1e-10_pReal)) error stop 'polynomials: eval(even)' - if (dNeq(p1%der1_at(x_ref+x),-p1%der1_at(x_ref-x),1e-10_pReal)) error stop 'polynomials: eval_der(even)' + if (dNeq(p1%at(x_ref+x),p1%at(x_ref-x),1e-10_pReal)) error stop 'polynomials: eval(quadratic)' + if (dNeq(p1%der1_at(x_ref+x),-p1%der1_at(x_ref-x),1e-10_pReal)) error stop 'polynomials: eval_der(quadratic)' + + YAML_s = 'Y: 0.0'//IO_EOL//& + 'Y,X^3: '//trim(adjustl(coef_s(2)))//IO_EOL//& + 'X_ref: '//trim(adjustl(x_ref_s))//IO_EOL + Dict => YAML_parse_str(trim(YAML_s)) + p1 = polynomial(dict%asDict(),'Y','X') + if (dNeq(p1%at(x_ref+x),-p1%at(x_ref-x),1.0e-10_pReal)) error stop 'polynomials: eval(cubic)' + + YAML_s = 'Y: 0.0'//IO_EOL//& + 'Y,X^4: '//trim(adjustl(coef_s(2)))//IO_EOL//& + 'X_ref: '//trim(adjustl(x_ref_s))//IO_EOL + Dict => YAML_parse_str(trim(YAML_s)) + p1 = polynomial(dict%asDict(),'Y','X') + if (dNeq(p1%at(x_ref+x),p1%at(x_ref-x),1.0e-10_pReal)) error stop 'polynomials: eval(quartic)' + + end subroutine selfTest From ec184cb8feb135a95838bf5ea9c070c8ab23c2c6 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 8 May 2022 08:30:58 +0200 Subject: [PATCH 084/142] need to relax absolute tolerance absolute values for quartic become quite high --- src/polynomials.f90 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/polynomials.f90 b/src/polynomials.f90 index 321c24fb8..1a023eba1 100644 --- a/src/polynomials.f90 +++ b/src/polynomials.f90 @@ -190,19 +190,18 @@ subroutine selfTest() if (dNeq(p1%der1_at(x_ref+x),-p1%der1_at(x_ref-x),1e-10_pReal)) error stop 'polynomials: eval_der(quadratic)' YAML_s = 'Y: 0.0'//IO_EOL//& - 'Y,X^3: '//trim(adjustl(coef_s(2)))//IO_EOL//& + 'Y,X^3: '//trim(adjustl(coef_s(1)))//IO_EOL//& 'X_ref: '//trim(adjustl(x_ref_s))//IO_EOL Dict => YAML_parse_str(trim(YAML_s)) p1 = polynomial(dict%asDict(),'Y','X') - if (dNeq(p1%at(x_ref+x),-p1%at(x_ref-x),1.0e-10_pReal)) error stop 'polynomials: eval(cubic)' + if (dNeq(p1%at(x_ref+x),-p1%at(x_ref-x),1.0e-8_pReal)) error stop 'polynomials: eval(cubic)' YAML_s = 'Y: 0.0'//IO_EOL//& - 'Y,X^4: '//trim(adjustl(coef_s(2)))//IO_EOL//& + 'Y,X^4: '//trim(adjustl(coef_s(1)))//IO_EOL//& 'X_ref: '//trim(adjustl(x_ref_s))//IO_EOL Dict => YAML_parse_str(trim(YAML_s)) p1 = polynomial(dict%asDict(),'Y','X') - if (dNeq(p1%at(x_ref+x),p1%at(x_ref-x),1.0e-10_pReal)) error stop 'polynomials: eval(quartic)' - + if (dNeq(p1%at(x_ref+x),p1%at(x_ref-x),1.0e-6_pReal)) error stop 'polynomials: eval(quartic)' end subroutine selfTest From 2741fbd97768e5a914f33f354087d0bd57acabce Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 8 May 2022 09:27:21 +0200 Subject: [PATCH 085/142] whitespace adjustments - 1 empty line between dummy arguments/return value - 2 empty lines between variable definition and actual code --- src/math.f90 | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/src/math.f90 b/src/math.f90 index 75b9ddea2..94ad2c48d 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -127,8 +127,10 @@ pure recursive subroutine math_sort(a, istart, iend, sortDim) integer, dimension(:,:), intent(inout) :: a integer, intent(in),optional :: istart,iend, sortDim + integer :: ipivot,s,e,d + if (present(istart)) then s = istart else @@ -164,9 +166,11 @@ pure recursive subroutine math_sort(a, istart, iend, sortDim) integer, dimension(:,:), intent(inout) :: a integer, intent(out) :: p ! Pivot element integer, intent(in) :: istart,iend,sort - integer, dimension(size(a,1)) :: tmp + + integer, dimension(size(a,1)) :: tmp integer :: i,j + do ! find the first element on the right side less than or equal to the pivot point do j = iend, istart, -1 @@ -204,8 +208,10 @@ pure function math_expand(what,how) real(pReal), dimension(:), intent(in) :: what integer, dimension(:), intent(in) :: how real(pReal), dimension(sum(how)) :: math_expand + integer :: i + if (sum(how) == 0) return do i = 1, size(how) @@ -221,9 +227,11 @@ end function math_expand pure function math_range(N) integer, intent(in) :: N !< length of range - integer :: i integer, dimension(N) :: math_range + integer :: i + + math_range = [(i,i=1,N)] end function math_range @@ -235,9 +243,11 @@ end function math_range pure function math_eye(d) integer, intent(in) :: d !< tensor dimension - integer :: i real(pReal), dimension(d,d) :: math_eye + integer :: i + + math_eye = 0.0_pReal do i=1,d math_eye(i,i) = 1.0_pReal @@ -302,6 +312,7 @@ real(pReal) pure function math_delta(i,j) integer, intent (in) :: i,j + math_delta = merge(0.0_pReal, 1.0_pReal, i /= j) end function math_delta @@ -315,6 +326,7 @@ pure function math_cross(A,B) real(pReal), dimension(3), intent(in) :: A,B real(pReal), dimension(3) :: math_cross + math_cross = [ A(2)*B(3) -A(3)*B(2), & A(3)*B(1) -A(1)*B(3), & A(1)*B(2) -A(2)*B(1) ] @@ -329,6 +341,7 @@ pure function math_outer(A,B) real(pReal), dimension(:), intent(in) :: A,B real(pReal), dimension(size(A,1),size(B,1)) :: math_outer + integer :: i,j @@ -351,6 +364,7 @@ real(pReal) pure function math_inner(A,B) real(pReal), dimension(:), intent(in) :: A real(pReal), dimension(size(A,1)), intent(in) :: B + math_inner = sum(A*B) end function math_inner @@ -363,6 +377,7 @@ real(pReal) pure function math_tensordot(A,B) real(pReal), dimension(3,3), intent(in) :: A,B + math_tensordot = sum(A*B) end function math_tensordot @@ -376,6 +391,7 @@ pure function math_mul3333xx33(A,B) real(pReal), dimension(3,3,3,3), intent(in) :: A real(pReal), dimension(3,3), intent(in) :: B real(pReal), dimension(3,3) :: math_mul3333xx33 + integer :: i,j @@ -395,11 +411,12 @@ end function math_mul3333xx33 !-------------------------------------------------------------------------------------------------- pure function math_mul3333xx3333(A,B) - integer :: i,j,k,l real(pReal), dimension(3,3,3,3), intent(in) :: A real(pReal), dimension(3,3,3,3), intent(in) :: B real(pReal), dimension(3,3,3,3) :: math_mul3333xx3333 + integer :: i,j,k,l + #ifndef __INTEL_COMPILER do concurrent(i=1:3, j=1:3, k=1:3, l=1:3) @@ -424,6 +441,7 @@ pure function math_exp33(A,n) real(pReal) :: invFac integer :: n_,i + if (present(n)) then n_ = n else @@ -456,6 +474,7 @@ pure function math_inv33(A) real(pReal) :: DetA logical :: error + call math_invert33(math_inv33,DetA,error,A) if (error) math_inv33 = 0.0_pReal @@ -474,6 +493,7 @@ pure subroutine math_invert33(InvA, DetA, error, A) logical, intent(out) :: error real(pReal), dimension(3,3), intent(in) :: A + InvA(1,1) = A(2,2) * A(3,3) - A(2,3) * A(3,2) InvA(2,1) = -A(2,1) * A(3,3) + A(2,3) * A(3,1) InvA(3,1) = A(2,1) * A(3,2) - A(2,2) * A(3,1) @@ -504,7 +524,7 @@ end subroutine math_invert33 !-------------------------------------------------------------------------------------------------- pure function math_invSym3333(A) - real(pReal),dimension(3,3,3,3) :: math_invSym3333 + real(pReal),dimension(3,3,3,3) :: math_invSym3333 real(pReal),dimension(3,3,3,3),intent(in) :: A @@ -513,6 +533,7 @@ pure function math_invSym3333(A) real(pReal), dimension(6*6) :: work integer :: ierr_i, ierr_f + temp66 = math_sym3333to66(A) call dgetrf(6,6,temp66,6,ipiv6,ierr_i) call dgetri(6,temp66,6,ipiv6,work,size(work,1),ierr_f) @@ -538,6 +559,7 @@ pure subroutine math_invert(InvA, error, A) real(pReal), dimension(size(A,1)**2) :: work integer :: ierr + invA = A call dgetrf(size(A,1),size(A,1),invA,size(A,1),ipiv,ierr) error = (ierr /= 0) @@ -555,6 +577,7 @@ pure function math_symmetric33(m) real(pReal), dimension(3,3) :: math_symmetric33 real(pReal), dimension(3,3), intent(in) :: m + math_symmetric33 = 0.5_pReal * (m + transpose(m)) end function math_symmetric33 @@ -568,6 +591,7 @@ pure function math_skew33(m) real(pReal), dimension(3,3) :: math_skew33 real(pReal), dimension(3,3), intent(in) :: m + math_skew33 = m - math_symmetric33(m) end function math_skew33 @@ -581,6 +605,7 @@ pure function math_spherical33(m) real(pReal), dimension(3,3) :: math_spherical33 real(pReal), dimension(3,3), intent(in) :: m + math_spherical33 = math_I3 * math_trace33(m)/3.0_pReal end function math_spherical33 @@ -594,6 +619,7 @@ pure function math_deviatoric33(m) real(pReal), dimension(3,3) :: math_deviatoric33 real(pReal), dimension(3,3), intent(in) :: m + math_deviatoric33 = m - math_spherical33(m) end function math_deviatoric33 @@ -606,6 +632,7 @@ real(pReal) pure function math_trace33(m) real(pReal), dimension(3,3), intent(in) :: m + math_trace33 = m(1,1) + m(2,2) + m(3,3) end function math_trace33 @@ -618,6 +645,7 @@ real(pReal) pure function math_det33(m) real(pReal), dimension(3,3), intent(in) :: m + math_det33 = m(1,1)* (m(2,2)*m(3,3)-m(2,3)*m(3,2)) & - m(1,2)* (m(2,1)*m(3,3)-m(2,3)*m(3,1)) & + m(1,3)* (m(2,1)*m(3,2)-m(2,2)*m(3,1)) @@ -632,6 +660,7 @@ real(pReal) pure function math_detSym33(m) real(pReal), dimension(3,3), intent(in) :: m + math_detSym33 = -(m(1,1)*m(2,3)**2 + m(2,2)*m(1,3)**2 + m(3,3)*m(1,2)**2) & + m(1,1)*m(2,2)*m(3,3) + 2.0_pReal * m(1,2)*m(1,3)*m(2,3) @@ -761,6 +790,7 @@ pure function math_99to3333(m99) integer :: i,j + #ifndef __INTEL_COMPILER do concurrent(i=1:9, j=1:9) math_99to3333(MAPPLAIN(1,i),MAPPLAIN(2,i),MAPPLAIN(1,j),MAPPLAIN(2,j)) = m99(i,j) @@ -1012,6 +1042,7 @@ pure subroutine math_eigh33(w,v,m) real(pReal) :: T, U, norm, threshold logical :: error + w = math_eigvalsh33(m) v(1:3,2) = [ m(1, 2) * m(2, 3) - m(1, 3) * m(2, 2), & @@ -1066,6 +1097,7 @@ pure function math_rotationalPart(F) result(R) I_F ! first two invariants of F real(pReal) :: x,Phi + C = matmul(transpose(F),F) I_C = math_invariantsSym33(C) I_F = [math_trace33(F), 0.5*(math_trace33(F)**2 - math_trace33(matmul(F,F)))] @@ -1105,6 +1137,7 @@ pure function math_eigvalsh(m) integer :: ierr real(pReal), dimension(size(m,1)**2) :: work + m_= m ! copy matrix to input (will be destroyed) call dsyev('N','U',size(m,1),m_,size(m,1),math_eigvalsh,work,size(work,1),ierr) if (ierr /= 0) math_eigvalsh = IEEE_value(1.0_pReal,IEEE_quiet_NaN) @@ -1126,6 +1159,7 @@ pure function math_eigvalsh33(m) real(pReal) :: P, Q, rho, phi real(pReal), parameter :: TOL=1.e-14_pReal + I = math_invariantsSym33(m) ! invariants are coefficients in characteristic polynomial apart for the sign of c0 and c2 in http://arxiv.org/abs/physics/0610206 P = I(2)-I(1)**2/3.0_pReal ! different from http://arxiv.org/abs/physics/0610206 (this formulation was in DAMASK) @@ -1157,6 +1191,7 @@ pure function math_invariantsSym33(m) real(pReal), dimension(3,3), intent(in) :: m real(pReal), dimension(3) :: math_invariantsSym33 + math_invariantsSym33(1) = math_trace33(m) math_invariantsSym33(2) = m(1,1)*m(2,2) + m(1,1)*m(3,3) + m(2,2)*m(3,3) & -(m(1,2)**2 + m(1,3)**2 + m(2,3)**2) From 7d18ed307d9bae62132b2c5662862f11bdb698fe Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 8 May 2022 09:30:26 +0200 Subject: [PATCH 086/142] hickup in documentation --- src/lattice.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lattice.f90 b/src/lattice.f90 index 79e3c1615..afff2a309 100644 --- a/src/lattice.f90 +++ b/src/lattice.f90 @@ -1966,8 +1966,8 @@ end function buildCoordinateSystem !-------------------------------------------------------------------------------------------------- !> @brief Helper function to define transformation systems ! Needed to calculate Schmid matrix and rotated stiffness matrices. -! @details: use c/a for cF -> cI transformation -! use a_cX for cF -> hP transformation +! @details: use c/a for cF -> hP transformation +! use a_cX for cF -> cI transformation !-------------------------------------------------------------------------------------------------- subroutine buildTransformationSystem(Q,S,Ntrans,cOverA,a_cF,a_cI) From 3854547ce80c58272a85c729e8c94472642e60cd Mon Sep 17 00:00:00 2001 From: Test User Date: Sun, 8 May 2022 12:40:58 +0200 Subject: [PATCH 087/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-291-g7d18ed307 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index ff467c7e1..346a2ab96 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-288-g2792153ca +3.0.0-alpha6-291-g7d18ed307 From 72c29f744c3071001df8dd44815bb817574dc5b0 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 8 May 2022 12:12:42 +0200 Subject: [PATCH 088/142] better tests --- src/polynomials.f90 | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/polynomials.f90 b/src/polynomials.f90 index 1a023eba1..2426ba48d 100644 --- a/src/polynomials.f90 +++ b/src/polynomials.f90 @@ -141,7 +141,7 @@ subroutine selfTest() type(tPolynomial) :: p1, p2 real(pReal), dimension(5) :: coef integer :: i - real(pReal) :: x_ref, x + real(pReal) :: x_ref, x, y class(tNode), pointer :: dict character(len=pStringLen), dimension(size(coef)) :: coef_s character(len=pStringLen) :: x_ref_s, x_s, YAML_s @@ -155,6 +155,9 @@ subroutine selfTest() x_ref = x_ref*10_pReal -0.5_pReal x = x*10_pReal -0.5_pReal + p1 = polynomial([coef(1)],x_ref) + if (dNeq(p1%at(x),coef(1))) error stop 'polynomial: eval(constant)' + p1 = polynomial(coef,x_ref) if (dNeq(p1%at(x_ref),coef(1))) error stop 'polynomial: @ref' @@ -172,6 +175,8 @@ subroutine selfTest() Dict => YAML_parse_str(trim(YAML_s)) p2 = polynomial(dict%asDict(),'C','T') if (dNeq(p1%at(x),p2%at(x),1.0e-10_pReal)) error stop 'polynomials: init' + y = coef(1)+coef(2)*(x-x_ref)+coef(3)*(x-x_ref)**2+coef(4)*(x-x_ref)**3+coef(5)*(x-x_ref)**4 + if (dNeq(p1%at(x),y,1.0e-7_pReal)) error stop 'polynomials: eval(full)' YAML_s = 'C: 0.0'//IO_EOL//& 'C,T: '//trim(adjustl(coef_s(2)))//IO_EOL//& @@ -189,15 +194,15 @@ subroutine selfTest() if (dNeq(p1%at(x_ref+x),p1%at(x_ref-x),1e-10_pReal)) error stop 'polynomials: eval(quadratic)' if (dNeq(p1%der1_at(x_ref+x),-p1%der1_at(x_ref-x),1e-10_pReal)) error stop 'polynomials: eval_der(quadratic)' - YAML_s = 'Y: 0.0'//IO_EOL//& - 'Y,X^3: '//trim(adjustl(coef_s(1)))//IO_EOL//& + YAML_s = 'Y: '//trim(adjustl(coef_s(1)))//IO_EOL//& + 'Y,X^3: '//trim(adjustl(coef_s(2)))//IO_EOL//& 'X_ref: '//trim(adjustl(x_ref_s))//IO_EOL Dict => YAML_parse_str(trim(YAML_s)) p1 = polynomial(dict%asDict(),'Y','X') - if (dNeq(p1%at(x_ref+x),-p1%at(x_ref-x),1.0e-8_pReal)) error stop 'polynomials: eval(cubic)' + if (dNeq(p1%at(x_ref+x)-coef(1),-(p1%at(x_ref-x)-coef(1)),1.0e-8_pReal)) error stop 'polynomials: eval(cubic)' - YAML_s = 'Y: 0.0'//IO_EOL//& - 'Y,X^4: '//trim(adjustl(coef_s(1)))//IO_EOL//& + YAML_s = 'Y: '//trim(adjustl(coef_s(1)))//IO_EOL//& + 'Y,X^4: '//trim(adjustl(coef_s(2)))//IO_EOL//& 'X_ref: '//trim(adjustl(x_ref_s))//IO_EOL Dict => YAML_parse_str(trim(YAML_s)) p1 = polynomial(dict%asDict(),'Y','X') From 240426402c95b1f9c5d13efd73e3e718d96afc87 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 8 May 2022 13:32:14 +0200 Subject: [PATCH 089/142] using (faster) Horner evaluation https://rosettacode.org/wiki/Horner%27s_rule_for_polynomial_evaluation --- src/polynomials.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/polynomials.f90 b/src/polynomials.f90 index 2426ba48d..d26aa300f 100644 --- a/src/polynomials.f90 +++ b/src/polynomials.f90 @@ -105,9 +105,9 @@ pure function eval(self,x) result(y) integer :: i - y = self%coef(0) - do i = 1, ubound(self%coef,1) - y = y + self%coef(i) * (x-self%x_ref)**i + y = 0.0_pReal + do i = ubound(self%coef,1), 0 , -1 + y = y*(x-self%x_ref) + self%coef(i) enddo end function eval From 8f9fbb30e5a0062160cbccd3f9d83d58bac9ed43 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 8 May 2022 15:02:57 +0200 Subject: [PATCH 090/142] use fused multiply-add where possible only possible for Intel compiler --- src/math.f90 | 28 +++++++++++++++++-------- src/phase_mechanical.f90 | 45 +++++++++++++++++++++++++++++++--------- src/polynomials.f90 | 8 +++++-- 3 files changed, 60 insertions(+), 21 deletions(-) diff --git a/src/math.f90 b/src/math.f90 index 94ad2c48d..135d2b6fd 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -82,7 +82,7 @@ contains !-------------------------------------------------------------------------------------------------- !> @brief initialization of random seed generator and internal checks !-------------------------------------------------------------------------------------------------- -subroutine math_init +subroutine math_init() real(pReal), dimension(4) :: randTest integer :: randSize @@ -1045,24 +1045,34 @@ pure subroutine math_eigh33(w,v,m) w = math_eigvalsh33(m) - v(1:3,2) = [ m(1, 2) * m(2, 3) - m(1, 3) * m(2, 2), & - m(1, 3) * m(1, 2) - m(2, 3) * m(1, 1), & - m(1, 2)**2] + v(1:3,2) = [ m(1,2) * m(2,3) - m(1,3) * m(2,2), & + m(1,3) * m(1,2) - m(2,3) * m(1,1), & + m(1,2)**2] T = maxval(abs(w)) U = max(T, T**2) threshold = sqrt(5.68e-14_pReal * U**2) - v(1:3,1) = [ v(1,2) + m(1, 3) * w(1), & - v(2,2) + m(2, 3) * w(1), & +#ifndef __INTEL_COMPILER + v(1:3,1) = [m(1,3)*w(1) + v(1,2), & + m(2,3)*w(1) + v(2,2), & +#else + v(1:3,1) = [IEEE_FMA(m(1,3),w(1),v(1,2)), & + IEEE_FMA(m(2,3),w(1),v(2,2)), & +#endif (m(1,1) - w(1)) * (m(2,2) - w(1)) - v(3,2)] norm = norm2(v(1:3, 1)) fallback1: if (norm < threshold) then call math_eigh(w,v,error,m) else fallback1 v(1:3,1) = v(1:3, 1) / norm - v(1:3,2) = [ v(1,2) + m(1, 3) * w(2), & - v(2,2) + m(2, 3) * w(2), & +#ifndef __INTEL_COMPILER + v(1:3,2) = [m(1,3)*w(2) + v(1,2), & + m(2,3)*w(2) + v(2,2), & +#else + v(1:3,2) = [IEEE_FMA(m(1,3),w(2),v(1,2)), & + IEEE_FMA(m(2,3),w(2),v(2,2)), & +#endif (m(1,1) - w(2)) * (m(2,2) - w(2)) - v(3,2)] norm = norm2(v(1:3, 2)) fallback2: if (norm < threshold) then @@ -1300,7 +1310,7 @@ end function math_clip !-------------------------------------------------------------------------------------------------- !> @brief Check correctness of some math functions. !-------------------------------------------------------------------------------------------------- -subroutine selfTest +subroutine selfTest() integer, dimension(2,4) :: & sort_in_ = reshape([+1,+5, +5,+6, -1,-1, +3,-2],[2,4]) diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index b13675e38..66b9ff090 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -680,8 +680,11 @@ function integrateStateEuler(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en) result if (any(IEEE_is_NaN(dotState))) return sizeDotState = plasticState(ph)%sizeDotState - plasticState(ph)%state(1:sizeDotState,en) = subState0 & - + dotState * Delta_t +#ifndef __INTEL_COMPILER + plasticState(ph)%state(1:sizeDotState,en) = subState0 + dotState*Delta_t +#else + plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,subState0) +#endif broken = plastic_deltaState(ph,en) if(broken) return @@ -720,8 +723,11 @@ function integrateStateAdaptiveEuler(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en sizeDotState = plasticState(ph)%sizeDotState r = - dotState * 0.5_pReal * Delta_t - plasticState(ph)%state(1:sizeDotState,en) = subState0 & - + dotState * Delta_t +#ifndef __INTEL_COMPILER + plasticState(ph)%state(1:sizeDotState,en) = subState0 + dotState*Delta_t +#else + plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,subState0) +#endif broken = plastic_deltaState(ph,en) if(broken) return @@ -842,12 +848,18 @@ function integrateStateRK(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en,A,B,C,DB) dotState = A(1,stage) * plastic_RKdotState(1:sizeDotState,1) do n = 2, stage - dotState = dotState & - + A(n,stage) * plastic_RKdotState(1:sizeDotState,n) +#ifndef __INTEL_COMPILER + dotState = dotState + A(n,stage)*plastic_RKdotState(1:sizeDotState,n) +#else + dotState = IEEE_FMA(A(n,stage),plastic_RKdotState(1:sizeDotState,n),dotState) +#endif enddo - plasticState(ph)%state(1:sizeDotState,en) = subState0 & - + dotState * Delta_t +#ifndef __INTEL_COMPILER + plasticState(ph)%state(1:sizeDotState,en) = subState0 + dotState*Delta_t +#else + plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,subState0) +#endif broken = integrateStress(F_0+(F-F_0)*Delta_t*C(stage),subFp0,subFi0,Delta_t*C(stage), ph,en) if(broken) exit @@ -861,8 +873,11 @@ function integrateStateRK(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en,A,B,C,DB) plastic_RKdotState(1:sizeDotState,size(B)) = dotState dotState = matmul(plastic_RKdotState,B) - plasticState(ph)%state(1:sizeDotState,en) = subState0 & - + dotState * Delta_t +#ifndef __INTEL_COMPILER + plasticState(ph)%state(1:sizeDotState,en) = subState0 + dotState*Delta_t +#else + plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,subState0) +#endif if(present(DB)) & broken = .not. converged(matmul(plastic_RKdotState(1:sizeDotState,1:size(DB)),DB) * Delta_t, & @@ -1146,12 +1161,18 @@ module function phase_mechanical_dPdF(Delta_t,co,ce) result(dPdF) else lhs_3333 = 0.0_pReal; rhs_3333 = 0.0_pReal do o=1,3; do p=1,3 +#ifndef __INTEL_COMPILER lhs_3333(1:3,1:3,o,p) = lhs_3333(1:3,1:3,o,p) & + matmul(invSubFi0,dLidFi(1:3,1:3,o,p)) * Delta_t lhs_3333(1:3,o,1:3,p) = lhs_3333(1:3,o,1:3,p) & + invFi*invFi(p,o) rhs_3333(1:3,1:3,o,p) = rhs_3333(1:3,1:3,o,p) & - matmul(invSubFi0,dLidS(1:3,1:3,o,p)) * Delta_t +#else + lhs_3333(1:3,1:3,o,p) = IEEE_FMA(matmul(invSubFi0,dLidFi(1:3,1:3,o,p)),Delta_t,lhs_3333(1:3,1:3,o,p)) + lhs_3333(1:3,o,1:3,p) = IEEE_FMA(invFi,invFi(p,o),lhs_3333(1:3,o,1:3,p)) + rhs_3333(1:3,1:3,o,p) = IEEE_FMA(matmul(invSubFi0,dLidS(1:3,1:3,o,p)),-Delta_t,rhs_3333(1:3,1:3,o,p)) +#endif enddo; enddo call math_invert(temp_99,error,math_3333to99(lhs_3333)) if (error) then @@ -1180,8 +1201,12 @@ module function phase_mechanical_dPdF(Delta_t,co,ce) result(dPdF) temp_3333(1:3,1:3,p,o) = matmul(matmul(temp_33_2,dLpdS(1:3,1:3,p,o)), invFi) & + matmul(temp_33_3,dLidS(1:3,1:3,p,o)) enddo; enddo +#ifndef __INTEL_COMPILER lhs_3333 = math_mul3333xx3333(dSdFe,temp_3333) * Delta_t & + math_mul3333xx3333(dSdFi,dFidS) +#else + lhs_3333 = IEEE_FMA(math_mul3333xx3333(dSdFe,temp_3333),Delta_t,math_mul3333xx3333(dSdFi,dFidS)) +#endif call math_invert(temp_99,error,math_eye(9)+math_3333to99(lhs_3333)) if (error) then diff --git a/src/polynomials.f90 b/src/polynomials.f90 index d26aa300f..9b7386ec7 100644 --- a/src/polynomials.f90 +++ b/src/polynomials.f90 @@ -106,8 +106,12 @@ pure function eval(self,x) result(y) y = 0.0_pReal - do i = ubound(self%coef,1), 0 , -1 - y = y*(x-self%x_ref) + self%coef(i) + do i = ubound(self%coef,1), 0, -1 +#ifndef __INTEL_COMPILER + y = y*(x-self%x_ref) +self%coef(i) +#else + y = IEEE_FMA(y,x-self%x_ref,self%coef(i)) +#endif enddo end function eval From b2052cb3c7549ef4d558718c072b50727465ab86 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 8 May 2022 16:41:19 +0200 Subject: [PATCH 091/142] less strict tolerances values can be in the order of 1e5, so 1e-6 precision is not too bad --- src/polynomials.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/polynomials.f90 b/src/polynomials.f90 index 9b7386ec7..ae7d1709c 100644 --- a/src/polynomials.f90 +++ b/src/polynomials.f90 @@ -178,9 +178,9 @@ subroutine selfTest() 'T_ref: '//trim(adjustl(x_ref_s))//IO_EOL Dict => YAML_parse_str(trim(YAML_s)) p2 = polynomial(dict%asDict(),'C','T') - if (dNeq(p1%at(x),p2%at(x),1.0e-10_pReal)) error stop 'polynomials: init' + if (dNeq(p1%at(x),p2%at(x),1.0e-6_pReal)) error stop 'polynomials: init' y = coef(1)+coef(2)*(x-x_ref)+coef(3)*(x-x_ref)**2+coef(4)*(x-x_ref)**3+coef(5)*(x-x_ref)**4 - if (dNeq(p1%at(x),y,1.0e-7_pReal)) error stop 'polynomials: eval(full)' + if (dNeq(p1%at(x),y,1.0e-6_pReal)) error stop 'polynomials: eval(full)' YAML_s = 'C: 0.0'//IO_EOL//& 'C,T: '//trim(adjustl(coef_s(2)))//IO_EOL//& @@ -203,7 +203,7 @@ subroutine selfTest() 'X_ref: '//trim(adjustl(x_ref_s))//IO_EOL Dict => YAML_parse_str(trim(YAML_s)) p1 = polynomial(dict%asDict(),'Y','X') - if (dNeq(p1%at(x_ref+x)-coef(1),-(p1%at(x_ref-x)-coef(1)),1.0e-8_pReal)) error stop 'polynomials: eval(cubic)' + if (dNeq(p1%at(x_ref+x)-coef(1),-(p1%at(x_ref-x)-coef(1)),1.0e-8_pReal)) error stop 'polynomials: eval(cubic)' YAML_s = 'Y: '//trim(adjustl(coef_s(1)))//IO_EOL//& 'Y,X^4: '//trim(adjustl(coef_s(2)))//IO_EOL//& From d713026f7e31e060131c6c50733f9bcd0b7442c6 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 8 May 2022 16:49:30 +0200 Subject: [PATCH 092/142] fast evaluation for (most common) case of constant --- src/polynomials.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/polynomials.f90 b/src/polynomials.f90 index ae7d1709c..ffd70b61c 100644 --- a/src/polynomials.f90 +++ b/src/polynomials.f90 @@ -105,8 +105,8 @@ pure function eval(self,x) result(y) integer :: i - y = 0.0_pReal - do i = ubound(self%coef,1), 0, -1 + y = self%coef(ubound(self%coef,1)) + do i = ubound(self%coef,1)-1, 0, -1 #ifndef __INTEL_COMPILER y = y*(x-self%x_ref) +self%coef(i) #else From 10d8a63cb656aed2a529abd2db63019f235941e2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 8 May 2022 17:18:15 +0200 Subject: [PATCH 093/142] not used and current code is not good (not using Horner scheme) --- src/polynomials.f90 | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/polynomials.f90 b/src/polynomials.f90 index ffd70b61c..61f20e796 100644 --- a/src/polynomials.f90 +++ b/src/polynomials.f90 @@ -16,7 +16,6 @@ module polynomials real(pReal) :: x_ref = huge(0.0_pReal) contains procedure, public :: at => eval - procedure, public :: der1_at => eval_der1 end type tPolynomial interface polynomial @@ -117,26 +116,6 @@ pure function eval(self,x) result(y) end function eval -!-------------------------------------------------------------------------------------------------- -!> @brief Evaluate a first derivative of Polynomial. -!-------------------------------------------------------------------------------------------------- -pure function eval_der1(self,x) result(y) - - class(tPolynomial), intent(in) :: self - real(pReal), intent(in) :: x - real(pReal) :: y - - integer :: i - - - y = 0.0_pReal - do i = 1, ubound(self%coef,1) - y = y + real(i,pReal)*self%coef(i) * (x-self%x_ref)**(i-1) - enddo - -end function eval_der1 - - !-------------------------------------------------------------------------------------------------- !> @brief Check correctness of polynomical functionality. !-------------------------------------------------------------------------------------------------- @@ -188,7 +167,6 @@ subroutine selfTest() Dict => YAML_parse_str(trim(YAML_s)) p1 = polynomial(dict%asDict(),'C','T') if (dNeq(p1%at(x_ref+x),-p1%at(x_ref-x),1.0e-10_pReal)) error stop 'polynomials: eval(linear)' - if (dNeq(p1%der1_at(x),p1%der1_at(5.0_pReal*x),1.0e-10_pReal)) error stop 'polynomials: eval_der(linear)' YAML_s = 'C: 0.0'//IO_EOL//& 'C,T^2: '//trim(adjustl(coef_s(3)))//IO_EOL//& @@ -196,7 +174,6 @@ subroutine selfTest() Dict => YAML_parse_str(trim(YAML_s)) p1 = polynomial(dict%asDict(),'C','T') if (dNeq(p1%at(x_ref+x),p1%at(x_ref-x),1e-10_pReal)) error stop 'polynomials: eval(quadratic)' - if (dNeq(p1%der1_at(x_ref+x),-p1%der1_at(x_ref-x),1e-10_pReal)) error stop 'polynomials: eval_der(quadratic)' YAML_s = 'Y: '//trim(adjustl(coef_s(1)))//IO_EOL//& 'Y,X^3: '//trim(adjustl(coef_s(2)))//IO_EOL//& From b376b10b7a876b0cb9c7fd2de7d4093a45b21a77 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 8 May 2022 17:47:20 +0200 Subject: [PATCH 094/142] classic Intel gives FPE --- src/math.f90 | 4 ++-- src/phase_mechanical.f90 | 14 +++++++------- src/polynomials.f90 | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/math.f90 b/src/math.f90 index 135d2b6fd..25c90ccf4 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -1053,7 +1053,7 @@ pure subroutine math_eigh33(w,v,m) U = max(T, T**2) threshold = sqrt(5.68e-14_pReal * U**2) -#ifndef __INTEL_COMPILER +#ifndef __INTEL_LLVM_COMPILER v(1:3,1) = [m(1,3)*w(1) + v(1,2), & m(2,3)*w(1) + v(2,2), & #else @@ -1066,7 +1066,7 @@ pure subroutine math_eigh33(w,v,m) call math_eigh(w,v,error,m) else fallback1 v(1:3,1) = v(1:3, 1) / norm -#ifndef __INTEL_COMPILER +#ifndef __INTEL_LLVM_COMPILER v(1:3,2) = [m(1,3)*w(2) + v(1,2), & m(2,3)*w(2) + v(2,2), & #else diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index 66b9ff090..fc9e40e02 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -680,7 +680,7 @@ function integrateStateEuler(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en) result if (any(IEEE_is_NaN(dotState))) return sizeDotState = plasticState(ph)%sizeDotState -#ifndef __INTEL_COMPILER +#ifndef __INTEL_LLVM_COMPILER plasticState(ph)%state(1:sizeDotState,en) = subState0 + dotState*Delta_t #else plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,subState0) @@ -723,7 +723,7 @@ function integrateStateAdaptiveEuler(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en sizeDotState = plasticState(ph)%sizeDotState r = - dotState * 0.5_pReal * Delta_t -#ifndef __INTEL_COMPILER +#ifndef __INTEL_LLVM_COMPILER plasticState(ph)%state(1:sizeDotState,en) = subState0 + dotState*Delta_t #else plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,subState0) @@ -848,14 +848,14 @@ function integrateStateRK(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en,A,B,C,DB) dotState = A(1,stage) * plastic_RKdotState(1:sizeDotState,1) do n = 2, stage -#ifndef __INTEL_COMPILER +#ifndef __INTEL_LLVM_COMPILER dotState = dotState + A(n,stage)*plastic_RKdotState(1:sizeDotState,n) #else dotState = IEEE_FMA(A(n,stage),plastic_RKdotState(1:sizeDotState,n),dotState) #endif enddo -#ifndef __INTEL_COMPILER +#ifndef __INTEL_LLVM_COMPILER plasticState(ph)%state(1:sizeDotState,en) = subState0 + dotState*Delta_t #else plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,subState0) @@ -873,7 +873,7 @@ function integrateStateRK(F_0,F,subFp0,subFi0,subState0,Delta_t,ph,en,A,B,C,DB) plastic_RKdotState(1:sizeDotState,size(B)) = dotState dotState = matmul(plastic_RKdotState,B) -#ifndef __INTEL_COMPILER +#ifndef __INTEL_LLVM_COMPILER plasticState(ph)%state(1:sizeDotState,en) = subState0 + dotState*Delta_t #else plasticState(ph)%state(1:sizeDotState,en) = IEEE_FMA(dotState,Delta_t,subState0) @@ -1161,7 +1161,7 @@ module function phase_mechanical_dPdF(Delta_t,co,ce) result(dPdF) else lhs_3333 = 0.0_pReal; rhs_3333 = 0.0_pReal do o=1,3; do p=1,3 -#ifndef __INTEL_COMPILER +#ifndef __INTEL_LLVM_COMPILER lhs_3333(1:3,1:3,o,p) = lhs_3333(1:3,1:3,o,p) & + matmul(invSubFi0,dLidFi(1:3,1:3,o,p)) * Delta_t lhs_3333(1:3,o,1:3,p) = lhs_3333(1:3,o,1:3,p) & @@ -1201,7 +1201,7 @@ module function phase_mechanical_dPdF(Delta_t,co,ce) result(dPdF) temp_3333(1:3,1:3,p,o) = matmul(matmul(temp_33_2,dLpdS(1:3,1:3,p,o)), invFi) & + matmul(temp_33_3,dLidS(1:3,1:3,p,o)) enddo; enddo -#ifndef __INTEL_COMPILER +#ifndef __INTEL_LLVM_COMPILER lhs_3333 = math_mul3333xx3333(dSdFe,temp_3333) * Delta_t & + math_mul3333xx3333(dSdFi,dFidS) #else diff --git a/src/polynomials.f90 b/src/polynomials.f90 index 61f20e796..46e338b19 100644 --- a/src/polynomials.f90 +++ b/src/polynomials.f90 @@ -106,7 +106,7 @@ pure function eval(self,x) result(y) y = self%coef(ubound(self%coef,1)) do i = ubound(self%coef,1)-1, 0, -1 -#ifndef __INTEL_COMPILER +#ifndef __INTEL_LLVM_COMPILER y = y*(x-self%x_ref) +self%coef(i) #else y = IEEE_FMA(y,x-self%x_ref,self%coef(i)) From 53796fce7a6ea194981bb9165b22df95b5724eb7 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 8 May 2022 19:57:25 +0200 Subject: [PATCH 095/142] trustworthy reference --- src/polynomials.f90 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/polynomials.f90 b/src/polynomials.f90 index 46e338b19..c883528ca 100644 --- a/src/polynomials.f90 +++ b/src/polynomials.f90 @@ -94,6 +94,7 @@ end function polynomial_from_dict !-------------------------------------------------------------------------------------------------- !> @brief Evaluate a Polynomial. +!> @details https://nvlpubs.nist.gov/nistpubs/jres/71b/jresv71bn1p11_a1b.pdf (eq. 1.2) !-------------------------------------------------------------------------------------------------- pure function eval(self,x) result(y) @@ -101,15 +102,15 @@ pure function eval(self,x) result(y) real(pReal), intent(in) :: x real(pReal) :: y - integer :: i + integer :: o y = self%coef(ubound(self%coef,1)) - do i = ubound(self%coef,1)-1, 0, -1 + do o = ubound(self%coef,1)-1, 0, -1 #ifndef __INTEL_LLVM_COMPILER - y = y*(x-self%x_ref) +self%coef(i) + y = y*(x-self%x_ref) +self%coef(o) #else - y = IEEE_FMA(y,x-self%x_ref,self%coef(i)) + y = IEEE_FMA(y,x-self%x_ref,self%coef(o)) #endif enddo From 268ff26232b527a38a420a34980be8297d64011c Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 8 May 2022 22:09:10 +0200 Subject: [PATCH 096/142] need powershell commands --- .github/workflows/Python.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/Python.yml b/.github/workflows/Python.yml index 9329fb6fc..15e04fb18 100644 --- a/.github/workflows/Python.yml +++ b/.github/workflows/Python.yml @@ -32,6 +32,13 @@ jobs: export VERSION=$(cat VERSION) echo ${VERSION%-*} > VERSION + - name: Strip git hash (Windows) + if: runner.os == 'Windows' + run: | + $VERSION = Get-Content VERSION -first 1 + $VERSION,$_ = $VERSION -Split '-g',2,"simplematch" + $VERSION | Out-File VERSION + - name: Install and run unit tests (Unix) if: runner.os != 'Windows' run: | From f27969caf9ab3013705921c8c89b6963f8f2ecaf Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 8 May 2022 23:22:03 +0200 Subject: [PATCH 097/142] documenting and testing --- python/damask/_rotation.py | 17 ++++++++++++++--- python/tests/test_Orientation.py | 7 +++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index a0baf1a0b..b24c864b3 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -1126,8 +1126,8 @@ class Rotation: Notes ----- - The default crystal direction (θ=0,φ=0) direction is [0 0 1], - the default sample direction (θ=0,φ=0) is z. + The crystal direction for (θ=0,φ=0) is [0 0 1], + the sample direction for (θ=0,φ=0) is z. Polar coordinates follow the ISO 80000-2:2019 convention typically used in physics. @@ -1137,7 +1137,18 @@ class Rotation: Examples -------- - tbd + Create an ideal α-fiber texture (<1 1 0> ǀǀ RD=x) consisting of + 200 orientations: + + >>> import damask + >>> import numpy as np + >>> alpha = damask.Rotation.from_fiber_component([np.pi/4.,0.],[np.pi/2.,0.],shape=200) + + Create an ideal γ-fiber texture (<1 1 1> ǀǀ ND=z) consisting of + 100 orientations: + + >>> import damask + >>> gamma = damask.Rotation.from_fiber_component([54.7,45.0],[0.,0.],shape=100,degrees=True) """ rng = np.random.default_rng(rng_seed) diff --git a/python/tests/test_Orientation.py b/python/tests/test_Orientation.py index 729967539..17da524d8 100644 --- a/python/tests/test_Orientation.py +++ b/python/tests/test_Orientation.py @@ -158,6 +158,13 @@ class TestOrientation: sigma=0.0,shape=None,rng_seed=0,lattice='cI').quaternion == r.quaternion) + @pytest.mark.parametrize('crystal,sample,direction,color',[([np.pi/4,0],[np.pi/2,0],[1,0,0],[0,1,0]), + ([np.arccos(3**(-.5)),np.pi/4,0],[0,0],[0,0,1],[0,0,1])]) + def test_fiber_IPF(self,crystal,sample,direction,color): + fiber = Orientation.from_fiber_component(crystal=crystal,sample=sample,family='cubic',shape=200) + print(np.allclose(fiber.IPF_color(direction),color)) + + @pytest.mark.parametrize('kwargs',[ dict(lattice='aP',a=1.0,b=1.1,c=1.2,alpha=np.pi/4.5,beta=np.pi/3.5,gamma=np.pi/2.5), dict(lattice='mP',a=1.0,b=1.1,c=1.2, beta=np.pi/3.5), From 0cfba2e6d8b875e3a4f8cd6fd6d1ee4ae70b81bd Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 9 May 2022 02:34:49 +0200 Subject: [PATCH 098/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-293-g268ff2623 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 346a2ab96..b8d1ebfe6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-291-g7d18ed307 +3.0.0-alpha6-293-g268ff2623 From 0b83a8ca10ac5ce2be5c9c255e7804fbc6d309fe Mon Sep 17 00:00:00 2001 From: Franz Roters Date: Mon, 9 May 2022 14:05:30 +0200 Subject: [PATCH 099/142] new Marc version --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e7cccb6bd..faaf66564 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,7 +47,7 @@ variables: PETSC_INTELLLVM: "Libraries/PETSc/3.16.3/oneAPI-2022.0.1-IntelMPI-2021.5.0" PETSC_INTEL: "Libraries/PETSc/3.16.5/Intel-2022.0.1-IntelMPI-2021.5.0" # ++++++++++++ MSC Marc +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - MSC: "FEM/MSC/2021.3.1" + MSC: "FEM/MSC/2022.1" IntelMarc: "Compiler/Intel/19.1.2 Libraries/IMKL/2020" HDF5Marc: "HDF5/1.12.1/Intel-19.1.2" From 675e9c911d120e7907fb94ad4bf000011627e7c3 Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 9 May 2022 20:16:57 +0200 Subject: [PATCH 100/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-312-g6e7372f30 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index b8d1ebfe6..9b4527e73 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-293-g268ff2623 +3.0.0-alpha6-312-g6e7372f30 From 087302a2a4a7c26f0af2543fa9773e3d7bb79ae6 Mon Sep 17 00:00:00 2001 From: Franz Roters Date: Tue, 10 May 2022 09:00:55 +0200 Subject: [PATCH 101/142] chnage Marc default version to 2022.1 --- python/damask/solver/_marc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/solver/_marc.py b/python/damask/solver/_marc.py index 3d006d27b..8b7f7acba 100644 --- a/python/damask/solver/_marc.py +++ b/python/damask/solver/_marc.py @@ -3,7 +3,7 @@ import shlex import re from pathlib import Path -_marc_version = '2021.3.1' +_marc_version = '2022.1' _marc_root = '/opt/msc' _damask_root = str(Path(__file__).parents[3]) From bdad6238114d7cfe82fdadc5c5a65f2fbc7c0f96 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 10 May 2022 20:23:53 +0200 Subject: [PATCH 102/142] correct name for test --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 3561f74a5..24b15b74b 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 3561f74a5852c32e2c3da4dc48090b517cfa8e90 +Subproject commit 24b15b74b16e0a58e0ab5a645825111deb259f98 From c9f344758acd8b64f6ff36d169ca8f55b7d36798 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 10 May 2022 15:25:45 -0400 Subject: [PATCH 103/142] use symmetry-aware Miller brackets in Result.add_pole --- python/damask/_result.py | 18 +++++++++++------- python/tests/test_Result.py | 17 ++++++++++------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index b5f08a87d..2eb4e585a 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -1025,17 +1025,21 @@ class Result: @staticmethod def _add_pole(q,uvw,hkl,with_symmetry): c = q['meta']['c/a'] if 'c/a' in q['meta'] else 1 + brackets = ['[]','()','〈〉','{}'][(uvw is None)*1+with_symmetry*2] + label = 'p^' + '{}{} {} {}{}'.format(brackets[0], + *(uvw if uvw else hkl), + brackets[-1],) pole = Orientation(q['data'],lattice=q['meta']['lattice'],a=1,c=c).to_pole(uvw=uvw,hkl=hkl,with_symmetry=with_symmetry) return { 'data': pole, - 'label': 'p^[{} {} {}]'.format(*uvw) if uvw else 'p^({} {} {})'.format(*hkl), + 'label': label, 'meta' : { - 'unit': '1', - 'description': 'lab frame vector along lattice ' \ - + ('direction' if uvw else 'plane') \ - + ('s' if with_symmetry else ''), - 'creator': 'add_pole' + 'unit': '1', + 'description': 'lab frame vector along lattice ' \ + + ('direction' if uvw else 'plane') \ + + ('s' if with_symmetry else ''), + 'creator': 'add_pole' } } def add_pole(self,q='O',*,uvw=None,hkl=None,with_symmetry=False): @@ -1047,7 +1051,7 @@ class Result: q : str Name of the dataset containing the crystallographic orientation as quaternions. Defaults to 'O'. - uvw|hkl : numpy.ndarray of shape (...,3) + uvw|hkl : numpy.ndarray of shape (3) Miller indices of crystallographic direction or plane normal. with_symmetry : bool, optional Calculate all N symmetrically equivalent vectors. diff --git a/python/tests/test_Result.py b/python/tests/test_Result.py index 9cc8f5643..559ff514f 100644 --- a/python/tests/test_Result.py +++ b/python/tests/test_Result.py @@ -24,8 +24,7 @@ def default(tmp_path,ref_path): """Small Result file in temp location for modification.""" fname = '12grains6x7x8_tensionY.hdf5' shutil.copy(ref_path/fname,tmp_path) - f = Result(tmp_path/fname) - return f.view(times=20.0) + return Result(tmp_path/fname).view(times=20.0) @pytest.fixture def single_phase(tmp_path,ref_path): @@ -226,15 +225,19 @@ class TestResult: assert np.allclose(in_memory,in_file) @pytest.mark.parametrize('options',[{'uvw':[1,0,0],'with_symmetry':False}, - {'hkl':[0,1,1],'with_symmetry':True}]) + {'uvw':[1,1,0],'with_symmetry':True}, + {'hkl':[0,1,1],'with_symmetry':True}, + {'hkl':[1,1,1],'with_symmetry':False}, + ]) def test_add_pole(self,default,options): default.add_pole(**options) rot = default.place('O') in_memory = Orientation(rot,lattice=rot.dtype.metadata['lattice']).to_pole(**options) - brackets = ['[[]','[]]'] if 'uvw' in options.keys() else ['(',')'] # escape fnmatch - label = '{}{} {} {}{}'.format(brackets[0],*(list(options.values())[0]),brackets[1]) - in_file = default.place(f'p^{label}') - print(in_file - in_memory) + brackets = [['[[]','[]]'],'()','〈〉','{}'][('hkl' in options)*1+(options['with_symmetry'])*2] # escape fnmatch + label = 'p^{}{} {} {}{}'.format(brackets[0], + *(list(options.values())[0]), + brackets[-1]) + in_file = default.place(label) assert np.allclose(in_memory,in_file) def test_add_rotation(self,default): From 75272163cd4e915a9ccc3933347d47509aac9076 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 10 May 2022 15:45:19 -0400 Subject: [PATCH 104/142] slight polish of help messages --- python/damask/_rotation.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index f138fbb8a..4a143585e 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -721,7 +721,7 @@ class Rotation: Parameters ---------- q : numpy.ndarray, shape (...,4) - Unit quaternion (q_0, q_1, q_2, q_3) in positive real hemisphere, i.e. ǀqǀ = 1, q_0 ≥ 0. + Unit quaternion (q_0, q_1, q_2, q_3) in positive real hemisphere, i.e. ǀqǀ = 1 and q_0 ≥ 0. accept_homomorph : bool, optional Allow homomorphic variants, i.e. q_0 < 0 (negative real hemisphere). Defaults to False. @@ -777,11 +777,11 @@ class Rotation: @staticmethod def from_axis_angle(axis_angle: np.ndarray, - degrees:bool = False, + degrees: bool = False, normalize: bool = False, P: Literal[1, -1] = -1) -> 'Rotation': """ - Initialize from Axis angle pair. + Initialize from axis–angle pair. Parameters ---------- @@ -818,12 +818,12 @@ class Rotation: orthonormal: bool = True, reciprocal: bool = False) -> 'Rotation': """ - Initialize from lattice basis vectors. + Initialize from basis vector triplet. Parameters ---------- basis : numpy.ndarray, shape (...,3,3) - Three three-dimensional lattice basis vectors. + Three three-dimensional basis vectors. orthonormal : bool, optional Basis is strictly orthonormal, i.e. is free of stretch components. Defaults to True. reciprocal : bool, optional @@ -857,7 +857,7 @@ class Rotation: Parameters ---------- R : numpy.ndarray, shape (...,3,3) - Rotation matrix with det(R) = 1, R.T ∙ R = I. + Rotation matrix with det(R) = 1 and R.T ∙ R = I. """ return Rotation.from_basis(R) @@ -866,14 +866,14 @@ class Rotation: def from_parallel(a: np.ndarray, b: np.ndarray ) -> 'Rotation': """ - Initialize from pairs of two orthogonal lattice basis vectors. + Initialize from pairs of two orthogonal basis vectors. Parameters ---------- a : numpy.ndarray, shape (...,2,3) - Two three-dimensional lattice vectors of first orthogonal basis. + Two three-dimensional vectors of first orthogonal basis. b : numpy.ndarray, shape (...,2,3) - Corresponding three-dimensional lattice vectors of second basis. + Corresponding three-dimensional vectors of second basis. """ a_ = np.array(a) @@ -896,7 +896,7 @@ class Rotation: normalize: bool = False, P: Literal[1, -1] = -1) -> 'Rotation': """ - Initialize from Rodrigues–Frank vector (angle separated from axis). + Initialize from Rodrigues–Frank vector (with angle separated from axis). Parameters ---------- From 302f020f6346e0ba4aae0304180021a89b180204 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 11 May 2022 07:02:20 +0200 Subject: [PATCH 105/142] looks better at least on Linux --- python/damask/_result.py | 2 +- python/tests/test_Result.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index 2eb4e585a..253881731 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -1025,7 +1025,7 @@ class Result: @staticmethod def _add_pole(q,uvw,hkl,with_symmetry): c = q['meta']['c/a'] if 'c/a' in q['meta'] else 1 - brackets = ['[]','()','〈〉','{}'][(uvw is None)*1+with_symmetry*2] + brackets = ['[]','()','⟨⟩','{}'][(uvw is None)*1+with_symmetry*2] label = 'p^' + '{}{} {} {}{}'.format(brackets[0], *(uvw if uvw else hkl), brackets[-1],) diff --git a/python/tests/test_Result.py b/python/tests/test_Result.py index 559ff514f..7e107494a 100644 --- a/python/tests/test_Result.py +++ b/python/tests/test_Result.py @@ -233,7 +233,7 @@ class TestResult: default.add_pole(**options) rot = default.place('O') in_memory = Orientation(rot,lattice=rot.dtype.metadata['lattice']).to_pole(**options) - brackets = [['[[]','[]]'],'()','〈〉','{}'][('hkl' in options)*1+(options['with_symmetry'])*2] # escape fnmatch + brackets = [['[[]','[]]'],'()','⟨⟩','{}'][('hkl' in options)*1+(options['with_symmetry'])*2] # escape fnmatch label = 'p^{}{} {} {}{}'.format(brackets[0], *(list(options.values())[0]), brackets[-1]) From b080e414ae73cbfadf198fb0e0fca829728bd7e4 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Wed, 11 May 2022 08:55:55 -0400 Subject: [PATCH 106/142] normalize to_pole output by default --- python/damask/_orientation.py | 11 +++++++++-- python/tests/test_Orientation.py | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/python/damask/_orientation.py b/python/damask/_orientation.py index 534a9548d..0c995110c 100644 --- a/python/damask/_orientation.py +++ b/python/damask/_orientation.py @@ -786,7 +786,8 @@ class Orientation(Rotation,Crystal): def to_pole(self, *, uvw: FloatSequence = None, hkl: FloatSequence = None, - with_symmetry: bool = False) -> np.ndarray: + with_symmetry: bool = False, + normalize: bool = True) -> np.ndarray: """ Calculate lab frame vector along lattice direction [uvw] or plane normal (hkl). @@ -795,9 +796,13 @@ class Orientation(Rotation,Crystal): uvw|hkl : numpy.ndarray, shape (...,3) Miller indices of crystallographic direction or plane normal. Shape of vector blends with shape of own rotation array. - For example, a rotation array, shape (3,2) and a vector array of shape (2,4) result in (3,2,4) outputs. + For example, a rotation array of shape (3,2) and a vector array of shape (2,4) result in (3,2,4) outputs. with_symmetry : bool, optional Calculate all N symmetrically equivalent vectors. + Defaults to False. + normalize : bool, optional + Normalize output vector. + Defaults to True. Returns ------- @@ -807,6 +812,8 @@ class Orientation(Rotation,Crystal): """ v = self.to_frame(uvw=uvw,hkl=hkl) blend = util.shapeblender(self.shape,v.shape[:-1]) + if normalize: + v /= np.linalg.norm(v,axis=-1,keepdims=len(v.shape)>1) if with_symmetry: sym_ops = self.symmetry_operations shape = v.shape[:-1]+sym_ops.shape diff --git a/python/tests/test_Orientation.py b/python/tests/test_Orientation.py index 729967539..6eedd3b77 100644 --- a/python/tests/test_Orientation.py +++ b/python/tests/test_Orientation.py @@ -173,8 +173,8 @@ class TestOrientation: o = Orientation.from_directions(uvw=a,hkl=c,**kwargs) x = o.to_pole(uvw=a) z = o.to_pole(hkl=c) - assert np.isclose(np.dot(x/np.linalg.norm(x),np.array([1,0,0])),1) \ - and np.isclose(np.dot(z/np.linalg.norm(z),np.array([0,0,1])),1) + assert np.isclose(np.dot(x,np.array([1,0,0])),1) \ + and np.isclose(np.dot(z,np.array([0,0,1])),1) @pytest.mark.parametrize('function',[Orientation.from_random, Orientation.from_quaternion, From 35aa8a9bc61148ca77cbc25efcbdd869e6cbaf7a Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Wed, 11 May 2022 09:19:48 -0400 Subject: [PATCH 107/142] combine table.add and .set --- python/damask/_table.py | 57 +++++++++++--------------------- python/tests/test_Grid.py | 2 +- python/tests/test_Orientation.py | 2 +- python/tests/test_Table.py | 4 +-- 4 files changed, 24 insertions(+), 41 deletions(-) diff --git a/python/damask/_table.py b/python/damask/_table.py index 841842fc0..f440b7302 100644 --- a/python/damask/_table.py +++ b/python/damask/_table.py @@ -363,14 +363,14 @@ class Table: data: np.ndarray, info: str = None) -> 'Table': """ - Set column data. + Add new or replace existing column data. Parameters ---------- label : str Column label. data : numpy.ndarray - Replacement data. + Column data. info : str, optional Human-readable information about the modified data. @@ -382,49 +382,32 @@ class Table: """ dup = self.copy() dup._add_comment(label, data.shape[1:], info) + if m := re.match(r'(.*)\[((\d+,)*(\d+))\]',label): key = m.group(1) - idx = np.ravel_multi_index(tuple(map(int,m.group(2).split(","))), - self.shapes[key]) - iloc = dup.data.columns.get_loc(key).tolist().index(True) + idx - dup.data.iloc[:,iloc] = data else: - dup.data[label] = data.reshape(dup.data[label].shape) - return dup + key = label + if key in dup.shapes: - def add(self, - label: str, - data: np.ndarray, - info: str = None) -> 'Table': - """ - Add column data. + if m: + idx = np.ravel_multi_index(tuple(map(int,m.group(2).split(","))), + self.shapes[key]) + iloc = dup.data.columns.get_loc(key).tolist().index(True) + idx + dup.data.iloc[:,iloc] = data + else: + dup.data[label] = data.reshape(dup.data[label].shape) - Parameters - ---------- - label : str - Column label. - data : numpy.ndarray - New data. - info : str, optional - Human-readable information about the new data. + else: - Returns - ------- - updated : damask.Table - Updated table. + dup.shapes[label] = data.shape[1:] if len(data.shape) > 1 else (1,) + size = np.prod(data.shape[1:],dtype=int) + new = pd.DataFrame(data=data.reshape(-1,size), + columns=[label]*size, + ) + new.index = dup.data.index + dup.data = pd.concat([dup.data,new],axis=1) - """ - dup = self.copy() - dup._add_comment(label,data.shape[1:],info) - - dup.shapes[label] = data.shape[1:] if len(data.shape) > 1 else (1,) - size = np.prod(data.shape[1:],dtype=int) - new = pd.DataFrame(data=data.reshape(-1,size), - columns=[label]*size, - ) - new.index = dup.data.index - dup.data = pd.concat([dup.data,new],axis=1) return dup diff --git a/python/tests/test_Grid.py b/python/tests/test_Grid.py index 9fb2f310c..05344d28d 100644 --- a/python/tests/test_Grid.py +++ b/python/tests/test_Grid.py @@ -441,7 +441,7 @@ class TestGrid: z = np.ones(cells.prod()) z[cells[:2].prod()*int(cells[2]/2):] = 0 t = Table({'coords':3,'z':1},np.column_stack((coords,z))) - t = t.add('indicator',t.get('coords')[:,0]) + t = t.set('indicator',t.get('coords')[:,0]) g = Grid.from_table(t,'coords',['indicator','z']) assert g.N_materials == g.cells[0]*2 and (g.material[:,:,-1]-g.material[:,:,0] == cells[0]).all() diff --git a/python/tests/test_Orientation.py b/python/tests/test_Orientation.py index 729967539..61c4948be 100644 --- a/python/tests/test_Orientation.py +++ b/python/tests/test_Orientation.py @@ -169,7 +169,7 @@ class TestOrientation: def test_from_directions(self,kwargs): for a,b in np.random.random((10,2,3)): c = np.cross(b,a) - if np.all(np.isclose(c,0)): continue + if np.allclose(c,0): continue o = Orientation.from_directions(uvw=a,hkl=c,**kwargs) x = o.to_pole(uvw=a) z = o.to_pole(hkl=c) diff --git a/python/tests/test_Table.py b/python/tests/test_Table.py index 812f2848f..e530abe58 100644 --- a/python/tests/test_Table.py +++ b/python/tests/test_Table.py @@ -51,7 +51,7 @@ class TestTable: def test_add(self,default): d = np.random.random((5,9)) - assert np.allclose(d,default.add('nine',d,'random data').get('nine')) + assert np.allclose(d,default.set('nine',d,'random data').get('nine')) def test_isclose(self,default): assert default.isclose(default).all() @@ -200,6 +200,6 @@ class TestTable: t = Table({'v':(2,)}, np.array([[0,1,],[2,1,]]), ['test data'])\ - .add('s',np.array(['b','a']))\ + .set('s',np.array(['b','a']))\ .sort_by('s') assert np.all(t.get('v')[:,0] == np.array([2,0])) From becf0eed000887ac22674373c6ea3440dd01be42 Mon Sep 17 00:00:00 2001 From: Franz Roters Date: Wed, 11 May 2022 17:51:37 +0200 Subject: [PATCH 108/142] use updated test and reference --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 3561f74a5..ede67b648 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 3561f74a5852c32e2c3da4dc48090b517cfa8e90 +Subproject commit ede67b6488f0a0a116fe5aa8b36980d11e0f29e7 From 6f07145b75c2b1aeb945b539d931e0db2dd7e716 Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 11 May 2022 20:31:51 +0200 Subject: [PATCH 109/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-322-g53c345f4f --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 9b4527e73..7606cee2c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-312-g6e7372f30 +3.0.0-alpha6-322-g53c345f4f From 648d17d3811295219d3dc9f3d4a00dbbff1e1f3e Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Wed, 11 May 2022 18:19:10 -0400 Subject: [PATCH 110/142] renamed .add to .set to be consistent with Table.set --- python/damask/_vtk.py | 25 +++++++++------- python/tests/reference/VTK/polyData.vtp | 11 +++++++ python/tests/test_VTK.py | 40 ++++++++++++------------- 3 files changed, 46 insertions(+), 30 deletions(-) diff --git a/python/damask/_vtk.py b/python/damask/_vtk.py index 4f2658cd7..880b00ede 100644 --- a/python/damask/_vtk.py +++ b/python/damask/_vtk.py @@ -401,13 +401,13 @@ class VTK: # Check https://blog.kitware.com/ghost-and-blanking-visibility-changes/ for missing data - def add(self, + def set(self, label: str = None, data: Union[np.ndarray, np.ma.MaskedArray] = None, *, table: 'Table' = None): """ - Add data to either cells or points. + Add (or replace existing) point or cell data. Data can either be a numpy.array, which requires a corresponding label, or a damask.Table. @@ -417,11 +417,15 @@ class VTK: label : str, optional Label of data array. data : numpy.ndarray or numpy.ma.MaskedArray, optional - Data to add. First dimension needs to match either + Data to add or replace. First array dimension needs to match either number of cells or number of points. table: damask.Table, optional - Data to add. Number of rows needs to match either - number of cells or number of points. + Data to add or replace. Each table label is individually considered. + Number of rows needs to match either number of cells or number of points. + + Notes + ----- + If the number of cells equals the number of points, the data is added to both. """ @@ -429,7 +433,10 @@ class VTK: label: str, data: np.ndarray): - N_data = data.shape[0] + N_p,N_c = vtk_data.GetNumberOfPoints(),vtk_data.GetNumberOfCells() + if (N_data := data.shape[0]) not in [N_p,N_c]: + raise ValueError(f'data count mismatch ({N_data} ≠ {N_p} & {N_c})') + data_ = data.reshape(N_data,-1) \ .astype(np.single if data.dtype in [np.double,np.longdouble] else data.dtype) @@ -442,12 +449,10 @@ class VTK: d.SetName(label) - if N_data == vtk_data.GetNumberOfPoints(): + if N_data == N_p: vtk_data.GetPointData().AddArray(d) - elif N_data == vtk_data.GetNumberOfCells(): + if N_data == N_c: vtk_data.GetCellData().AddArray(d) - else: - raise ValueError(f'data count mismatch ({N_data} ≠ {self.N_points} & {self.N_cells})') if data is None and table is None: raise KeyError('no data given') diff --git a/python/tests/reference/VTK/polyData.vtp b/python/tests/reference/VTK/polyData.vtp index dc4b5f149..5f4606535 100644 --- a/python/tests/reference/VTK/polyData.vtp +++ b/python/tests/reference/VTK/polyData.vtp @@ -16,6 +16,17 @@ + + AQAAAACAAAB4AAAAVgAAAA==eF5jYICBhv2WfY9tLfuS7Ypk3PeDaCDf7okF3/7Vq1bZrV6lZQ+k94HEgHL2QHovUM7+iUUfiG0LlQdhkH77Ipnj9iB5qFp7kBjQDiBmcADRANsaLXM= + + + 0.74535601471 + + + 2.4494897428 + + + diff --git a/python/tests/test_VTK.py b/python/tests/test_VTK.py index b0a7ef4c5..58855c831 100644 --- a/python/tests/test_VTK.py +++ b/python/tests/test_VTK.py @@ -147,24 +147,24 @@ class TestVTK: with pytest.raises(KeyError): default.get('does_not_exist') - def test_invalid_add_shape(self,default): + def test_invalid_set_shape(self,default): with pytest.raises(ValueError): - default.add('valid',np.ones(3)) + default.set('valid',np.ones(3)) - def test_invalid_add_missing_label(self,default): + def test_invalid_set_missing_label(self,default): data = np.random.randint(9,size=np.prod(np.array(default.vtk_data.GetDimensions())-1)) with pytest.raises(ValueError): - default.add(data=data) + default.set(data=data) - def test_invalid_add_type(self,default): + def test_invalid_set_type(self,default): with pytest.raises(TypeError): - default.add(label='valid',data='invalid_type') + default.set(label='valid',data='invalid_type') with pytest.raises(TypeError): - default.add(label='valid',table='invalid_type') + default.set(label='valid',table='invalid_type') - def test_invalid_add_dual(self,default): + def test_invalid_set_dual(self,default): with pytest.raises(KeyError): - default.add(label='valid',data=0,table=0) + default.set(label='valid',data=0,table=0) @pytest.mark.parametrize('data_type,shape',[(float,(3,)), (float,(3,3)), @@ -172,31 +172,31 @@ class TestVTK: (int,(4,)), (str,(1,))]) @pytest.mark.parametrize('N_values',[5*6*7,6*7*8]) - def test_add_get(self,default,data_type,shape,N_values): + def test_set_get(self,default,data_type,shape,N_values): data = np.squeeze(np.random.randint(0,100,(N_values,)+shape)).astype(data_type) - new = default.add('data',data) + new = default.set('data',data) assert (np.squeeze(data.reshape(N_values,-1)) == new.get('data')).all() @pytest.mark.parametrize('shapes',[{'scalar':(1,),'vector':(3,),'tensor':(3,3)}, {'vector':(6,),'tensor':(3,3)}, {'tensor':(3,3),'scalar':(1,)}]) - def test_add_table(self,default,shapes): + def test_set_table(self,default,shapes): N = np.random.choice([default.N_points,default.N_cells]) d = dict() for k,s in shapes.items(): d[k] = dict(shape = s, data = np.random.random(N*np.prod(s)).reshape((N,-1))) - new = default.add(table=Table(shapes,np.column_stack([d[k]['data'] for k in shapes.keys()]))) + new = default.set(table=Table(shapes,np.column_stack([d[k]['data'] for k in shapes.keys()]))) for k,s in shapes.items(): assert np.allclose(np.squeeze(d[k]['data']),new.get(k),rtol=1e-7) - def test_add_masked(self,default): + def test_set_masked(self,default): data = np.random.rand(5*6*7,3) masked = ma.MaskedArray(data,mask=data<.4,fill_value=42.) - mask_auto = default.add('D',masked) - mask_manual = default.add('D',np.where(masked.mask,masked.fill_value,masked)) + mask_auto = default.set('D',masked) + mask_manual = default.set('D',np.where(masked.mask,masked.fill_value,masked)) assert mask_manual == mask_auto @@ -210,7 +210,7 @@ class TestVTK: data = np.squeeze(np.random.randint(0,100,(N_values,)+shape)).astype(data_type) ALPHABET = np.array(list(string.ascii_lowercase + ' ')) label = ''.join(np.random.choice(ALPHABET, size=10)) - new = default.add(label,data) + new = default.set(label,data) if N_values == default.N_points: assert label in new.labels['Point Data'] if N_values == default.N_cells: assert label in new.labels['Cell Data'] @@ -225,7 +225,7 @@ class TestVTK: @pytest.mark.xfail(int(vtk.vtkVersion.GetVTKVersion().split('.')[0])<8, reason='missing METADATA') def test_compare_reference_polyData(self,update,ref_path,tmp_path): points=np.dstack((np.linspace(0.,1.,10),np.linspace(0.,2.,10),np.linspace(-1.,1.,10))).squeeze() - polyData = VTK.from_poly_data(points).add('coordinates',points) + polyData = VTK.from_poly_data(points).set('coordinates',points) if update: polyData.save(ref_path/'polyData') else: @@ -242,8 +242,8 @@ class TestVTK: c = coords[:-1,:-1,:-1,:].reshape(-1,3,order='F') n = coords[:,:,:,:].reshape(-1,3,order='F') rectilinearGrid = VTK.from_rectilinear_grid(grid) \ - .add('cell',np.ascontiguousarray(c)) \ - .add('node',np.ascontiguousarray(n)) + .set('cell',np.ascontiguousarray(c)) \ + .set('node',np.ascontiguousarray(n)) if update: rectilinearGrid.save(ref_path/'rectilinearGrid') else: From fce600f02b8abaa1638c8314c1081145c0b99402 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 12 May 2022 00:39:19 +0200 Subject: [PATCH 111/142] in tree build not supported anymore --- .github/workflows/Python.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Python.yml b/.github/workflows/Python.yml index 15e04fb18..2f2a5d111 100644 --- a/.github/workflows/Python.yml +++ b/.github/workflows/Python.yml @@ -42,13 +42,13 @@ jobs: - name: Install and run unit tests (Unix) if: runner.os != 'Windows' run: | - python -m pip install ./python --no-deps -vv --use-feature=in-tree-build + python -m pip install ./python --no-deps -vv COLUMNS=256 pytest python - name: Install and run unit tests (Windows) if: runner.os == 'Windows' run: | - python -m pip install ./python --no-deps -vv --use-feature=in-tree-build + python -m pip install ./python --no-deps -vv pytest python -k 'not XDMF' apt: From d18e36ecf085efe6e0fc7db447b7df63cdc5c58c Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Wed, 11 May 2022 18:54:03 -0400 Subject: [PATCH 112/142] fixed leftover .add --> .set --- python/damask/_grid.py | 6 +++--- python/damask/_result.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/python/damask/_grid.py b/python/damask/_grid.py index 471ba36bd..f7acfe5aa 100644 --- a/python/damask/_grid.py +++ b/python/damask/_grid.py @@ -694,9 +694,9 @@ class Grid: """ v = VTK.from_image_data(self.cells,self.size,self.origin)\ - .add('material',self.material.flatten(order='F')) + .set('material',self.material.flatten(order='F')) for label,data in self.initial_conditions.items(): - v = v.add(label,data.flatten(order='F')) + v = v.set(label,data.flatten(order='F')) v.comments = self.comments v.save(fname,parallel=False,compress=compress) @@ -745,7 +745,7 @@ class Grid: """ VTK.from_image_data(self.cells,self.size,self.origin) \ - .add('material',self.material.flatten('F'),) \ + .set('material',self.material.flatten('F'),) \ .show('material',colormap) diff --git a/python/damask/_result.py b/python/damask/_result.py index 253881731..b86a5fb3d 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -1627,7 +1627,7 @@ class Result: for inc in util.show_progress(self.visible['increments']): u = _read(f['/'.join([inc,'geometry','u_n' if mode.lower() == 'cell' else 'u_p'])]) - v = v.add('u',u) + v = v.set('u',u) for ty in ['phase','homogenization']: for field in self.visible['fields']: @@ -1654,7 +1654,7 @@ class Result: outs[out][at_cell_ho[label]] = data[in_data_ho[label]] for label,dataset in outs.items(): - v = v.add(' / '.join(['/'.join([ty,field,label]),dataset.dtype.metadata['unit']]),dataset) + v = v.set(' / '.join(['/'.join([ty,field,label]),dataset.dtype.metadata['unit']]),dataset) v.save(f'{self.fname.stem}_inc{inc[10:].zfill(N_digits)}',parallel=parallel) From fd71a900e75d7977d93ba509293d85fc03ed2476 Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 12 May 2022 03:27:49 +0200 Subject: [PATCH 113/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-325-g236a009e2 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 7606cee2c..5a0b819ae 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-322-g53c345f4f +3.0.0-alpha6-325-g236a009e2 From 0b6ead1a484fb472e36d8ddf351f39d0e5d977f0 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 12 May 2022 15:36:12 +0200 Subject: [PATCH 114/142] avoid console-spam during initialization --- src/signals.f90 | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/signals.f90 b/src/signals.f90 index bf53912f4..a3eac8025 100644 --- a/src/signals.f90 +++ b/src/signals.f90 @@ -10,9 +10,9 @@ module signals private logical, volatile, public, protected :: & - signals_SIGTERM, & !< termination signal - signals_SIGUSR1, & !< 1. user-defined signal - signals_SIGUSR2 !< 2. user-defined signal + signals_SIGTERM = .false., & !< termination signal + signals_SIGUSR1 = .false., & !< 1. user-defined signal + signals_SIGUSR2 = .false. !< 2. user-defined signal public :: & signals_init, & @@ -31,9 +31,6 @@ subroutine signals_init() call signalterm_c(c_funloc(catchSIGTERM)) call signalusr1_c(c_funloc(catchSIGUSR1)) call signalusr2_c(c_funloc(catchSIGUSR2)) - call signals_setSIGTERM(.false.) - call signals_setSIGUSR1(.false.) - call signals_setSIGUSR2(.false.) end subroutine signals_init From 961e6acf6e3d746d71a646fde746dd2b2dc251cd Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 12 May 2022 16:56:12 +0200 Subject: [PATCH 115/142] not needed anymore --- install/MarcMentat/2021.3.1/Marc_tools/include_linux64.patch | 1 + install/MarcMentat/2022.1/Marc_tools/include_linux64.patch | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/install/MarcMentat/2021.3.1/Marc_tools/include_linux64.patch b/install/MarcMentat/2021.3.1/Marc_tools/include_linux64.patch index f0276bb62..5d78b22f8 100644 --- a/install/MarcMentat/2021.3.1/Marc_tools/include_linux64.patch +++ b/install/MarcMentat/2021.3.1/Marc_tools/include_linux64.patch @@ -21,6 +21,7 @@ I8DEFINES="-DI64" I8CDEFINES="-U_DOUBLE -D_SINGLE" fi + @@ -556,7 +561,7 @@ then PROFILE=" $PROFILE -pg" fi diff --git a/install/MarcMentat/2022.1/Marc_tools/include_linux64.patch b/install/MarcMentat/2022.1/Marc_tools/include_linux64.patch index d16e21403..8cf6d2113 100644 --- a/install/MarcMentat/2022.1/Marc_tools/include_linux64.patch +++ b/install/MarcMentat/2022.1/Marc_tools/include_linux64.patch @@ -7,7 +7,7 @@ +# DAMASK uses the HDF5 compiler wrapper around the Intel compiler +H5FC="$(h5fc -shlib -show)" +HDF5_LIB=${H5FC//ifort/} -+FCOMP="$H5FC -DDAMASK_HDF5" ++FCOMP="$H5FC" + # AEM if test "$MARCDLLOUTDIR" = ""; then @@ -17,9 +17,8 @@ I8CDEFINES= else - I8FFLAGS="-i8" -- I8DEFINES="-DI64" + I8FFLAGS="-i8 -integer-size 64" -+ I8DEFINES="-DI64 -DINT=8" + I8DEFINES="-DI64" I8CDEFINES="-U_DOUBLE -D_SINGLE" fi From 1135a42b2a1aca6581203c870773e1547305b861 Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 12 May 2022 18:25:40 +0200 Subject: [PATCH 116/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-328-g14a7d3fc4 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 5a0b819ae..84a698485 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-325-g236a009e2 +3.0.0-alpha6-328-g14a7d3fc4 From 5627c28ea142f61bf1981ebe211fea6d0ef9b057 Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 13 May 2022 00:35:47 +0200 Subject: [PATCH 117/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-339-g6f7e8491b --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 84a698485..20916718f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-328-g14a7d3fc4 +3.0.0-alpha6-339-g6f7e8491b From 12cd19554f6599147b756aaceadfdf6cffa8a551 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 13 May 2022 06:02:22 +0200 Subject: [PATCH 118/142] consistent interface and description --- python/damask/_table.py | 4 ++-- python/damask/_vtk.py | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/python/damask/_table.py b/python/damask/_table.py index f440b7302..2d2c30c00 100644 --- a/python/damask/_table.py +++ b/python/damask/_table.py @@ -370,9 +370,9 @@ class Table: label : str Column label. data : numpy.ndarray - Column data. + Column data. First dimension needs to match number of rows. info : str, optional - Human-readable information about the modified data. + Human-readable information about the data. Returns ------- diff --git a/python/damask/_vtk.py b/python/damask/_vtk.py index 880b00ede..aa0be4dea 100644 --- a/python/damask/_vtk.py +++ b/python/damask/_vtk.py @@ -404,10 +404,11 @@ class VTK: def set(self, label: str = None, data: Union[np.ndarray, np.ma.MaskedArray] = None, + info: str = None, *, table: 'Table' = None): """ - Add (or replace existing) point or cell data. + Add new or replace existing point or cell data. Data can either be a numpy.array, which requires a corresponding label, or a damask.Table. @@ -419,6 +420,8 @@ class VTK: data : numpy.ndarray or numpy.ma.MaskedArray, optional Data to add or replace. First array dimension needs to match either number of cells or number of points. + info : str, optional + Human-readable information about the data. table: damask.Table, optional Data to add or replace. Each table label is individually considered. Number of rows needs to match either number of cells or number of points. @@ -465,14 +468,17 @@ class VTK: _add_array(dup.vtk_data, label, np.where(data.mask,data.fill_value,data) if isinstance(data,np.ma.MaskedArray) else data) + if info is not None: dup.comments = f'{label}: {info}' else: raise ValueError('no label defined for data') elif isinstance(table,Table): for l in table.labels: _add_array(dup.vtk_data,l,table.get(l)) + if info is not None: dup.comments = f'{l}: {info}' else: raise TypeError + return dup From 05d3a929442d96c2f68bc831d4940c70c9af548a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 13 May 2022 08:43:24 +0200 Subject: [PATCH 119/142] using the module is the recommended approach --- src/Marc/DAMASK_Marc.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Marc/DAMASK_Marc.f90 b/src/Marc/DAMASK_Marc.f90 index 4a42120ee..8cff89cc9 100644 --- a/src/Marc/DAMASK_Marc.f90 +++ b/src/Marc/DAMASK_Marc.f90 @@ -208,9 +208,9 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & use discretization_Marc use homogenization use materialpoint_Marc + use OMP_LIB implicit none - include "omp_lib.h" ! the openMP function library integer, intent(in) :: & ! according to MSC.Marc 2012 Manual D ngens, & !< size of stress-strain law nn, & !< integration point number From d48fa460b1c2ff308e6c81086baa7c8f104d9ce0 Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 13 May 2022 08:49:30 +0200 Subject: [PATCH 120/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-343-gc8d48d6eb --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 20916718f..2ff635946 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-339-g6f7e8491b +3.0.0-alpha6-343-gc8d48d6eb From 90c3b3170d4300ebd521bb4b623fc647f5d6e577 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 13 May 2022 09:53:44 +0200 Subject: [PATCH 121/142] propagate 'normalize' option --- python/damask/_orientation.py | 6 ++++-- python/damask/_result.py | 20 +++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/python/damask/_orientation.py b/python/damask/_orientation.py index 0c995110c..dcc139b7c 100644 --- a/python/damask/_orientation.py +++ b/python/damask/_orientation.py @@ -796,7 +796,8 @@ class Orientation(Rotation,Crystal): uvw|hkl : numpy.ndarray, shape (...,3) Miller indices of crystallographic direction or plane normal. Shape of vector blends with shape of own rotation array. - For example, a rotation array of shape (3,2) and a vector array of shape (2,4) result in (3,2,4) outputs. + For example, a rotation array of shape (3,2) and a vector + array of shape (2,4) result in (3,2,4) outputs. with_symmetry : bool, optional Calculate all N symmetrically equivalent vectors. Defaults to False. @@ -807,7 +808,8 @@ class Orientation(Rotation,Crystal): Returns ------- vector : numpy.ndarray, shape (...,3) or (...,N,3) - Lab frame vector (or vectors if with_symmetry) along [uvw] direction or (hkl) plane normal. + Lab frame vector (or vectors if with_symmetry) along + [uvw] direction or (hkl) plane normal. """ v = self.to_frame(uvw=uvw,hkl=hkl) diff --git a/python/damask/_result.py b/python/damask/_result.py index 253881731..7a58a1621 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -1023,26 +1023,26 @@ class Result: @staticmethod - def _add_pole(q,uvw,hkl,with_symmetry): + def _add_pole(q,uvw,hkl,with_symmetry,normalize): c = q['meta']['c/a'] if 'c/a' in q['meta'] else 1 brackets = ['[]','()','⟨⟩','{}'][(uvw is None)*1+with_symmetry*2] label = 'p^' + '{}{} {} {}{}'.format(brackets[0], *(uvw if uvw else hkl), brackets[-1],) - pole = Orientation(q['data'],lattice=q['meta']['lattice'],a=1,c=c).to_pole(uvw=uvw,hkl=hkl,with_symmetry=with_symmetry) + ori = Orientation(q['data'],lattice=q['meta']['lattice'],a=1,c=c) return { - 'data': pole, + 'data': ori.to_pole(uvw=uvw,hkl=hkl,with_symmetry=with_symmetry,normalize=normalize), 'label': label, 'meta' : { 'unit': '1', - 'description': 'lab frame vector along lattice ' \ - + ('direction' if uvw else 'plane') \ + 'description': f'{"normalized " if normalize else ""}lab frame vector along lattice ' \ + + ('direction' if uvw is not None else 'plane') \ + ('s' if with_symmetry else ''), 'creator': 'add_pole' } } - def add_pole(self,q='O',*,uvw=None,hkl=None,with_symmetry=False): + def add_pole(self,q='O',*,uvw=None,hkl=None,with_symmetry=False,normalize=True): """ Add lab frame vector along lattice direction [uvw] or plane normal (hkl). @@ -1055,9 +1055,15 @@ class Result: Miller indices of crystallographic direction or plane normal. with_symmetry : bool, optional Calculate all N symmetrically equivalent vectors. + Defaults to True. + normalize : bool, optional + Normalize output vector. + Defaults to True. """ - self._add_generic_pointwise(self._add_pole,{'q':q},{'uvw':uvw,'hkl':hkl,'with_symmetry':with_symmetry}) + self._add_generic_pointwise(self._add_pole, + {'q':q}, + {'uvw':uvw,'hkl':hkl,'with_symmetry':with_symmetry,'normalize':normalize}) @staticmethod From 6b17787be1a0a35c65d1125248266f2a4fa6b078 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 13 May 2022 09:59:09 +0200 Subject: [PATCH 122/142] only relevant for Marc --- src/Marc/DAMASK_Marc.f90 | 2 +- src/{ => Marc}/element.f90 | 149 ------------------------------------- 2 files changed, 1 insertion(+), 150 deletions(-) rename src/{ => Marc}/element.f90 (88%) diff --git a/src/Marc/DAMASK_Marc.f90 b/src/Marc/DAMASK_Marc.f90 index 4a42120ee..c04fc0ee7 100644 --- a/src/Marc/DAMASK_Marc.f90 +++ b/src/Marc/DAMASK_Marc.f90 @@ -152,7 +152,7 @@ end module DAMASK_interface #include "../rotations.f90" #include "../polynomials.f90" #include "../lattice.f90" -#include "../element.f90" +#include "element.f90" #include "../geometry_plastic_nonlocal.f90" #include "../discretization.f90" #include "discretization_Marc.f90" diff --git a/src/element.f90 b/src/Marc/element.f90 similarity index 88% rename from src/element.f90 rename to src/Marc/element.f90 index c8e3b0416..295a41547 100644 --- a/src/element.f90 +++ b/src/Marc/element.f90 @@ -152,22 +152,14 @@ module element reshape([& -2,-3,-1 & ! Note: This fix is for gfortran 9 only. gfortran 8 supports neither, gfortran > 9 both variants -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR1)) -#else ],[NIPNEIGHBOR(CELLTYPE(1)),NIP(1)]) -#endif integer, dimension(NIPNEIGHBOR(CELLTYPE(2)),NIP(2)), parameter :: IPNEIGHBOR2 = & reshape([& 2,-3, 3,-1, & -2, 1, 3,-1, & 2,-3,-2, 1 & -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR2)) -#else ],[NIPNEIGHBOR(CELLTYPE(2)),NIP(2)]) -#endif integer, dimension(NIPNEIGHBOR(CELLTYPE(3)),NIP(3)), parameter :: IPNEIGHBOR3 = & reshape([& @@ -175,11 +167,7 @@ module element -2, 1, 4,-1, & 4,-4,-3, 1, & -2, 3,-3, 2 & -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR3)) -#else ],[NIPNEIGHBOR(CELLTYPE(3)),NIP(3)]) -#endif integer, dimension(NIPNEIGHBOR(CELLTYPE(4)),NIP(4)), parameter :: IPNEIGHBOR4 = & reshape([& @@ -192,20 +180,12 @@ module element 8,-4,-3, 4, & 9, 7,-3, 5, & -2, 8,-3, 6 & -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR4)) -#else ],[NIPNEIGHBOR(CELLTYPE(4)),NIP(4)]) -#endif integer, dimension(NIPNEIGHBOR(CELLTYPE(5)),NIP(5)), parameter :: IPNEIGHBOR5 = & reshape([& -1,-2,-3,-4 & -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR5)) -#else ],[NIPNEIGHBOR(CELLTYPE(5)),NIP(5)]) -#endif integer, dimension(NIPNEIGHBOR(CELLTYPE(6)),NIP(6)), parameter :: IPNEIGHBOR6 = & reshape([& @@ -213,11 +193,7 @@ module element -2, 1, 3,-2, 4,-1, & 2,-4,-3, 1, 4,-1, & 2,-4, 3,-2,-3, 1 & -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR6)) -#else ],[NIPNEIGHBOR(CELLTYPE(6)),NIP(6)]) -#endif integer, dimension(NIPNEIGHBOR(CELLTYPE(7)),NIP(7)), parameter :: IPNEIGHBOR7 = & reshape([& @@ -227,20 +203,12 @@ module element 5,-4, 6,-2,-5, 1, & -3, 4, 6,-2,-5, 2, & 5,-4,-3, 4,-5, 3 & -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR7)) -#else ],[NIPNEIGHBOR(CELLTYPE(7)),NIP(7)]) -#endif integer, dimension(NIPNEIGHBOR(CELLTYPE(8)),NIP(8)), parameter :: IPNEIGHBOR8 = & reshape([& -3,-5,-4,-2,-6,-1 & -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR8)) -#else ],[NIPNEIGHBOR(CELLTYPE(8)),NIP(8)]) -#endif integer, dimension(NIPNEIGHBOR(CELLTYPE(9)),NIP(9)), parameter :: IPNEIGHBOR9 = & reshape([& @@ -252,11 +220,7 @@ module element -3, 5, 8,-2,-6, 2, & 8,-5,-4, 5,-6, 3, & -3, 7,-4, 6,-6, 4 & -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR9)) -#else ],[NIPNEIGHBOR(CELLTYPE(9)),NIP(9)]) -#endif integer, dimension(NIPNEIGHBOR(CELLTYPE(10)),NIP(10)), parameter :: IPNEIGHBOR10 = & reshape([& @@ -287,11 +251,7 @@ module element 26,-5,-4,22,-6,16, & 27,25,-4,23,-6,17, & -3,26,-4,24,-6,18 & -#if !defined(__GFORTRAN__) - ],shape(IPNEIGHBOR10)) -#else ],[NIPNEIGHBOR(CELLTYPE(10)),NIP(10)]) -#endif integer, dimension(NNODE(1),NCELLNODE(GEOMTYPE(1))), parameter :: CELLNODEPARENTNODEWEIGHTS1 = & @@ -299,11 +259,7 @@ module element 1, 0, 0, & 0, 1, 0, & 0, 0, 1 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS1)) !< 2D 3node 1ip -#else ],[NNODE(1),NCELLNODE(GEOMTYPE(1))]) -#endif integer, dimension(NNODE(2),NCELLNODE(GEOMTYPE(2))), parameter :: CELLNODEPARENTNODEWEIGHTS2 = & reshape([& @@ -314,11 +270,7 @@ module element 0, 0, 0, 0, 1, 0, & 0, 0, 0, 0, 0, 1, & 1, 1, 1, 2, 2, 2 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS2)) !< 2D 6node 3ip -#else ],[NNODE(2),NCELLNODE(GEOMTYPE(2))]) -#endif integer, dimension(NNODE(3),NCELLNODE(GEOMTYPE(3))), parameter :: CELLNODEPARENTNODEWEIGHTS3 = & reshape([& @@ -331,11 +283,7 @@ module element 0, 0, 1, 1, & 1, 0, 0, 1, & 1, 1, 1, 1 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS3)) !< 2D 6node 3ip -#else ],[NNODE(3),NCELLNODE(GEOMTYPE(3))]) -#endif integer, dimension(NNODE(4),NCELLNODE(GEOMTYPE(4))), parameter :: CELLNODEPARENTNODEWEIGHTS4 = & reshape([& @@ -355,11 +303,7 @@ module element 1, 4, 1, 1, 8, 8, 2, 2, & 1, 1, 4, 1, 2, 8, 8, 2, & 1, 1, 1, 4, 2, 2, 8, 8 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS4)) !< 2D 8node 9ip -#else ],[NNODE(4),NCELLNODE(GEOMTYPE(4))]) -#endif integer, dimension(NNODE(5),NCELLNODE(GEOMTYPE(5))), parameter :: CELLNODEPARENTNODEWEIGHTS5 = & reshape([& @@ -372,11 +316,7 @@ module element 0, 0, 0, 0, 0, 0, 1, 0, & 0, 0, 0, 0, 0, 0, 0, 1, & 1, 1, 1, 1, 2, 2, 2, 2 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS5)) !< 2D 8node 4ip -#else ],[NNODE(5),NCELLNODE(GEOMTYPE(5))]) -#endif integer, dimension(NNODE(6),NcellNode(GEOMTYPE(6))), parameter :: CELLNODEPARENTNODEWEIGHTS6 = & reshape([& @@ -384,11 +324,7 @@ module element 0, 1, 0, 0, & 0, 0, 1, 0, & 0, 0, 0, 1 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS6)) !< 3D 4node 1ip -#else ],[NNODE(6),NcellNode(GEOMTYPE(6))]) -#endif integer, dimension(NNODE(7),NCELLNODE(GEOMTYPE(7))), parameter :: CELLNODEPARENTNODEWEIGHTS7 = & reshape([& @@ -407,11 +343,7 @@ module element 0, 1, 1, 1, 0, & 1, 0, 1, 1, 0, & 0, 0, 0, 0, 1 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS7)) !< 3D 5node 4ip -#else ],[NNODE(7),NCELLNODE(GEOMTYPE(7))]) -#endif integer, dimension(NNODE(8),NCELLNODE(GEOMTYPE(8))), parameter :: CELLNODEPARENTNODEWEIGHTS8 = & reshape([& @@ -430,11 +362,7 @@ module element 0, 1, 1, 1, 0, 2, 0, 0, 2, 2, & 1, 0, 1, 1, 0, 0, 2, 2, 0, 2, & 3, 3, 3, 3, 4, 4, 4, 4, 4, 4 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS8)) !< 3D 10node 4ip -#else ],[NNODE(8),NCELLNODE(GEOMTYPE(8))]) -#endif integer, dimension(NNODE(9),NCELLNODE(GEOMTYPE(9))), parameter :: CELLNODEPARENTNODEWEIGHTS9 = & reshape([& @@ -459,11 +387,7 @@ module element 1, 0, 1, 1, 0, 1, & 0, 0, 0, 1, 1, 1, & 1, 1, 1, 1, 1, 1 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS9)) !< 3D 6node 6ip -#else ],[NNODE(9),NCELLNODE(GEOMTYPE(9))]) -#endif integer, dimension(NNODE(10),NCELLNODE(GEOMTYPE(10))), parameter :: CELLNODEPARENTNODEWEIGHTS10 = & reshape([& @@ -475,11 +399,7 @@ module element 0, 0, 0, 0, 0, 1, 0, 0, & 0, 0, 0, 0, 0, 0, 1, 0, & 0, 0, 0, 0, 0, 0, 0, 1 & -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS10)) !< 3D 8node 1ip -#else ],[NNODE(10),NCELLNODE(GEOMTYPE(10))]) -#endif integer, dimension(NNODE(11),NCELLNODE(GEOMTYPE(11))), parameter :: CELLNODEPARENTNODEWEIGHTS11 = & reshape([& @@ -510,11 +430,7 @@ module element 1, 0, 0, 1, 1, 0, 0, 1, & ! 25 0, 0, 0, 0, 1, 1, 1, 1, & ! 1, 1, 1, 1, 1, 1, 1, 1 & ! -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS11)) !< 3D 8node 8ip -#else ],[NNODE(11),NCELLNODE(GEOMTYPE(11))]) -#endif integer, dimension(NNODE(12),NCELLNODE(GEOMTYPE(12))), parameter :: CELLNODEPARENTNODEWEIGHTS12 = & reshape([& @@ -545,11 +461,7 @@ module element 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 2, 2, 0, 0, 2, & ! 25 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, & ! 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 & ! -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS12)) !< 3D 20node 8ip -#else ],[NNODE(12),NCELLNODE(GEOMTYPE(12))]) -#endif integer, dimension(NNODE(13),NCELLNODE(GEOMTYPE(13))), parameter :: CELLNODEPARENTNODEWEIGHTS13 = & reshape([& @@ -617,32 +529,20 @@ module element 4, 8, 4, 3, 8,24, 8, 4, 12,12, 4, 4, 32,32,12,12, 12,32,12, 4, & ! 3, 4, 8, 4, 4, 8,24, 8, 4,12,12, 4, 12,32,32,12, 4,12,32,12, & ! 4, 3, 4, 8, 8, 4, 8,24, 4, 4,12,12, 12,12,32,32, 12, 4,12,32 & ! -#if !defined(__GFORTRAN__) - ],shape(CELLNODEPARENTNODEWEIGHTS13)) !< 3D 20node 27ip -#else ],[NNODE(13),NCELLNODE(GEOMTYPE(13))]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(1)),NIP(1)), parameter :: CELL1 = & reshape([& 1,2,3 & -#if !defined(__GFORTRAN__) - ],shape(CELL1)) -#else ],[NCELLNODEPERCELL(CELLTYPE(1)),NIP(1)]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(2)),NIP(2)), parameter :: CELL2 = & reshape([& 1, 4, 7, 6, & 2, 5, 7, 4, & 3, 6, 7, 5 & -#if !defined(__GFORTRAN__) - ],shape(CELL2)) -#else ],[NCELLNODEPERCELL(CELLTYPE(2)),NIP(2)]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(3)),NIP(3)), parameter :: CELL3 = & reshape([& @@ -650,11 +550,7 @@ module element 5, 2, 6, 9, & 8, 9, 7, 4, & 9, 6, 3, 7 & -#if !defined(__GFORTRAN__) - ],shape(CELL3)) -#else ],[NCELLNODEPERCELL(CELLTYPE(3)),NIP(3)]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(4)),NIP(4)), parameter :: CELL4 = & reshape([& @@ -667,20 +563,12 @@ module element 11,16,10, 4, & 16,15, 9,10, & 15, 8, 3, 9 & -#if !defined(__GFORTRAN__) - ],shape(CELL4)) -#else ],[NCELLNODEPERCELL(CELLTYPE(4)),NIP(4)]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(5)),NIP(5)), parameter :: CELL5 = & reshape([& 1, 2, 3, 4 & -#if !defined(__GFORTRAN__) - ],shape(CELL5)) -#else ],[NCELLNODEPERCELL(CELLTYPE(5)),NIP(5)]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(6)),NIP(6)), parameter :: CELL6 = & reshape([& @@ -688,11 +576,7 @@ module element 5, 2, 6,11,12, 9,13,15, & 7,11, 6, 3,14,15,13,10, & 8,12,15,14, 4, 9,13,10 & -#if !defined(__GFORTRAN__) - ],shape(CELL6)) -#else ],[NCELLNODEPERCELL(CELLTYPE(6)),NIP(6)]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(7)),NIP(7)), parameter :: CELL7 = & reshape([& @@ -702,20 +586,12 @@ module element 10,17,21,19, 4,13,20,15, & 17,11,18,21,13, 5,14,20, & 19,21,18,12,15,20,14, 6 & -#if !defined(__GFORTRAN__) - ],shape(CELL7)) -#else ],[NCELLNODEPERCELL(CELLTYPE(7)),NIP(7)]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(8)),NIP(8)), parameter :: CELL8 = & reshape([& 1, 2, 3, 4, 5, 6, 7, 8 & -#if !defined(__GFORTRAN__) - ],shape(CELL8)) -#else ],[NCELLNODEPERCELL(CELLTYPE(8)),NIP(8)]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(9)),NIP(9)), parameter :: CELL9 = & reshape([& @@ -727,11 +603,7 @@ module element 22,18,23,27,13, 6,14,26, & 25,27,24,20,16,26,15, 8, & 27,23,19,24,26,14, 7,15 & -#if !defined(__GFORTRAN__) - ],shape(CELL9)) -#else ],[NCELLNODEPERCELL(CELLTYPE(9)),NIP(9)]) -#endif integer, dimension(NCELLNODEPERCELL(CELLTYPE(10)),NIP(10)), parameter :: CELL10 = & reshape([& @@ -762,11 +634,7 @@ module element 51,64,50,24,31,56,30, 8, & 64,63,49,50,56,55,29,30, & 63,48,23,49,55,28, 7,29 & -#if !defined(__GFORTRAN__) - ],shape(CELL10)) -#else ],[NCELLNODEPERCELL(CELLTYPE(10)),NIP(10)]) -#endif integer, dimension(NCELLNODEPERCELLFACE(1),NIPNEIGHBOR(1)), parameter :: CELLFACE1 = & @@ -774,11 +642,7 @@ module element 2,3, & 3,1, & 1,2 & -#if !defined(__GFORTRAN__) - ],shape(CELLFACE1)) !< 2D 3node, VTK_TRIANGLE (5) -#else ],[NCELLNODEPERCELLFACE(1),NIPNEIGHBOR(1)]) -#endif integer, dimension(NCELLNODEPERCELLFACE(2),NIPNEIGHBOR(2)), parameter :: CELLFACE2 = & reshape([& @@ -786,11 +650,7 @@ module element 4,1, & 3,4, & 1,2 & -#if !defined(__GFORTRAN__) - ],shape(CELLFACE2)) !< 2D 4node, VTK_QUAD (9) -#else ],[NCELLNODEPERCELLFACE(2),NIPNEIGHBOR(2)]) -#endif integer, dimension(NCELLNODEPERCELLFACE(3),NIPNEIGHBOR(3)), parameter :: CELLFACE3 = & reshape([& @@ -798,11 +658,7 @@ module element 1,2,4, & 2,3,4, & 1,4,3 & -#if !defined(__GFORTRAN__) - ],shape(CELLFACE3)) !< 3D 4node, VTK_TETRA (10) -#else ],[NCELLNODEPERCELLFACE(3),NIPNEIGHBOR(3)]) -#endif integer, dimension(NCELLNODEPERCELLFACE(4),NIPNEIGHBOR(4)), parameter :: CELLFACE4 = & reshape([& @@ -812,12 +668,7 @@ module element 1,2,6,5, & 5,6,7,8, & 1,4,3,2 & -#if !defined(__GFORTRAN__) - ],shape(CELLFACE4)) !< 3D 8node, VTK_HEXAHEDRON (12) -#else ],[NCELLNODEPERCELLFACE(4),NIPNEIGHBOR(4)]) -#endif - contains From 37eb567451fb81e4f8313da41a1bd8a9ba4323b8 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 13 May 2022 11:10:02 +0200 Subject: [PATCH 123/142] dataset for Platinum --- examples/config/phase/Pt.yaml | 5 ++++ .../phase/mechanical/elastic/Hooke_Pt.yaml | 26 +++++++++++++++++++ .../plastic/phenopowerlaw_Pt-5%Cu.yaml | 16 ++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 examples/config/phase/Pt.yaml create mode 100644 examples/config/phase/mechanical/elastic/Hooke_Pt.yaml create mode 100644 examples/config/phase/mechanical/plastic/phenopowerlaw_Pt-5%Cu.yaml diff --git a/examples/config/phase/Pt.yaml b/examples/config/phase/Pt.yaml new file mode 100644 index 000000000..90d8ba2f2 --- /dev/null +++ b/examples/config/phase/Pt.yaml @@ -0,0 +1,5 @@ +references: + - https://en.wikipedia.org/wiki/Platinum + +lattice: cF +rho: 21450.0 diff --git a/examples/config/phase/mechanical/elastic/Hooke_Pt.yaml b/examples/config/phase/mechanical/elastic/Hooke_Pt.yaml new file mode 100644 index 000000000..88513b8ac --- /dev/null +++ b/examples/config/phase/mechanical/elastic/Hooke_Pt.yaml @@ -0,0 +1,26 @@ +type: Hooke + +references: + - S.M. Collard and R.B. McLellan, + Acta Metallurgica et Materialia 40:699-702, 1992, + https://doi.org/10.1016/0956-7151(92)90011-3 + +C_11: 373.42e+9 +C_11,T: -8.929e+7 +C_11,T^2: -1.298e+5 +C_11,T^3: 1.2807e+2 +C_11,T^4: -4.6114e-2 + +C_12: 241.74e+9 +C_12,T: 5.705e+7 +C_12,T^2: 0.4511e+5 +C_12,T^3: -0.4860e+2 +C_12,T^4: 1.446e-2 + +C_44: 77.65e+9 +C_44,T: -1.342e+7 +C_44,T^2: -0.1493e+5 +C_44,T^3: 0.1260e+2 +C_44,T^4: -0.6470e-2 + +T_ref: 0 diff --git a/examples/config/phase/mechanical/plastic/phenopowerlaw_Pt-5%Cu.yaml b/examples/config/phase/mechanical/plastic/phenopowerlaw_Pt-5%Cu.yaml new file mode 100644 index 000000000..41b933935 --- /dev/null +++ b/examples/config/phase/mechanical/plastic/phenopowerlaw_Pt-5%Cu.yaml @@ -0,0 +1,16 @@ +type: phenopowerlaw +references: +- K.M. Jackson and C. Lang, + Platinum Metals Review 50:15-19, 2006, + https://doi.org/10.1595/147106705X93359, + fitted from Fig. 5 (Pt-5% Cu recrystallised) + +N_sl: [12] + +n_sl: 1.6 +a_sl: 0.8 +h_0_sl-sl: 300.0e+6 +xi_0_sl: [150.0e+6] +xi_inf_sl: [500.0e+6] +h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4] +dot_gamma_0_sl: 0.0001 From cda6e0af358f851088af122c747e2e269502733b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 13 May 2022 11:44:02 +0200 Subject: [PATCH 124/142] some difference to pure Ni --- .../phase/mechanical/elastic/Hooke_IN625.yaml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 examples/config/phase/mechanical/elastic/Hooke_IN625.yaml diff --git a/examples/config/phase/mechanical/elastic/Hooke_IN625.yaml b/examples/config/phase/mechanical/elastic/Hooke_IN625.yaml new file mode 100644 index 000000000..5230994c3 --- /dev/null +++ b/examples/config/phase/mechanical/elastic/Hooke_IN625.yaml @@ -0,0 +1,21 @@ +type: Hooke + +references: + - Wang et al., + Materials Science and Engineering:A 674:406-412, 2016, + https://doi.org/10.1016/j.msea.2016.08.010, + fitted to Tab. 2 (last 3 rows) + +C_11: 243.3e+9 +C_11,T: -6.380e+5 +C_11,T^2: -8.362e+4 + +C_12: 156.7e+9 +C_12,T: 2.091e+7 +C_12,T^2: -4.675e+4 + +C_44: 99.3e+9 +C_44,T: -3.800e+7 +C_44,T^2: 1.587e+4 + +T_ref: 293.15 From 3f85027b9ec1dc07eaaa3778b88c0b3ddc9e2829 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 12 May 2022 16:45:42 +0200 Subject: [PATCH 125/142] better use SIGINT for actions triggered by the user SIGTERM is send by MPI if one process fails, catching it results in deadlocks --- PRIVATE | 2 +- src/C_routines.c | 4 ++-- src/grid/DAMASK_grid.f90 | 2 +- src/signals.f90 | 24 ++++++++++++------------ src/system_routines.f90 | 6 +++--- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/PRIVATE b/PRIVATE index 3561f74a5..df33ba9a1 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 3561f74a5852c32e2c3da4dc48090b517cfa8e90 +Subproject commit df33ba9a1360439c5c18a241a1e439dab0cdcafd diff --git a/src/C_routines.c b/src/C_routines.c index a25fde688..37364543d 100644 --- a/src/C_routines.c +++ b/src/C_routines.c @@ -58,8 +58,8 @@ void getusername_c(char username[], int *stat){ } -void signalterm_c(void (*handler)(int)){ - signal(SIGTERM, handler); +void signalint_c(void (*handler)(int)){ + signal(SIGINT, handler); } void signalusr1_c(void (*handler)(int)){ diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index 835e18b34..824d867c5 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -471,7 +471,7 @@ program DAMASK_grid call materialpoint_restartWrite endif if (signal) call signals_setSIGUSR2(.false.) - call MPI_Allreduce(signals_SIGTERM,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI) + call MPI_Allreduce(signals_SIGINT,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI) if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' if (signal) exit loadCaseLooping endif skipping diff --git a/src/signals.f90 b/src/signals.f90 index a3eac8025..7db101f94 100644 --- a/src/signals.f90 +++ b/src/signals.f90 @@ -10,13 +10,13 @@ module signals private logical, volatile, public, protected :: & - signals_SIGTERM = .false., & !< termination signal + signals_SIGINT = .false., & !< interrupt signal signals_SIGUSR1 = .false., & !< 1. user-defined signal signals_SIGUSR2 = .false. !< 2. user-defined signal public :: & signals_init, & - signals_setSIGTERM, & + signals_setSIGINT, & signals_setSIGUSR1, & signals_setSIGUSR2 @@ -28,7 +28,7 @@ contains !-------------------------------------------------------------------------------------------------- subroutine signals_init() - call signalterm_c(c_funloc(catchSIGTERM)) + call signalint_c(c_funloc(catchSIGINT)) call signalusr1_c(c_funloc(catchSIGUSR1)) call signalusr2_c(c_funloc(catchSIGUSR2)) @@ -36,18 +36,18 @@ end subroutine signals_init !-------------------------------------------------------------------------------------------------- -!> @brief Set global variable signals_SIGTERM to .true. +!> @brief Set global variable signals_SIGINT to .true. !> @details This function can be registered to catch signals send to the executable. !-------------------------------------------------------------------------------------------------- -subroutine catchSIGTERM(signal) bind(C) +subroutine catchSIGINT(signal) bind(C) integer(C_INT), value :: signal print'(a,i0)', ' received signal ',signal - call signals_setSIGTERM(.true.) + call signals_setSIGINT(.true.) -end subroutine catchSIGTERM +end subroutine catchSIGINT !-------------------------------------------------------------------------------------------------- @@ -81,17 +81,17 @@ end subroutine catchSIGUSR2 !-------------------------------------------------------------------------------------------------- -!> @brief Set global variable signals_SIGTERM. +!> @brief Set global variable signals_SIGINT. !-------------------------------------------------------------------------------------------------- -subroutine signals_setSIGTERM(state) +subroutine signals_setSIGINT(state) logical, intent(in) :: state - signals_SIGTERM = state - print*, 'set SIGTERM to',state + signals_SIGINT = state + print*, 'set SIGINT to',state -end subroutine signals_setSIGTERM +end subroutine signals_setSIGINT !-------------------------------------------------------------------------------------------------- diff --git a/src/system_routines.f90 b/src/system_routines.f90 index e0adf9dc0..2af1e12a9 100644 --- a/src/system_routines.f90 +++ b/src/system_routines.f90 @@ -15,7 +15,7 @@ module system_routines getCWD, & getHostName, & getUserName, & - signalterm_C, & + signalint_C, & signalusr1_C, & signalusr2_C, & f_c_string, & @@ -55,11 +55,11 @@ module system_routines integer(C_INT), intent(out) :: stat end subroutine getUserName_C - subroutine signalterm_C(handler) bind(C) + subroutine signalint_C(handler) bind(C) use, intrinsic :: ISO_C_Binding, only: C_FUNPTR type(C_FUNPTR), intent(in), value :: handler - end subroutine signalterm_C + end subroutine signalint_C subroutine signalusr1_C(handler) bind(C) use, intrinsic :: ISO_C_Binding, only: C_FUNPTR From 1448719e6badb62222da78280e522656652fd7a7 Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 13 May 2022 16:35:24 +0200 Subject: [PATCH 126/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-346-gd83f0acf7 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 2ff635946..701a06286 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-343-gc8d48d6eb +3.0.0-alpha6-346-gd83f0acf7 From b9fd6329daa975cdb153e5fcaa8b02b5f03c2eab Mon Sep 17 00:00:00 2001 From: Test User Date: Sat, 14 May 2022 21:07:33 +0200 Subject: [PATCH 127/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-351-gc9d7cf405 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 701a06286..f1bc4ad9a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-346-gd83f0acf7 +3.0.0-alpha6-351-gc9d7cf405 From 10e849801662f72e525453362fb0aaa8bdbf2b71 Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 16 May 2022 02:43:09 +0200 Subject: [PATCH 128/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-355-g6c7f2344d --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index f1bc4ad9a..d918fb5b1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-351-gc9d7cf405 +3.0.0-alpha6-355-g6c7f2344d From b3992e0ff01c26236bab9a32071fb47e03fe29e1 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 16 May 2022 23:16:23 +0200 Subject: [PATCH 129/142] test new example files --- PRIVATE | 2 +- .../mechanical/plastic/phenopowerlaw_Pt-5%Cu.yaml | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/PRIVATE b/PRIVATE index ede67b648..1766c855e 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit ede67b6488f0a0a116fe5aa8b36980d11e0f29e7 +Subproject commit 1766c855e54668d6225c9b22db536be7052605bc diff --git a/examples/config/phase/mechanical/plastic/phenopowerlaw_Pt-5%Cu.yaml b/examples/config/phase/mechanical/plastic/phenopowerlaw_Pt-5%Cu.yaml index 41b933935..864237825 100644 --- a/examples/config/phase/mechanical/plastic/phenopowerlaw_Pt-5%Cu.yaml +++ b/examples/config/phase/mechanical/plastic/phenopowerlaw_Pt-5%Cu.yaml @@ -1,9 +1,13 @@ type: phenopowerlaw + references: -- K.M. Jackson and C. Lang, - Platinum Metals Review 50:15-19, 2006, - https://doi.org/10.1595/147106705X93359, - fitted from Fig. 5 (Pt-5% Cu recrystallised) + - K.M. Jackson and C. Lang, + Platinum Metals Review 50:15-19, 2006, + https://doi.org/10.1595/147106705X93359, + fitted from Fig. 5 (Pt-5% Cu recrystallised) + - U.F. Kocks, + Metallurgical and Materials Transactions B 1:1121–1143, 1970, + https://doi.org/10.1007/BF02900224 N_sl: [12] From 0f1d0cbd61d3650038d0a825625acbc5ae5a4c59 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 17 May 2022 08:53:32 +0200 Subject: [PATCH 130/142] copy and paste error --- examples/config/phase/mechanical/elastic/Hooke_IN625.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/config/phase/mechanical/elastic/Hooke_IN625.yaml b/examples/config/phase/mechanical/elastic/Hooke_IN625.yaml index 5230994c3..1411de6f4 100644 --- a/examples/config/phase/mechanical/elastic/Hooke_IN625.yaml +++ b/examples/config/phase/mechanical/elastic/Hooke_IN625.yaml @@ -14,7 +14,7 @@ C_12: 156.7e+9 C_12,T: 2.091e+7 C_12,T^2: -4.675e+4 -C_44: 99.3e+9 +C_44: 117.8e+9 C_44,T: -3.800e+7 C_44,T^2: 1.587e+4 From 6a870d72a5a5dd65f049ba97781a680c567fdc66 Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 17 May 2022 13:59:25 +0200 Subject: [PATCH 131/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-362-g0ce280cc5 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index d918fb5b1..5890b17a3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-355-g6c7f2344d +3.0.0-alpha6-362-g0ce280cc5 From 2a2324266ce9517354ef51db54700200d552eaf2 Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 17 May 2022 19:35:47 +0200 Subject: [PATCH 132/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-367-g85fa92ee1 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 5890b17a3..73aee9b3f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-362-g0ce280cc5 +3.0.0-alpha6-367-g85fa92ee1 From 8442f0cdd3cdeb4ebeac1809a9db6941d9cf9dd6 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 17 May 2022 16:12:00 -0400 Subject: [PATCH 133/142] accumulate comments --- python/damask/_vtk.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/damask/_vtk.py b/python/damask/_vtk.py index aa0be4dea..6baa16214 100644 --- a/python/damask/_vtk.py +++ b/python/damask/_vtk.py @@ -468,13 +468,13 @@ class VTK: _add_array(dup.vtk_data, label, np.where(data.mask,data.fill_value,data) if isinstance(data,np.ma.MaskedArray) else data) - if info is not None: dup.comments = f'{label}: {info}' + if info is not None: dup.comments += f'{label}: {info}' else: raise ValueError('no label defined for data') elif isinstance(table,Table): for l in table.labels: _add_array(dup.vtk_data,l,table.get(l)) - if info is not None: dup.comments = f'{l}: {info}' + if info is not None: dup.comments += f'{l}: {info}' else: raise TypeError From 0962d2ebdf292bdef271dc2573099fe2226741c4 Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 18 May 2022 03:17:26 +0200 Subject: [PATCH 134/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-371-g18d862cdb --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 73aee9b3f..435d3544f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-367-g85fa92ee1 +3.0.0-alpha6-371-g18d862cdb From 556d9d840e7fbfeb73974249a5da2ac423a56200 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 17 May 2022 23:56:05 +0200 Subject: [PATCH 135/142] specifying V_e is more natural than F_i --- PRIVATE | 2 +- python/damask/_configmaterial.py | 6 +- python/tests/test_ConfigMaterial.py | 6 +- src/IO.f90 | 2 + src/material.f90 | 10 ++-- src/phase_mechanical.f90 | 89 +++++++++++++++-------------- src/rotations.f90 | 9 ++- 7 files changed, 64 insertions(+), 60 deletions(-) diff --git a/PRIVATE b/PRIVATE index 1766c855e..d2c229e6d 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 1766c855e54668d6225c9b22db536be7052605bc +Subproject commit d2c229e6dd81fb399b2c1b0658b750f7d309f175 diff --git a/python/damask/_configmaterial.py b/python/damask/_configmaterial.py index 725567b7f..7a06a2c69 100644 --- a/python/damask/_configmaterial.py +++ b/python/damask/_configmaterial.py @@ -482,7 +482,7 @@ class ConfigMaterial(Config): """ N,n,shaped = 1,1,{} - map_dim = {'O':-1,'F_i':-2} + map_dim = {'O':-1,'V_e':-2} for k,v in kwargs.items(): shaped[k] = np.array(v) s = shaped[k].shape[:map_dim.get(k,None)] @@ -494,12 +494,12 @@ class ConfigMaterial(Config): if 'v' not in kwargs: shaped['v'] = np.broadcast_to(1/n,(N,n)) - map_shape = {'O':(N,n,4),'F_i':(N,n,3,3)} + map_shape = {'O':(N,n,4),'V_e':(N,n,3,3)} for k,v in shaped.items(): target = map_shape.get(k,(N,n)) obj = np.broadcast_to(v.reshape(util.shapeshifter(v.shape, target, mode = 'right')), target) for i in range(N): - if k in ['phase','O','v','F_i']: + if k in ['phase','O','v','V_e']: for j in range(n): mat[i]['constituents'][j][k] = obj[i,j].item() if isinstance(obj[i,j],np.generic) else obj[i,j] else: diff --git a/python/tests/test_ConfigMaterial.py b/python/tests/test_ConfigMaterial.py index d3ea986c5..f003e254e 100644 --- a/python/tests/test_ConfigMaterial.py +++ b/python/tests/test_ConfigMaterial.py @@ -113,15 +113,15 @@ class TestConfigMaterial: @pytest.mark.parametrize('N,n,kw',[ (1,1,{'phase':'Gold', 'O':[1,0,0,0], - 'F_i':np.eye(3), + 'V_e':np.eye(3), 'homogenization':'SX'}), (3,1,{'phase':'Gold', 'O':Rotation.from_random(3), - 'F_i':np.broadcast_to(np.eye(3),(3,3,3)), + 'V_e':np.broadcast_to(np.eye(3),(3,3,3)), 'homogenization':'SX'}), (2,3,{'phase':np.broadcast_to(['a','b','c'],(2,3)), 'O':Rotation.from_random((2,3)), - 'F_i':np.broadcast_to(np.eye(3),(2,3,3,3)), + 'V_e':np.broadcast_to(np.eye(3),(2,3,3,3)), 'homogenization':['SX','PX']}), ]) def test_material_add(self,kw,N,n): diff --git a/src/IO.f90 b/src/IO.f90 index 240c9e992..047d11add 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -428,6 +428,8 @@ subroutine IO_error(error_ID,el,ip,g,instance,ext_msg) msg = 'too many systems requested' case (146) msg = 'number of values does not match' + case (147) + msg = 'V_e needs to be symmetric' case (148) msg = 'Nconstituents mismatch between homogenization and material' diff --git a/src/material.f90 b/src/material.f90 index 2258c40a1..ce4cabea9 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -27,7 +27,7 @@ module material type(tRotationContainer), dimension(:), allocatable, public, protected :: material_O_0 - type(tTensorContainer), dimension(:), allocatable, public, protected :: material_F_i_0 + type(tTensorContainer), dimension(:), allocatable, public, protected :: material_V_e_0 integer, dimension(:), allocatable, public, protected :: & homogenization_Nconstituents !< number of grains in each homogenization @@ -133,7 +133,7 @@ subroutine parse() allocate(material_v(homogenization_maxNconstituents,discretization_Ncells),source=0.0_pReal) allocate(material_O_0(materials%length)) - allocate(material_F_i_0(materials%length)) + allocate(material_V_e_0(materials%length)) allocate(ho_of(materials%length)) allocate(ph_of(materials%length,homogenization_maxNconstituents),source=-1) @@ -154,7 +154,7 @@ subroutine parse() if (constituents%length /= homogenization%get_asInt('N_constituents')) call IO_error(148) allocate(material_O_0(ma)%data(constituents%length)) - allocate(material_F_i_0(ma)%data(1:3,1:3,constituents%length)) + allocate(material_V_e_0(ma)%data(1:3,1:3,constituents%length)) do co = 1, constituents%length constituent => constituents%get(co) @@ -162,7 +162,9 @@ subroutine parse() ph_of(ma,co) = phases%getIndex(constituent%get_asString('phase')) call material_O_0(ma)%data(co)%fromQuaternion(constituent%get_as1dFloat('O',requiredSize=4)) - material_F_i_0(ma)%data(1:3,1:3,co) = constituent%get_as2dFloat('F_i',defaultVal=math_I3,requiredShape=[3,3]) + material_V_e_0(ma)%data(1:3,1:3,co) = constituent%get_as2dFloat('V_e',defaultVal=math_I3,requiredShape=[3,3]) + if (any(dNeq(material_V_e_0(ma)%data(1:3,1:3,co),transpose(material_V_e_0(ma)%data(1:3,1:3,co))))) & + call IO_error(147) end do if (dNeq(sum(v_of(ma,:)),1.0_pReal,1.e-9_pReal)) call IO_error(153,ext_msg='constituent') diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index fc9e40e02..bddd4775e 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -210,7 +210,6 @@ module subroutine mechanical_init(phases) Nmembers class(tNode), pointer :: & num_crystallite, & - phase, & mech @@ -239,11 +238,8 @@ module subroutine mechanical_init(phases) allocate(phase_mechanical_Fe(ph)%data(3,3,Nmembers)) allocate(phase_mechanical_Fi(ph)%data(3,3,Nmembers)) - allocate(phase_mechanical_Fi0(ph)%data(3,3,Nmembers)) allocate(phase_mechanical_Fp(ph)%data(3,3,Nmembers)) - allocate(phase_mechanical_Fp0(ph)%data(3,3,Nmembers)) allocate(phase_mechanical_F(ph)%data(3,3,Nmembers)) - allocate(phase_mechanical_F0(ph)%data(3,3,Nmembers)) allocate(phase_mechanical_Li(ph)%data(3,3,Nmembers),source=0.0_pReal) allocate(phase_mechanical_Li0(ph)%data(3,3,Nmembers),source=0.0_pReal) allocate(phase_mechanical_Lp(ph)%data(3,3,Nmembers),source=0.0_pReal) @@ -265,23 +261,21 @@ module subroutine mechanical_init(phases) ma = discretization_materialAt((ce-1)/discretization_nIPs+1) do co = 1,homogenization_Nconstituents(material_homogenizationID(ce)) ph = material_phaseID(co,ce) - phase_mechanical_Fi0(ph)%data(1:3,1:3,material_phaseEntry(co,ce)) = material_F_i_0(ma)%data(1:3,1:3,co) + en = material_phaseEntry(co,ce) + phase_mechanical_F(ph)%data(1:3,1:3,en) = math_I3 + phase_mechanical_Fp(ph)%data(1:3,1:3,en) = material_O_0(ma)%data(co)%asMatrix() ! Fp reflects initial orientation (see 10.1016/j.actamat.2006.01.005) + phase_mechanical_Fp(ph)%data(1:3,1:3,en) = phase_mechanical_Fp(ph)%data(1:3,1:3,en) & + / math_det33(phase_mechanical_Fp(ph)%data(1:3,1:3,en))**(1.0_pReal/3.0_pReal) + phase_mechanical_Fe(ph)%data(1:3,1:3,en) = matmul(material_V_e_0(ma)%data(1:3,1:3,co), & + transpose(phase_mechanical_Fp(ph)%data(1:3,1:3,en))) + phase_mechanical_Fi(ph)%data(1:3,1:3,en) = material_O_0(ma)%data(co)%rotate(math_inv33(material_V_e_0(ma)%data(1:3,1:3,co))) enddo enddo do ph = 1, phases%length - do en = 1, count(material_phaseID == ph) - - phase_mechanical_Fp0(ph)%data(1:3,1:3,en) = phase_O_0(ph)%data(en)%asMatrix() ! Fp reflects initial orientation (see 10.1016/j.actamat.2006.01.005) - phase_mechanical_Fp0(ph)%data(1:3,1:3,en) = phase_mechanical_Fp0(ph)%data(1:3,1:3,en) & - / math_det33(phase_mechanical_Fp0(ph)%data(1:3,1:3,en))**(1.0_pReal/3.0_pReal) - phase_mechanical_F0(ph)%data(1:3,1:3,en) = math_I3 - phase_mechanical_Fe(ph)%data(1:3,1:3,en) = math_inv33(matmul(phase_mechanical_Fi0(ph)%data(1:3,1:3,en), & - phase_mechanical_Fp0(ph)%data(1:3,1:3,en))) ! assuming that euler angles are given in internal strain free configuration - enddo - phase_mechanical_Fp(ph)%data = phase_mechanical_Fp0(ph)%data - phase_mechanical_Fi(ph)%data = phase_mechanical_Fi0(ph)%data - phase_mechanical_F(ph)%data = phase_mechanical_F0(ph)%data + phase_mechanical_F0(ph)%data = phase_mechanical_F(ph)%data + phase_mechanical_Fp0(ph)%data = phase_mechanical_Fp(ph)%data + phase_mechanical_Fi0(ph)%data = phase_mechanical_Fi(ph)%data enddo @@ -318,7 +312,6 @@ module subroutine mechanical_init(phases) end select - call eigen_init(phases) @@ -1244,6 +1237,9 @@ module function phase_mechanical_dPdF(Delta_t,co,ce) result(dPdF) end function phase_mechanical_dPdF +!-------------------------------------------------------------------------------------------------- +!< @brief Write restart information to file. +!-------------------------------------------------------------------------------------------------- module subroutine mechanical_restartWrite(groupHandle,ph) integer(HID_T), intent(in) :: groupHandle @@ -1251,36 +1247,41 @@ module subroutine mechanical_restartWrite(groupHandle,ph) call HDF5_write(plasticState(ph)%state,groupHandle,'omega_plastic') - call HDF5_write(phase_mechanical_Fi(ph)%data,groupHandle,'F_i') - call HDF5_write(phase_mechanical_Li(ph)%data,groupHandle,'L_i') - call HDF5_write(phase_mechanical_Lp(ph)%data,groupHandle,'L_p') - call HDF5_write(phase_mechanical_Fp(ph)%data,groupHandle,'F_p') call HDF5_write(phase_mechanical_S(ph)%data,groupHandle,'S') call HDF5_write(phase_mechanical_F(ph)%data,groupHandle,'F') + call HDF5_write(phase_mechanical_Fp(ph)%data,groupHandle,'F_p') + call HDF5_write(phase_mechanical_Fi(ph)%data,groupHandle,'F_i') + call HDF5_write(phase_mechanical_Lp(ph)%data,groupHandle,'L_p') + call HDF5_write(phase_mechanical_Li(ph)%data,groupHandle,'L_i') end subroutine mechanical_restartWrite +!-------------------------------------------------------------------------------------------------- +!< @brief Read restart information from file. +!-------------------------------------------------------------------------------------------------- module subroutine mechanical_restartRead(groupHandle,ph) integer(HID_T), intent(in) :: groupHandle integer, intent(in) :: ph + integer :: en + call HDF5_read(plasticState(ph)%state0,groupHandle,'omega_plastic') - call HDF5_read(phase_mechanical_Fi0(ph)%data,groupHandle,'F_i') - call HDF5_read(phase_mechanical_Li0(ph)%data,groupHandle,'L_i') - call HDF5_read(phase_mechanical_Lp0(ph)%data,groupHandle,'L_p') - call HDF5_read(phase_mechanical_Fp0(ph)%data,groupHandle,'F_p') call HDF5_read(phase_mechanical_S0(ph)%data,groupHandle,'S') call HDF5_read(phase_mechanical_F0(ph)%data,groupHandle,'F') + call HDF5_read(phase_mechanical_Fp0(ph)%data,groupHandle,'F_p') + call HDF5_read(phase_mechanical_Fi0(ph)%data,groupHandle,'F_i') + call HDF5_read(phase_mechanical_Lp0(ph)%data,groupHandle,'L_p') + call HDF5_read(phase_mechanical_Li0(ph)%data,groupHandle,'L_i') end subroutine mechanical_restartRead -!---------------------------------------------------------------------------------------------- -!< @brief Get first Piola-Kichhoff stress (for use by non-mech physics) -!---------------------------------------------------------------------------------------------- +!-------------------------------------------------------------------------------------------------- +!< @brief Get first Piola-Kichhoff stress (for use by non-mech physics). +!-------------------------------------------------------------------------------------------------- module function mechanical_S(ph,en) result(S) integer, intent(in) :: ph,en @@ -1292,9 +1293,9 @@ module function mechanical_S(ph,en) result(S) end function mechanical_S -!---------------------------------------------------------------------------------------------- -!< @brief Get plastic velocity gradient (for use by non-mech physics) -!---------------------------------------------------------------------------------------------- +!-------------------------------------------------------------------------------------------------- +!< @brief Get plastic velocity gradient (for use by non-mech physics). +!-------------------------------------------------------------------------------------------------- module function mechanical_L_p(ph,en) result(L_p) integer, intent(in) :: ph,en @@ -1306,9 +1307,9 @@ module function mechanical_L_p(ph,en) result(L_p) end function mechanical_L_p -!---------------------------------------------------------------------------------------------- -!< @brief Get elastic deformation gradient (for use by non-mech physics) -!---------------------------------------------------------------------------------------------- +!-------------------------------------------------------------------------------------------------- +!< @brief Get elastic deformation gradient (for use by non-mech physics). +!-------------------------------------------------------------------------------------------------- module function mechanical_F_e(ph,en) result(F_e) integer, intent(in) :: ph,en @@ -1320,9 +1321,9 @@ module function mechanical_F_e(ph,en) result(F_e) end function mechanical_F_e -!---------------------------------------------------------------------------------------------- -!< @brief Get second Piola-Kichhoff stress (for use by homogenization) -!---------------------------------------------------------------------------------------------- +!-------------------------------------------------------------------------------------------------- +!< @brief Get second Piola-Kichhoff stress (for use by homogenization). +!-------------------------------------------------------------------------------------------------- module function phase_P(co,ce) result(P) integer, intent(in) :: co, ce @@ -1334,9 +1335,9 @@ module function phase_P(co,ce) result(P) end function phase_P -!---------------------------------------------------------------------------------------------- -!< @brief Get deformation gradient (for use by homogenization) -!---------------------------------------------------------------------------------------------- +!-------------------------------------------------------------------------------------------------- +!< @brief Get deformation gradient (for use by homogenization). +!-------------------------------------------------------------------------------------------------- module function phase_F(co,ce) result(F) integer, intent(in) :: co, ce @@ -1348,9 +1349,9 @@ module function phase_F(co,ce) result(F) end function phase_F -!---------------------------------------------------------------------------------------------- -!< @brief Set deformation gradient (for use by homogenization) -!---------------------------------------------------------------------------------------------- +!-------------------------------------------------------------------------------------------------- +!< @brief Set deformation gradient (for use by homogenization). +!-------------------------------------------------------------------------------------------------- module subroutine phase_set_F(F,co,ce) real(pReal), dimension(3,3), intent(in) :: F diff --git a/src/rotations.f90 b/src/rotations.f90 index 7aa81fcab..3340bf2a0 100644 --- a/src/rotations.f90 +++ b/src/rotations.f90 @@ -323,17 +323,16 @@ pure function rotTensor2(self,T,active) result(tRot) logical :: passive + if (present(active)) then passive = .not. active else passive = .true. endif - if (passive) then - tRot = matmul(matmul(self%asMatrix(),T),transpose(self%asMatrix())) - else - tRot = matmul(matmul(transpose(self%asMatrix()),T),self%asMatrix()) - endif + tRot = merge(matmul(matmul(self%asMatrix(),T),transpose(self%asMatrix())), & + matmul(matmul(transpose(self%asMatrix()),T),self%asMatrix()), & + passive) end function rotTensor2 From 41a732f62df0ab2e3538156801b405f35a8f3244 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 19 May 2022 16:36:50 +0200 Subject: [PATCH 136/142] assumed rank solution gives wrong results #194 --- src/HDF5_utilities.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/HDF5_utilities.f90 b/src/HDF5_utilities.f90 index 86807507b..fcd2c189a 100644 --- a/src/HDF5_utilities.f90 +++ b/src/HDF5_utilities.f90 @@ -48,7 +48,7 @@ module HDF5_utilities !> @details for parallel IO, all dimension except for the last need to match !-------------------------------------------------------------------------------------------------- interface HDF5_write -#if defined(__GFORTRAN__) && __GNUC__<11 +#if defined(__GFORTRAN__) module procedure HDF5_write_real1 module procedure HDF5_write_real2 module procedure HDF5_write_real3 @@ -1214,7 +1214,7 @@ subroutine HDF5_read_int7(dataset,loc_id,datasetName,parallel) end subroutine HDF5_read_int7 -#if defined(__GFORTRAN__) && __GNUC__<11 +#if defined(__GFORTRAN__) !-------------------------------------------------------------------------------------------------- !> @brief write dataset of type real with 1 dimension @@ -1631,7 +1631,7 @@ subroutine HDF5_write_str(dataset,loc_id,datasetName) end subroutine HDF5_write_str -#if defined(__GFORTRAN__) && __GNUC__<11 +#if defined(__GFORTRAN__) !-------------------------------------------------------------------------------------------------- !> @brief write dataset of type integer with 1 dimension From d2b493765c671713c28d9175090880d108b47462 Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 19 May 2022 22:42:33 +0200 Subject: [PATCH 137/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-373-g41a732f62 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 435d3544f..07abc66a1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-371-g18d862cdb +3.0.0-alpha6-373-g41a732f62 From 491e2ec0b2b963353e09347c38383c78710477fa Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 20 May 2022 06:30:07 +0200 Subject: [PATCH 138/142] avoid negative zero when not needed --- src/material.f90 | 2 +- src/rotations.f90 | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/material.f90 b/src/material.f90 index ce4cabea9..eafc411cd 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -164,7 +164,7 @@ subroutine parse() call material_O_0(ma)%data(co)%fromQuaternion(constituent%get_as1dFloat('O',requiredSize=4)) material_V_e_0(ma)%data(1:3,1:3,co) = constituent%get_as2dFloat('V_e',defaultVal=math_I3,requiredShape=[3,3]) if (any(dNeq(material_V_e_0(ma)%data(1:3,1:3,co),transpose(material_V_e_0(ma)%data(1:3,1:3,co))))) & - call IO_error(147) + call IO_error(147) end do if (dNeq(sum(v_of(ma,:)),1.0_pReal,1.e-9_pReal)) call IO_error(153,ext_msg='constituent') diff --git a/src/rotations.f90 b/src/rotations.f90 index 3340bf2a0..6257fe7e4 100644 --- a/src/rotations.f90 +++ b/src/rotations.f90 @@ -574,7 +574,7 @@ end function qu2cu !--------------------------------------------------------------------------------------------------- !> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH -!> @brief convert rotation matrix to cubochoric +!> @brief convert rotation matrix to unit quaternion !> @details the original formulation (direct conversion) had (numerical?) issues !--------------------------------------------------------------------------------------------------- pure function om2qu(om) result(qu) @@ -601,14 +601,14 @@ pure function om2qu(om) result(qu) endif endif if(sign(1.0_pReal,qu(1))<0.0_pReal) qu =-1.0_pReal * qu - qu = qu*[1.0_pReal,P,P,P] + qu(2:4) = merge(qu(2:4),qu(2:4)*P,dEq0(qu(2:4))) end function om2qu !--------------------------------------------------------------------------------------------------- !> @author Marc De Graef, Carnegie Mellon University -!> @brief orientation matrix to Euler angles +!> @brief convert orientation matrix to Euler angles !> @details Two step check for special cases to avoid invalid operations (not needed for python) !--------------------------------------------------------------------------------------------------- pure function om2eu(om) result(eu) @@ -1333,8 +1333,8 @@ pure function cu2ho(cu) result(ho) ! transform to sphere grid (inverse Lambert) ! [note that there is no need to worry about dividing by zero, since XYZ(3) can not become zero] c = sum(T**2) - s = PI * c/(24.0*XYZ(3)**2) - c = sqrt(PI) * c / sqrt(24.0_pReal) / XYZ(3) + s = c * PI/(24.0*XYZ(3)**2) + c = c * sqrt(PI/24.0_pReal) / XYZ(3) q = sqrt( 1.0 - s ) LamXYZ = [ T(order(2)) * q, T(order(1)) * q, PREF * XYZ(3) - c ] end if special From f42bb5d1755a77ea02a9d34a42fdff68b2746fef Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 20 May 2022 06:43:32 +0200 Subject: [PATCH 139/142] mitigate rounding errors --- src/phase_mechanical.f90 | 2 -- src/rotations.f90 | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index bddd4775e..88b86a8d9 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -264,8 +264,6 @@ module subroutine mechanical_init(phases) en = material_phaseEntry(co,ce) phase_mechanical_F(ph)%data(1:3,1:3,en) = math_I3 phase_mechanical_Fp(ph)%data(1:3,1:3,en) = material_O_0(ma)%data(co)%asMatrix() ! Fp reflects initial orientation (see 10.1016/j.actamat.2006.01.005) - phase_mechanical_Fp(ph)%data(1:3,1:3,en) = phase_mechanical_Fp(ph)%data(1:3,1:3,en) & - / math_det33(phase_mechanical_Fp(ph)%data(1:3,1:3,en))**(1.0_pReal/3.0_pReal) phase_mechanical_Fe(ph)%data(1:3,1:3,en) = matmul(material_V_e_0(ma)%data(1:3,1:3,co), & transpose(phase_mechanical_Fp(ph)%data(1:3,1:3,en))) phase_mechanical_Fi(ph)%data(1:3,1:3,en) = material_O_0(ma)%data(co)%rotate(math_inv33(material_V_e_0(ma)%data(1:3,1:3,co))) diff --git a/src/rotations.f90 b/src/rotations.f90 index 6257fe7e4..5367f2c07 100644 --- a/src/rotations.f90 +++ b/src/rotations.f90 @@ -449,6 +449,7 @@ pure function qu2om(qu) result(om) om(1,3) = 2.0_pReal*(qu(2)*qu(4)+qu(1)*qu(3)) if (sign(1.0_pReal,P) < 0.0_pReal) om = transpose(om) + om = om/math_det33(om)**(1.0_pReal/3.0_pReal) end function qu2om @@ -602,6 +603,7 @@ pure function om2qu(om) result(qu) endif if(sign(1.0_pReal,qu(1))<0.0_pReal) qu =-1.0_pReal * qu qu(2:4) = merge(qu(2:4),qu(2:4)*P,dEq0(qu(2:4))) + qu = qu/norm2(qu) end function om2qu From ad6cd12a18669caad0d11380fecb71bc50240963 Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 20 May 2022 18:36:34 +0200 Subject: [PATCH 140/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-379-g119f8c484 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 07abc66a1..d6c405825 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-373-g41a732f62 +3.0.0-alpha6-379-g119f8c484 From d2c072604a7b948c82ae48af99be3736c0ae5f78 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 21 May 2022 09:23:44 +0200 Subject: [PATCH 141/142] missing update of PRIVATE --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index d2c229e6d..0e82975b2 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit d2c229e6dd81fb399b2c1b0658b750f7d309f175 +Subproject commit 0e82975b23a1bd4310c523388f1cadf1b8e03dd0 From 4d17adb1bfab5563785b7f650df1bb93b813129e Mon Sep 17 00:00:00 2001 From: Test User Date: Sat, 21 May 2022 11:19:40 +0200 Subject: [PATCH 142/142] [skip ci] updated version information after successful test of v3.0.0-alpha6-381-gd2c072604 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index d6c405825..323a6d77e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha6-379-g119f8c484 +3.0.0-alpha6-381-gd2c072604