From faa83468d5ebea9bc29789fc4bc85505b2bd49db Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 23 Nov 2020 20:44:17 +0100 Subject: [PATCH 01/14] unclear behavior in case of unsorted coordinates similar (tested and flexible) functionality is available in numpy/scipy --- processing/post/addDerivative.py | 74 -------------------------------- 1 file changed, 74 deletions(-) delete mode 100755 processing/post/addDerivative.py diff --git a/processing/post/addDerivative.py b/processing/post/addDerivative.py deleted file mode 100755 index 99016f4ef..000000000 --- a/processing/post/addDerivative.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys -from io import StringIO -from optparse import OptionParser - -import numpy as np - -import damask - - -scriptName = os.path.splitext(os.path.basename(__file__))[0] -scriptID = ' '.join([scriptName,damask.version]) - -def derivative(coordinates,what): - - result = np.empty_like(what) - - # use differentiation by interpolation - # as described in http://www2.math.umd.edu/~dlevy/classes/amsc466/lecture-notes/differentiation-chap.pdf - - result[1:-1,:] = + what[1:-1,:] * (2.*coordinates[1:-1]-coordinates[:-2]-coordinates[2:]) / \ - ((coordinates[1:-1]-coordinates[:-2])*(coordinates[1:-1]-coordinates[2:])) \ - + what[2:,:] * (coordinates[1:-1]-coordinates[:-2]) / \ - ((coordinates[2:]-coordinates[1:-1])*(coordinates[2:]-coordinates[:-2])) \ - + what[:-2,:] * (coordinates[1:-1]-coordinates[2:]) / \ - ((coordinates[:-2]-coordinates[1:-1])*(coordinates[:-2]-coordinates[2:])) \ - - result[0,:] = (what[0,:] - what[1,:]) / \ - (coordinates[0] - coordinates[1]) - result[-1,:] = (what[-1,:] - what[-2,:]) / \ - (coordinates[-1] - coordinates[-2]) - - return result - - -# -------------------------------------------------------------------- -# MAIN -# -------------------------------------------------------------------- - -parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [ASCIItable(s)]', description = """ -Add column(s) containing numerical derivative of requested column(s) with respect to given coordinates. - -""", version = scriptID) - -parser.add_option('-c','--coordinates', - dest = 'coordinates', - type = 'string', metavar='string', - help = 'heading of coordinate column') -parser.add_option('-l','--label', - dest = 'labels', - action = 'extend', metavar = '', - help = 'heading of column(s) to differentiate') - - -(options,filenames) = parser.parse_args() -if filenames == []: filenames = [None] - -if options.coordinates is None: - parser.error('no coordinate column specified.') -if options.labels is None: - parser.error('no data column specified.') - -for name in filenames: - damask.util.report(scriptName,name) - - table = damask.Table.load(StringIO(''.join(sys.stdin.read())) if name is None else name) - for label in options.labels: - table = table.add('d({})/d({})'.format(label,options.coordinates), - derivative(table.get(options.coordinates),table.get(label)), - scriptID+' '+' '.join(sys.argv[1:])) - - table.save((sys.stdout if name is None else name), legacy=True) From 5d2d92ff6b783ddfa206d92acc1be01a5e91e5e2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 23 Nov 2020 20:45:55 +0100 Subject: [PATCH 02/14] shell wrapper to library functions not needed anymore --- processing/post/addOrientations.py | 150 ----------------------------- 1 file changed, 150 deletions(-) delete mode 100755 processing/post/addOrientations.py diff --git a/processing/post/addOrientations.py b/processing/post/addOrientations.py deleted file mode 100755 index cb5361599..000000000 --- a/processing/post/addOrientations.py +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys -from io import StringIO -from optparse import OptionParser - -import numpy as np - -import damask - - -scriptName = os.path.splitext(os.path.basename(__file__))[0] -scriptID = ' '.join([scriptName,damask.version]) - -# -------------------------------------------------------------------- -# MAIN -# -------------------------------------------------------------------- - -parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [ASCIItable(s)]', description = """ -Add quaternion and/or Bunge Euler angle representation of crystal lattice orientation. -Orientation is given by quaternion, Euler angles, rotation matrix, or crystal frame coordinates -(i.e. component vectors of rotation matrix). -Additional (globally fixed) rotations of the lab frame and/or crystal frame can be applied. - -""", version = scriptID) - -representations = ['quaternion', 'rodrigues', 'eulers', 'matrix', 'axisangle'] - - -parser.add_option('-o', - '--output', - dest = 'output', - action = 'extend', metavar = '', - help = 'output orientation formats {{{}}}'.format(', '.join(representations))) -parser.add_option('-d', - '--degrees', - dest = 'degrees', - action = 'store_true', - help = 'all angles in degrees') -parser.add_option('-R', - '--labrotation', - dest='labrotation', - type = 'float', nargs = 4, metavar = ' '.join(['float']*4), - help = 'axis and angle of additional lab frame rotation [%default]') -parser.add_option('-r', - '--crystalrotation', - dest='crystalrotation', - type = 'float', nargs = 4, metavar = ' '.join(['float']*4), - help = 'axis and angle of additional crystal frame rotation [%default]') -parser.add_option('--eulers', - dest = 'eulers', - metavar = 'string', - help = 'Euler angles label') -parser.add_option('--rodrigues', - dest = 'rodrigues', - metavar = 'string', - help = 'Rodrigues vector label') -parser.add_option('--matrix', - dest = 'matrix', - metavar = 'string', - help = 'orientation matrix label') -parser.add_option('--quaternion', - dest = 'quaternion', - metavar = 'string', - help = 'quaternion label') -parser.add_option('-x', - dest = 'x', - metavar = 'string', - help = 'label of lab x vector (expressed in crystal coords)') -parser.add_option('-y', - dest = 'y', - metavar = 'string', - help = 'label of lab y vector (expressed in crystal coords)') -parser.add_option('-z', - dest = 'z', - metavar = 'string', - help = 'label of lab z vector (expressed in crystal coords)') -parser.add_option('--lattice', - dest = 'lattice', - metavar = 'string', - help = 'lattice structure to reduce rotation into fundamental zone') - -parser.set_defaults(output = [], - labrotation = (1.,1.,1.,0.), # no rotation about (1,1,1) - crystalrotation = (1.,1.,1.,0.), # no rotation about (1,1,1) - lattice = None, - ) - -(options, filenames) = parser.parse_args() -if filenames == []: filenames = [None] - -if options.output == [] or (not set(options.output).issubset(set(representations))): - parser.error('output must be chosen from {}.'.format(', '.join(representations))) - -input = [options.eulers is not None, - options.rodrigues is not None, - options.x is not None and \ - options.y is not None and \ - options.z is not None, - options.matrix is not None, - options.quaternion is not None, - ] - -if np.sum(input) != 1: parser.error('needs exactly one input format.') - -r = damask.Rotation.from_axis_angle(np.array(options.crystalrotation),options.degrees,normalize=True) -R = damask.Rotation.from_axis_angle(np.array(options.labrotation),options.degrees,normalize=True) - -for name in filenames: - damask.util.report(scriptName,name) - - table = damask.Table.load(StringIO(''.join(sys.stdin.read())) if name is None else name) - - if options.eulers is not None: - label = options.eulers - print(np.max(table.get(options.eulers),axis=0)) - o = damask.Rotation.from_Euler_angles(table.get(options.eulers), options.degrees) - elif options.rodrigues is not None: - label = options.rodrigues - o = damask.Rotation.from_Rodrigues_vector(table.get(options.rodrigues)) - elif options.matrix is not None: - label = options.matrix - o = damask.Rotation.from_matrix(table.get(options.matrix).reshape(-1,3,3)) - elif options.x is not None: - label = '<{},{},{}>'.format(options.x,options.y,options.z) - M = np.block([table.get(options.x),table.get(options.y),table.get(options.z)]).reshape(-1,3,3) - o = damask.Rotation.from_matrix(M/np.linalg.norm(M,axis=0)) - elif options.quaternion is not None: - label = options.quaternion - o = damask.Rotation.from_quaternion(table.get(options.quaternion)) - - o = r.broadcast_to(o.shape) @ o @ R.broadcast_to(o.shape) - - #if options.lattice is not None: - # o = damask.Orientation(rotation = o,lattice = options.lattice).reduced().rotation - - - if 'rodrigues' in options.output: - table = table.add('ro({})'.format(label),o.as_Rodrigues_vector(), scriptID+' '+' '.join(sys.argv[1:])) - if 'eulers' in options.output: - table = table.add('eu({})'.format(label),o.as_Euler_angles(options.degrees),scriptID+' '+' '.join(sys.argv[1:])) - if 'quaternion' in options.output: - table = table.add('qu({})'.format(label),o.as_quaternion(), scriptID+' '+' '.join(sys.argv[1:])) - if 'matrix' in options.output: - table = table.add('om({})'.format(label),o.as_matrix(), scriptID+' '+' '.join(sys.argv[1:])) - if 'axisangle' in options.output: - table = table.add('om({})'.format(label),o.as_axis_angle(options.degrees), scriptID+' '+' '.join(sys.argv[1:])) - - table.save((sys.stdout if name is None else name), legacy=True) From 198736a859a1489d23518ad5f6a74ec8c8c50137 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 23 Nov 2020 20:47:05 +0100 Subject: [PATCH 03/14] volume mismatch is unreliable the volume of a deformed hexahedron is not properly defined, the approximation error is in the order of the deviation from 1.0 (for typical crystal plasticity cases) --- processing/post/addCompatibilityMismatch.py | 89 --------------------- 1 file changed, 89 deletions(-) diff --git a/processing/post/addCompatibilityMismatch.py b/processing/post/addCompatibilityMismatch.py index 9a2bd1a5b..0b6a0e256 100755 --- a/processing/post/addCompatibilityMismatch.py +++ b/processing/post/addCompatibilityMismatch.py @@ -13,85 +13,6 @@ import damask scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) -def volTetrahedron(coords): - """ - Return the volume of the tetrahedron with given vertices or sides. - - If vertices are given they must be in a NumPy array with shape (4,3): the - position vectors of the 4 vertices in 3 dimensions; if the six sides are - given, they must be an array of length 6. If both are given, the sides - will be used in the calculation. - - This method implements - Tartaglia's formula using the Cayley-Menger determinant: - |0 1 1 1 1 | - |1 0 s1^2 s2^2 s3^2| - 288 V^2 = |1 s1^2 0 s4^2 s5^2| - |1 s2^2 s4^2 0 s6^2| - |1 s3^2 s5^2 s6^2 0 | - where s1, s2, ..., s6 are the tetrahedron side lengths. - - from http://codereview.stackexchange.com/questions/77593/calculating-the-volume-of-a-tetrahedron - """ - # The indexes of rows in the vertices array corresponding to all - # possible pairs of vertices - vertex_pair_indexes = np.array(((0, 1), (0, 2), (0, 3), - (1, 2), (1, 3), (2, 3))) - - # Get all the squares of all side lengths from the differences between - # the 6 different pairs of vertex positions - vertices = np.concatenate((coords[0],coords[1],coords[2],coords[3])).reshape(4,3) - vertex1, vertex2 = vertex_pair_indexes[:,0], vertex_pair_indexes[:,1] - sides_squared = np.sum((vertices[vertex1] - vertices[vertex2])**2,axis=-1) - - - # Set up the Cayley-Menger determinant - M = np.zeros((5,5)) - # Fill in the upper triangle of the matrix - M[0,1:] = 1 - # The squared-side length elements can be indexed using the vertex - # pair indices (compare with the determinant illustrated above) - M[tuple(zip(*(vertex_pair_indexes + 1)))] = sides_squared - - # The matrix is symmetric, so we can fill in the lower triangle by - # adding the transpose - M = M + M.T - return np.sqrt(np.linalg.det(M) / 288) - - -def volumeMismatch(size,F,nodes): - """ - Calculates the volume mismatch. - - volume mismatch is defined as the difference between volume of reconstructed - (compatible) cube and determinant of deformation gradient at Fourier point. - """ - coords = np.empty([8,3]) - vMismatch = np.empty(F.shape[:3]) - -#-------------------------------------------------------------------------------------------------- -# calculate actual volume and volume resulting from deformation gradient - for k in range(grid[0]): - for j in range(grid[1]): - for i in range(grid[2]): - coords[0,0:3] = nodes[k, j, i ,0:3] - coords[1,0:3] = nodes[k ,j, i+1,0:3] - coords[2,0:3] = nodes[k ,j+1,i+1,0:3] - coords[3,0:3] = nodes[k, j+1,i ,0:3] - coords[4,0:3] = nodes[k+1,j, i ,0:3] - coords[5,0:3] = nodes[k+1,j, i+1,0:3] - coords[6,0:3] = nodes[k+1,j+1,i+1,0:3] - coords[7,0:3] = nodes[k+1,j+1,i ,0:3] - vMismatch[k,j,i] = \ - ( abs(volTetrahedron([coords[6,0:3],coords[0,0:3],coords[7,0:3],coords[3,0:3]])) \ - + abs(volTetrahedron([coords[6,0:3],coords[0,0:3],coords[7,0:3],coords[4,0:3]])) \ - + abs(volTetrahedron([coords[6,0:3],coords[0,0:3],coords[2,0:3],coords[3,0:3]])) \ - + abs(volTetrahedron([coords[6,0:3],coords[0,0:3],coords[2,0:3],coords[1,0:3]])) \ - + abs(volTetrahedron([coords[6,0:3],coords[4,0:3],coords[1,0:3],coords[5,0:3]])) \ - + abs(volTetrahedron([coords[6,0:3],coords[4,0:3],coords[1,0:3],coords[0,0:3]]))) \ - /np.linalg.det(F[k,j,i,0:3,0:3]) - return vMismatch/(size.prod()/grid.prod()) - def shapeMismatch(size,F,nodes,centres): """ @@ -155,10 +76,6 @@ parser.add_option('--no-shape','-s', dest = 'shape', action = 'store_false', help = 'omit shape mismatch') -parser.add_option('--no-volume','-v', - dest = 'volume', - action = 'store_false', - help = 'omit volume mismatch') parser.set_defaults(pos = 'pos', defgrad = 'f', shape = True, @@ -185,10 +102,4 @@ for name in filenames: shapeMismatch.reshape(-1,1,order='F'), scriptID+' '+' '.join(sys.argv[1:])) - if options.volume: - volumeMismatch = volumeMismatch(size,F,nodes) - table = table.add('volMismatch(({}))'.format(options.defgrad), - volumeMismatch.reshape(-1,1,order='F'), - scriptID+' '+' '.join(sys.argv[1:])) - table.save((sys.stdout if name is None else name), legacy=True) From 762ac0eb3caf328408f8fcec7ed76b16ebeedbcc Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 23 Nov 2020 20:54:07 +0100 Subject: [PATCH 04/14] don't write out legacy file format --- processing/post/addCompatibilityMismatch.py | 2 +- processing/post/addDisplacement.py | 4 ++-- processing/post/addEuclideanDistance.py | 2 +- processing/post/addSchmidfactors.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/processing/post/addCompatibilityMismatch.py b/processing/post/addCompatibilityMismatch.py index 0b6a0e256..9ac3dfa40 100755 --- a/processing/post/addCompatibilityMismatch.py +++ b/processing/post/addCompatibilityMismatch.py @@ -102,4 +102,4 @@ for name in filenames: shapeMismatch.reshape(-1,1,order='F'), scriptID+' '+' '.join(sys.argv[1:])) - table.save((sys.stdout if name is None else name), legacy=True) + table.save((sys.stdout if name is None else name)) diff --git a/processing/post/addDisplacement.py b/processing/post/addDisplacement.py index 069d923e8..c3ba4a8af 100755 --- a/processing/post/addDisplacement.py +++ b/processing/post/addDisplacement.py @@ -60,7 +60,7 @@ for name in filenames: .add('fluct({}).{}'.format(options.f,options.pos), damask.grid_filters.node_displacement_fluct(size,F).reshape(-1,3,order='F'), scriptID+' '+' '.join(sys.argv[1:]))\ - .save((sys.stdout if name is None else os.path.splitext(name)[0]+'_nodal.txt'), legacy=True) + .save((sys.stdout if name is None else os.path.splitext(name)[0]+'_nodal.txt')) else: table.add('avg({}).{}'.format(options.f,options.pos), damask.grid_filters.cell_displacement_avg(size,F).reshape(-1,3,order='F'), @@ -68,4 +68,4 @@ for name in filenames: .add('fluct({}).{}'.format(options.f,options.pos), damask.grid_filters.cell_displacement_fluct(size,F).reshape(-1,3,order='F'), scriptID+' '+' '.join(sys.argv[1:]))\ - .save((sys.stdout if name is None else name), legacy=True) + .save((sys.stdout if name is None else name)) diff --git a/processing/post/addEuclideanDistance.py b/processing/post/addEuclideanDistance.py index fc43542bd..0c18bdccc 100755 --- a/processing/post/addEuclideanDistance.py +++ b/processing/post/addEuclideanDistance.py @@ -184,4 +184,4 @@ for name in filenames: distance[i,:], scriptID+' '+' '.join(sys.argv[1:])) - table.save((sys.stdout if name is None else name), legacy=True) + table.save((sys.stdout if name is None else name)) diff --git a/processing/post/addSchmidfactors.py b/processing/post/addSchmidfactors.py index 10f2443be..ffd525e14 100755 --- a/processing/post/addSchmidfactors.py +++ b/processing/post/addSchmidfactors.py @@ -189,4 +189,4 @@ for name in filenames: for i,label in enumerate(labels): table = table.add(label,S[:,i],scriptID+' '+' '.join(sys.argv[1:])) - table.save((sys.stdout if name is None else name), legacy=True) + table.save((sys.stdout if name is None else name)) From 4e94118cfbf828f1e79519396ea02b5b368a7912 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 23 Nov 2020 21:15:00 +0100 Subject: [PATCH 05/14] don't use legacy format (tests are updated) --- processing/post/addCurl.py | 2 +- processing/post/addDivergence.py | 2 +- processing/post/addGradient.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/processing/post/addCurl.py b/processing/post/addCurl.py index 699fc945f..d91c2be92 100755 --- a/processing/post/addCurl.py +++ b/processing/post/addCurl.py @@ -55,4 +55,4 @@ for name in filenames: curl.reshape(tuple(grid)+(-1,)).reshape(-1,np.prod(shape),order='F'), scriptID+' '+' '.join(sys.argv[1:])) - table.save((sys.stdout if name is None else name), legacy=True) + table.save((sys.stdout if name is None else name)) diff --git a/processing/post/addDivergence.py b/processing/post/addDivergence.py index 208a0f7b6..6e5629285 100755 --- a/processing/post/addDivergence.py +++ b/processing/post/addDivergence.py @@ -55,4 +55,4 @@ for name in filenames: div.reshape(tuple(grid)+(-1,)).reshape(-1,np.prod(shape)//3,order='F'), scriptID+' '+' '.join(sys.argv[1:])) - table.save((sys.stdout if name is None else name), legacy=True) + table.save((sys.stdout if name is None else name)) diff --git a/processing/post/addGradient.py b/processing/post/addGradient.py index d049b65d7..147773734 100755 --- a/processing/post/addGradient.py +++ b/processing/post/addGradient.py @@ -55,4 +55,4 @@ for name in filenames: grad.reshape(tuple(grid)+(-1,)).reshape(-1,np.prod(shape)*3,order='F'), scriptID+' '+' '.join(sys.argv[1:])) - table.save((sys.stdout if name is None else name), legacy=True) + table.save((sys.stdout if name is None else name)) From da654b7c91603feeb4adaced1638b1489e5eb837 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 23 Nov 2020 21:23:45 +0100 Subject: [PATCH 06/14] vectorized --- processing/post/addCompatibilityMismatch.py | 35 +++++---------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/processing/post/addCompatibilityMismatch.py b/processing/post/addCompatibilityMismatch.py index 9ac3dfa40..1b4425e06 100755 --- a/processing/post/addCompatibilityMismatch.py +++ b/processing/post/addCompatibilityMismatch.py @@ -22,35 +22,16 @@ def shapeMismatch(size,F,nodes,centres): the corners of reconstructed (combatible) volume element and the vectors calculated by deforming the initial volume element with the current deformation gradient. """ - sMismatch = np.empty(F.shape[:3]) - -#-------------------------------------------------------------------------------------------------- -# initial positions delta = size/grid*.5 - coordsInitial = np.vstack((delta * np.array((-1,-1,-1)), - delta * np.array((+1,-1,-1)), - delta * np.array((+1,+1,-1)), - delta * np.array((-1,+1,-1)), - delta * np.array((-1,-1,+1)), - delta * np.array((+1,-1,+1)), - delta * np.array((+1,+1,+1)), - delta * np.array((-1,+1,+1)))) -#-------------------------------------------------------------------------------------------------- -# compare deformed original and deformed positions to actual positions - for k in range(grid[0]): - for j in range(grid[1]): - for i in range(grid[2]): - sMismatch[k,j,i] = \ - + np.linalg.norm(nodes[k, j, i ,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[0,0:3]))\ - + np.linalg.norm(nodes[k+1,j, i ,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[1,0:3]))\ - + np.linalg.norm(nodes[k+1,j+1,i ,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[2,0:3]))\ - + np.linalg.norm(nodes[k, j+1,i ,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[3,0:3]))\ - + np.linalg.norm(nodes[k, j, i+1,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[4,0:3]))\ - + np.linalg.norm(nodes[k+1,j, i+1,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[5,0:3]))\ - + np.linalg.norm(nodes[k+1,j+1,i+1,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[6,0:3]))\ - + np.linalg.norm(nodes[k ,j+1,i+1,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[7,0:3])) - return sMismatch + return + np.linalg.norm(nodes[:-1,:-1,:-1] -centres - np.dot(F,delta * np.array((-1,-1,-1))),axis=-1)\ + + np.linalg.norm(nodes[+1:,:-1,:-1] -centres - np.dot(F,delta * np.array((+1,-1,-1))),axis=-1)\ + + np.linalg.norm(nodes[+1:,+1:,:-1] -centres - np.dot(F,delta * np.array((+1,+1,-1))),axis=-1)\ + + np.linalg.norm(nodes[:-1,+1:,:-1] -centres - np.dot(F,delta * np.array((-1,+1,-1))),axis=-1)\ + + np.linalg.norm(nodes[:-1,:-1,+1:] -centres - np.dot(F,delta * np.array((-1,-1,+1))),axis=-1)\ + + np.linalg.norm(nodes[+1:,:-1,+1:] -centres - np.dot(F,delta * np.array((+1,-1,+1))),axis=-1)\ + + np.linalg.norm(nodes[+1:,+1:,+1:] -centres - np.dot(F,delta * np.array((+1,+1,+1))),axis=-1)\ + + np.linalg.norm(nodes[:-1,+1:,+1:] -centres - np.dot(F,delta * np.array((-1,+1,+1))),axis=-1) # -------------------------------------------------------------------- From 599718caad6daee88f1432f5176925d1db1b5214 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 23 Nov 2020 21:25:45 +0100 Subject: [PATCH 07/14] test does not exist anymore --- .gitlab-ci.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a33a5a078..c62153c16 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -252,13 +252,6 @@ Thermal: - master - release -grid_parsingArguments: - stage: grid - script: grid_parsingArguments/test.py - except: - - master - - release - Nonlocal_Damage_DetectChanges: stage: grid script: Nonlocal_Damage_DetectChanges/test.py From a65a47f6d77c3716830827bc16c17107fff5da3c Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 23 Nov 2020 21:26:35 +0100 Subject: [PATCH 08/14] single source of truth --- processing/post/addSchmidfactors.py | 85 ++--------------------------- 1 file changed, 5 insertions(+), 80 deletions(-) diff --git a/processing/post/addSchmidfactors.py b/processing/post/addSchmidfactors.py index ffd525e14..8e1e4ffb7 100755 --- a/processing/post/addSchmidfactors.py +++ b/processing/post/addSchmidfactors.py @@ -14,84 +14,9 @@ scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) slipSystems = { -'fcc': - np.array([ - [+0,+1,-1 , +1,+1,+1], - [-1,+0,+1 , +1,+1,+1], - [+1,-1,+0 , +1,+1,+1], - [+0,-1,-1 , -1,-1,+1], - [+1,+0,+1 , -1,-1,+1], - [-1,+1,+0 , -1,-1,+1], - [+0,-1,+1 , +1,-1,-1], - [-1,+0,-1 , +1,-1,-1], - [+1,+1,+0 , +1,-1,-1], - [+0,+1,+1 , -1,+1,-1], - [+1,+0,-1 , -1,+1,-1], - [-1,-1,+0 , -1,+1,-1], - ],'d'), -'bcc': - np.array([ - [+1,-1,+1 , +0,+1,+1], - [-1,-1,+1 , +0,+1,+1], - [+1,+1,+1 , +0,-1,+1], - [-1,+1,+1 , +0,-1,+1], - [-1,+1,+1 , +1,+0,+1], - [-1,-1,+1 , +1,+0,+1], - [+1,+1,+1 , -1,+0,+1], - [+1,-1,+1 , -1,+0,+1], - [-1,+1,+1 , +1,+1,+0], - [-1,+1,-1 , +1,+1,+0], - [+1,+1,+1 , -1,+1,+0], - [+1,+1,-1 , -1,+1,+0], - [-1,+1,+1 , +2,+1,+1], - [+1,+1,+1 , -2,+1,+1], - [+1,+1,-1 , +2,-1,+1], - [+1,-1,+1 , +2,+1,-1], - [+1,-1,+1 , +1,+2,+1], - [+1,+1,-1 , -1,+2,+1], - [+1,+1,+1 , +1,-2,+1], - [-1,+1,+1 , +1,+2,-1], - [+1,+1,-1 , +1,+1,+2], - [+1,-1,+1 , -1,+1,+2], - [-1,+1,+1 , +1,-1,+2], - [+1,+1,+1 , +1,+1,-2], - ],'d'), -'hex': - np.array([ - [+2,-1,-1,+0 , +0,+0,+0,+1], - [-1,+2,-1,+0 , +0,+0,+0,+1], - [-1,-1,+2,+0 , +0,+0,+0,+1], - [+2,-1,-1,+0 , +0,+1,-1,+0], - [-1,+2,-1,+0 , -1,+0,+1,+0], - [-1,-1,+2,+0 , +1,-1,+0,+0], - [-1,+1,+0,+0 , +1,+1,-2,+0], - [+0,-1,+1,+0 , -2,+1,+1,+0], - [+1,+0,-1,+0 , +1,-2,+1,+0], - [-1,+2,-1,+0 , +1,+0,-1,+1], - [-2,+1,+1,+0 , +0,+1,-1,+1], - [-1,-1,+2,+0 , -1,+1,+0,+1], - [+1,-2,+1,+0 , -1,+0,+1,+1], - [+2,-1,-1,+0 , +0,-1,+1,+1], - [+1,+1,-2,+0 , +1,-1,+0,+1], - [-2,+1,+1,+3 , +1,+0,-1,+1], - [-1,-1,+2,+3 , +1,+0,-1,+1], - [-1,-1,+2,+3 , +0,+1,-1,+1], - [+1,-2,+1,+3 , +0,+1,-1,+1], - [+1,-2,+1,+3 , -1,+1,+0,+1], - [+2,-1,-1,+3 , -1,+1,+0,+1], - [+2,-1,-1,+3 , -1,+0,+1,+1], - [+1,+1,-2,+3 , -1,+0,+1,+1], - [+1,+1,-2,+3 , +0,-1,+1,+1], - [-1,+2,-1,+3 , +0,-1,+1,+1], - [-1,+2,-1,+3 , +1,-1,+0,+1], - [-2,+1,+1,+3 , +1,-1,+0,+1], - [-1,-1,+2,+3 , +1,+1,-2,+2], - [+1,-2,+1,+3 , -1,+2,-1,+2], - [+2,-1,-1,+3 , -2,+1,+1,+2], - [+1,+1,-2,+3 , -1,-1,+2,+2], - [-1,+2,-1,+3 , +1,-2,+1,+2], - [-2,+1,+1,+3 , +2,-1,-1,+2], - ],'d'), +'fcc': damask.lattice.kinematics['cF']['slip'][:12], +'bcc': damask.lattice.kinematics['cI']['slip'], +'hex': damask.lattice.kinematics['hP']['slip'], } # -------------------------------------------------------------------- @@ -156,11 +81,11 @@ elif options.lattice == 'hex': # convert 4 Miller index notation of hex to orthogonal 3 Miller index notation for i in range(len(slip_direction)): slip_direction[i] = np.array([slipSystems['hex'][i,0]*1.5, - (slipSystems['hex'][i,0] + 2.*slipSystems['hex'][i,1])*0.5*np.sqrt(3), + (slipSystems['hex'][i,0] + 2.*slipSystems['hex'][i,1])*0.5*np.sqrt(3), slipSystems['hex'][i,3]*options.CoverA, ]) slip_normal[i] = np.array([slipSystems['hex'][i,4], - (slipSystems['hex'][i,4] + 2.*slipSystems['hex'][i,5])/np.sqrt(3), + (slipSystems['hex'][i,4] + 2.*slipSystems['hex'][i,5])/np.sqrt(3), slipSystems['hex'][i,7]/options.CoverA, ]) From 8ffb38d0de5e1a1fb784e6f7bd07f1504b16397b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 23 Nov 2020 21:49:05 +0100 Subject: [PATCH 09/14] test does not exist anymore --- .gitlab-ci.yml | 9 --------- PRIVATE | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c62153c16..cae517dae 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,7 +9,6 @@ stages: - grid - compileMarc - marc - - example - performance - createPackage - createDocumentation @@ -330,14 +329,6 @@ Marc_elementLib: - master - release -################################################################################################### -grid_all_example: - stage: example - script: grid_all_example/test.py - except: - - master - - release - ################################################################################################### SpectralRuntime: stage: performance diff --git a/PRIVATE b/PRIVATE index 8bd09b551..fe570e72e 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 8bd09b5511d1e0e0ea288b47d16ce4924d75adcd +Subproject commit fe570e72ebca28f226312445ac6e8dff35fbd3bb From 136998eb27729d20080d1f00c9cb6120d77f35fc Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 24 Nov 2020 10:35:26 +0100 Subject: [PATCH 10/14] fixed test --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index fe570e72e..a6be226f2 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit fe570e72ebca28f226312445ac6e8dff35fbd3bb +Subproject commit a6be226f2ab08cfa44adabf37168f4d952d6174f From ad449f7a44183153ff7ec114e30eeef1b381b557 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 24 Nov 2020 11:59:40 +0100 Subject: [PATCH 11/14] need to compile mesh solver less stages for more parallelism --- .gitlab-ci.yml | 63 +++++++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cae517dae..a69c8af54 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,10 +4,8 @@ stages: - python - preprocessing - postprocessing - - compilePETSc - - prepareGrid + - compile - grid - - compileMarc - marc - performance - createPackage @@ -182,8 +180,8 @@ Post_OrientationAverageMisorientation: - release ################################################################################################### -grid_mech_compile_Intel: - stage: compilePETSc +compile_grid_Intel: + stage: compile script: - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel - cd pytest @@ -192,8 +190,8 @@ grid_mech_compile_Intel: - master - release -Compile_FEM_Intel: - stage: compilePETSc +compile_mesh_Intel: + stage: compile script: - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel - cd pytest @@ -202,8 +200,8 @@ Compile_FEM_Intel: - master - release -grid_mech_compile_GNU: - stage: compilePETSc +compile_grid_GNU: + stage: compile script: - module load $GNUCompiler $MPICH_GNU $PETSc_MPICH_GNU - cd pytest @@ -212,8 +210,8 @@ grid_mech_compile_GNU: - master - release -Compile_FEM_GNU: - stage: compilePETSc +compile_mesh_GNU: + stage: compile script: - module load $GNUCompiler $MPICH_GNU $PETSc_MPICH_GNU - cd pytest @@ -222,13 +220,36 @@ Compile_FEM_GNU: - master - release -################################################################################################### -Compile_Intel_Prepare: - stage: prepareGrid +compile_MARC: + stage: compile + script: + - module load $IntelMarc $HDF5Marc $MSC + - cd pytest + - pytest -k 'compile and Marc' --basetemp=${TESTROOT}/compile_Marc + except: + - master + - release + +setup_grid: + stage: compile script: - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel - - cd $DAMASKROOT - - make clean grid processing + - $BUILD_DIR=$(mktemp -d) + - cd ${BUILD_DIR} + - cmake -DDAMASK_SOLVER=GRID -DCMAKE_INSTALL_PREFIX=${DAMASKROOT} ${DAMASKROOT}/src + - make -j2 all install + except: + - master + - release + +setup_mesh: + stage: compile + script: + - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel + - $BUILD_DIR=$(mktemp -d) + - cd ${BUILD_DIR} + - cmake -DDAMASK_SOLVER=MESH -DCMAKE_INSTALL_PREFIX=${DAMASKROOT} ${DAMASKROOT}/src + - make -j2 all install except: - master - release @@ -272,16 +293,6 @@ Phenopowerlaw_singleSlip: - master - release -################################################################################################### -Marc_compileIfort: - stage: compileMarc - script: - - module load $IntelMarc $HDF5Marc $MSC - - cd pytest - - pytest -k 'compile and Marc' --basetemp=${TESTROOT}/compile_Marc - except: - - master - - release ################################################################################################### Hex_elastic: From 63a8fc828df3c5572c2c228e1193f4ee6a78d3a0 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 24 Nov 2020 13:24:53 +0100 Subject: [PATCH 12/14] lump old tests into one stage --- .gitlab-ci.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a69c8af54..0bed04ae9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,8 +2,7 @@ stages: - prepareAll - python - - preprocessing - - postprocessing + - deprecated - compile - grid - marc @@ -108,71 +107,70 @@ Pytest_python: ################################################################################################### Pre_SeedGeneration: - stage: preprocessing + stage: deprecated script: PreProcessing_SeedGeneration/test.py except: - master - release Pre_GeomGeneration: - stage: preprocessing + stage: deprecated script: PreProcessing_GeomGeneration/test.py except: - master - release Pre_GeomModification: - stage: preprocessing + stage: deprecated script: PreProcessing_GeomModification/test.py except: - master - release Pre_General: - stage: preprocessing + stage: deprecated script: PreProcessing/test.py except: - master - release -################################################################################################### Post_General: - stage: postprocessing + stage: deprecated script: PostProcessing/test.py except: - master - release Post_GeometryReconstruction: - stage: postprocessing + stage: deprecated script: spectral_geometryReconstruction/test.py except: - master - release Post_addCurl: - stage: postprocessing + stage: deprecated script: addCurl/test.py except: - master - release Post_addDivergence: - stage: postprocessing + stage: deprecated script: addDivergence/test.py except: - master - release Post_addGradient: - stage: postprocessing + stage: deprecated script: addGradient/test.py except: - master - release Post_OrientationAverageMisorientation: - stage: postprocessing + stage: deprecated script: - OrientationAverageMisorientation/test.py except: From e761f58d5fe177ae33fb736f185982ec85bd1085 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 24 Nov 2020 14:56:08 +0100 Subject: [PATCH 13/14] bugs in build commands --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0bed04ae9..1e7a656bf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -232,9 +232,9 @@ setup_grid: stage: compile script: - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel - - $BUILD_DIR=$(mktemp -d) + - BUILD_DIR=$(mktemp -d) - cd ${BUILD_DIR} - - cmake -DDAMASK_SOLVER=GRID -DCMAKE_INSTALL_PREFIX=${DAMASKROOT} ${DAMASKROOT}/src + - cmake -DDAMASK_SOLVER=GRID -DCMAKE_INSTALL_PREFIX=${DAMASKROOT} ${DAMASKROOT} - make -j2 all install except: - master @@ -244,9 +244,9 @@ setup_mesh: stage: compile script: - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel - - $BUILD_DIR=$(mktemp -d) + - Bcd ${BUILD_DIR}UILD_DIR=$(mktemp -d) - cd ${BUILD_DIR} - - cmake -DDAMASK_SOLVER=MESH -DCMAKE_INSTALL_PREFIX=${DAMASKROOT} ${DAMASKROOT}/src + - cmake -DDAMASK_SOLVER=MESH -DCMAKE_INSTALL_PREFIX=${DAMASKROOT} ${DAMASKROOT} - make -j2 all install except: - master From 807b7468a0979f70c25f6bf36ba6929796077a2f Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 24 Nov 2020 18:51:19 +0100 Subject: [PATCH 14/14] command was broken --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1e7a656bf..99c309419 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -244,7 +244,7 @@ setup_mesh: stage: compile script: - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel - - Bcd ${BUILD_DIR}UILD_DIR=$(mktemp -d) + - BUILD_DIR=$(mktemp -d) - cd ${BUILD_DIR} - cmake -DDAMASK_SOLVER=MESH -DCMAKE_INSTALL_PREFIX=${DAMASKROOT} ${DAMASKROOT} - make -j2 all install