diff --git a/.gitattributes b/.gitattributes index 2f356076d..8d1f26a78 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,8 +3,8 @@ # always use LF, even if the files are edited on windows, they need to be compiled/used on unix * text eol=lf -installation/mods_Abaqus/abaqus_v6_windows.env eol=crlf # Denote all files that are truly binary and should not be modified. *.png binary *.jpg binary *.cae binary +*.hdf5 binary diff --git a/VERSION b/VERSION index 6464fe0a4..1fe12d401 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.3-1111-g374980da +v2.0.3-1133-gfede8225 diff --git a/processing/post/DADF5toDREAM3D.py b/processing/post/DADF5toDREAM3D.py index 885545297..7ab04b934 100755 --- a/processing/post/DADF5toDREAM3D.py +++ b/processing/post/DADF5toDREAM3D.py @@ -49,7 +49,7 @@ Phase_types = {'Primary': 0} #further additions to these can be done by looking # -------------------------------------------------------------------- parser = argparse.ArgumentParser(description='Creating a file for DREAM3D from DAMASK data') parser.add_argument('filenames',nargs='+',help='HDF5 based output file') -parser.add_argument('--inc',nargs='+',help='Increment for which DREAM3D to be used, eg. 00025',type=int) +parser.add_argument('--inc',nargs='+',help='Increment for which DREAM3D to be used, eg. 25',type=int) parser.add_argument('-d','--dir', dest='dir',default='postProc',metavar='string', help='name of subdirectory to hold output') @@ -59,15 +59,13 @@ options = parser.parse_args() # loop over input files for filename in options.filenames: f = damask.DADF5(filename) #DAMASK output file - count = 0 - for increment in f.increments: - if int(increment[3:]) not in options.inc: - count = count + 1 + for increment in options.inc: + f.set_by_increment(increment,increment) + if len(f.visible['increments']) == 0: continue #-------output file creation------------------------------------- dirname = os.path.abspath(os.path.join(os.path.dirname(filename),options.dir)) - print(dirname) try: os.mkdir(dirname) except FileExistsError: @@ -90,11 +88,10 @@ for filename in options.filenames: # Phase information of DREAM.3D is constituent ID in DAMASK o[cell_data_label + '/Phases'] = f.get_constituent_ID().reshape(tuple(f.grid)+(1,)) # Data quaternions - DAMASK_quaternion = f.read_dataset(f.get_dataset_location('orientation'),0) - DREAM_3D_quaternion = np.empty((np.prod(f.grid),4),dtype=np.float32) + DAMASK_quaternion = f.read_dataset(f.get_dataset_location('orientation')) # Convert: DAMASK uses P = -1, DREAM.3D uses P = +1. Also change position of imagninary part DREAM_3D_quaternion = np.hstack((-DAMASK_quaternion['x'],-DAMASK_quaternion['y'],-DAMASK_quaternion['z'], - DAMASK_quaternion['w'])) + DAMASK_quaternion['w'])).astype(np.float32) o[cell_data_label + '/Quats'] = DREAM_3D_quaternion.reshape(tuple(f.grid)+(4,)) # Attributes to CellData group @@ -109,12 +106,14 @@ for filename in options.filenames: # phase attributes o[cell_data_label + '/Phases'].attrs['ComponentDimensions'] = np.array([1],np.uint64) o[cell_data_label + '/Phases'].attrs['ObjectType'] = 'DataArray' + o[cell_data_label + '/Phases'].attrs['TupleDimensions'] = f.grid.astype(np.uint64) # Quats attributes o[cell_data_label + '/Quats'].attrs['ComponentDimensions'] = np.array([4],np.uint64) o[cell_data_label + '/Quats'].attrs['ObjectType'] = 'DataArray' - - # Create EnsembleAttributeMatrix + o[cell_data_label + '/Quats'].attrs['TupleDimensions'] = f.grid.astype(np.uint64) + + # Create EnsembleAttributeMatrix ensemble_label = data_container_label + '/EnsembleAttributeMatrix' # Data CrystalStructures diff --git a/python/tests/conftest.py b/python/tests/conftest.py new file mode 100644 index 000000000..a0504c499 --- /dev/null +++ b/python/tests/conftest.py @@ -0,0 +1,21 @@ +import os + +import pytest + +import damask + +def pytest_addoption(parser): + parser.addoption("--update", + action="store_true", + default=False) + +@pytest.fixture +def update(request): + """Store current results as new reference results.""" + return request.config.getoption("--update") + +@pytest.fixture +def reference_dir_base(): + """Directory containing reference results.""" + env = damask.Environment() + return os.path.join(env.rootDir(),'python','tests','reference') diff --git a/python/tests/reference/DADF5/12grains6x7x8.geom b/python/tests/reference/DADF5/12grains6x7x8.geom new file mode 100644 index 000000000..7bb4a3e4d --- /dev/null +++ b/python/tests/reference/DADF5/12grains6x7x8.geom @@ -0,0 +1,125 @@ +68 header +geom_fromVoronoiTessellation 2.0.3-1073-g6f3cb071 + +[Grain1] +(gauss) phi1 358.98 Phi 65.62 phi2 24.48 +[Grain2] +(gauss) phi1 121.05 Phi 176.11 phi2 295.73 +[Grain3] +(gauss) phi1 43.79 Phi 113.76 phi2 345.90 +[Grain4] +(gauss) phi1 265.15 Phi 62.52 phi2 299.71 +[Grain5] +(gauss) phi1 221.23 Phi 26.54 phi2 207.05 +[Grain6] +(gauss) phi1 249.81 Phi 61.47 phi2 152.14 +[Grain7] +(gauss) phi1 332.45 Phi 99.16 phi2 345.34 +[Grain8] +(gauss) phi1 312.27 Phi 118.27 phi2 181.59 +[Grain9] +(gauss) phi1 303.10 Phi 48.21 phi2 358.03 +[Grain10] +(gauss) phi1 338.26 Phi 48.11 phi2 176.78 +[Grain11] +(gauss) phi1 115.17 Phi 56.54 phi2 223.84 +[Grain12] +(gauss) phi1 281.04 Phi 97.48 phi2 27.94 + +[Grain1] +crystallite 1 +(constituent) phase 1 texture 1 fraction 1.0 +[Grain2] +crystallite 1 +(constituent) phase 1 texture 2 fraction 1.0 +[Grain3] +crystallite 1 +(constituent) phase 1 texture 3 fraction 1.0 +[Grain4] +crystallite 1 +(constituent) phase 1 texture 4 fraction 1.0 +[Grain5] +crystallite 1 +(constituent) phase 1 texture 5 fraction 1.0 +[Grain6] +crystallite 1 +(constituent) phase 1 texture 6 fraction 1.0 +[Grain7] +crystallite 1 +(constituent) phase 1 texture 7 fraction 1.0 +[Grain8] +crystallite 1 +(constituent) phase 1 texture 8 fraction 1.0 +[Grain9] +crystallite 1 +(constituent) phase 1 texture 9 fraction 1.0 +[Grain10] +crystallite 1 +(constituent) phase 1 texture 10 fraction 1.0 +[Grain11] +crystallite 1 +(constituent) phase 1 texture 11 fraction 1.0 +[Grain12] +crystallite 1 +(constituent) phase 1 texture 12 fraction 1.0 + +grid a 6 b 7 c 8 +size x 0.75 y 0.875 z 1.0 +origin x 0.0 y 0.0 z 0.0 +homogenization 1 + 9 3 3 10 9 9 + 9 1 1 1 9 9 + 9 11 1 1 7 9 + 7 11 11 7 7 7 + 7 11 11 7 7 7 +12 3 3 10 7 12 +12 3 3 10 10 12 +12 3 3 1 9 9 + 9 1 1 1 9 9 + 9 1 1 1 7 7 + 7 1 1 7 7 7 +12 12 3 7 7 7 +12 3 3 3 12 12 +12 3 3 3 12 12 +12 3 3 1 1 12 + 9 1 1 1 1 9 + 6 1 1 1 8 8 + 7 6 8 8 8 8 +12 12 8 8 8 12 +12 3 3 3 12 12 +12 3 3 3 12 12 + 5 6 6 6 1 12 + 6 6 6 6 8 8 + 6 6 6 8 8 8 + 8 6 8 8 8 8 +12 5 8 8 8 8 +12 5 5 8 8 12 + 5 5 5 3 12 12 + 5 5 6 6 6 5 + 6 6 6 6 6 6 + 6 6 6 6 8 8 + 4 4 6 8 8 8 + 4 4 2 2 2 8 + 5 5 5 2 2 2 + 5 5 5 5 2 5 + 5 5 5 10 10 5 + 6 6 6 6 10 4 + 4 4 11 11 2 4 + 4 4 11 2 2 4 + 4 4 2 2 2 2 + 5 5 5 2 2 2 + 5 5 5 10 10 5 + 5 5 10 10 10 9 + 4 11 11 11 10 9 + 4 4 11 11 11 4 + 4 4 11 11 2 4 + 4 4 2 2 2 2 + 5 5 2 2 2 2 + 5 5 10 10 10 10 + 9 10 10 10 10 9 + 9 11 11 10 9 9 + 4 11 11 11 9 9 + 4 11 11 11 7 7 + 4 4 11 2 7 7 +12 10 10 10 10 7 + 9 10 10 10 10 9 diff --git a/python/tests/reference/DADF5/12grains6x7x8_tensionY.hdf5 b/python/tests/reference/DADF5/12grains6x7x8_tensionY.hdf5 new file mode 100644 index 000000000..caafce478 Binary files /dev/null and b/python/tests/reference/DADF5/12grains6x7x8_tensionY.hdf5 differ diff --git a/python/tests/reference/DADF5/material.config b/python/tests/reference/DADF5/material.config new file mode 100644 index 000000000..0b0808a12 --- /dev/null +++ b/python/tests/reference/DADF5/material.config @@ -0,0 +1,129 @@ + +[none] +mech none +ngrains 1 + + +[Grain1] +(gauss) phi1 358.98 Phi 65.62 phi2 24.48 +[Grain2] +(gauss) phi1 121.05 Phi 176.11 phi2 295.73 +[Grain3] +(gauss) phi1 43.79 Phi 113.76 phi2 345.90 +[Grain4] +(gauss) phi1 265.15 Phi 62.52 phi2 299.71 +[Grain5] +(gauss) phi1 221.23 Phi 26.54 phi2 207.05 +[Grain6] +(gauss) phi1 249.81 Phi 61.47 phi2 152.14 +[Grain7] +(gauss) phi1 332.45 Phi 99.16 phi2 345.34 +[Grain8] +(gauss) phi1 312.27 Phi 118.27 phi2 181.59 +[Grain9] +(gauss) phi1 303.10 Phi 48.21 phi2 358.03 +[Grain10] +(gauss) phi1 338.26 Phi 48.11 phi2 176.78 +[Grain11] +(gauss) phi1 115.17 Phi 56.54 phi2 223.84 +[Grain12] +(gauss) phi1 281.04 Phi 97.48 phi2 27.94 + + +[Grain1] +crystallite 1 +(constituent) phase 1 texture 1 fraction 1.0 +[Grain2] +crystallite 1 +(constituent) phase 1 texture 2 fraction 1.0 +[Grain3] +crystallite 1 +(constituent) phase 1 texture 3 fraction 1.0 +[Grain4] +crystallite 1 +(constituent) phase 1 texture 4 fraction 1.0 +[Grain5] +crystallite 1 +(constituent) phase 1 texture 5 fraction 1.0 +[Grain6] +crystallite 1 +(constituent) phase 1 texture 6 fraction 1.0 +[Grain7] +crystallite 1 +(constituent) phase 2 texture 7 fraction 1.0 +[Grain8] +crystallite 1 +(constituent) phase 2 texture 8 fraction 1.0 +[Grain9] +crystallite 1 +(constituent) phase 2 texture 9 fraction 1.0 +[Grain10] +crystallite 1 +(constituent) phase 2 texture 10 fraction 1.0 +[Grain11] +crystallite 1 +(constituent) phase 2 texture 11 fraction 1.0 +[Grain12] +crystallite 1 +(constituent) phase 2 texture 12 fraction 1.0 + + +[pheno_fcc] +elasticity hooke +plasticity phenopowerlaw + +(output) orientation # quaternion +(output) F # deformation gradient tensor +(output) Fe # elastic deformation gradient tensor +(output) Fp # plastic deformation gradient tensor +(output) P # first Piola-Kichhoff stress tensor +(output) Lp # plastic velocity gradient tensor + + +lattice_structure fcc +Nslip 12 # per family +Ntwin 0 # per family + +c11 106.75e9 +c12 60.41e9 +c44 28.34e9 + +gdot0_slip 0.001 +n_slip 20 +tau0_slip 31e6 # per family +tausat_slip 63e6 # per family +a_slip 2.25 +h0_slipslip 75e6 +interaction_slipslip 1 1 1.4 1.4 1.4 1.4 +atol_resistance 1 + +[pheno_bcc] +elasticity hooke +plasticity phenopowerlaw + +(output) orientation # quaternion +(output) F # deformation gradient tensor +(output) Fe # elastic deformation gradient tensor +(output) Fp # plastic deformation gradient tensor +(output) P # first Piola-Kichhoff stress tensor +(output) Lp # plastic velocity gradient tensor + + +lattice_structure bcc +Nslip 12 # per family + +c11 106.75e9 +c12 60.41e9 +c44 28.34e9 + +gdot0_slip 0.001 +n_slip 20 +tau0_slip 31e6 # per family +tausat_slip 63e6 # per family +a_slip 2.25 +h0_slipslip 75e6 +interaction_slipslip 1 1 1.4 1.4 1.4 1.4 +atol_resistance 1 + + +[dummy] diff --git a/python/tests/reference/DADF5/tensionY.load b/python/tests/reference/DADF5/tensionY.load new file mode 100644 index 000000000..9332144d8 --- /dev/null +++ b/python/tests/reference/DADF5/tensionY.load @@ -0,0 +1 @@ +fdot * 0 0 0 1.0e-3 0 0 0 * stress 0 * * * * * * * 0 time 20 incs 40 freq 4 diff --git a/python/tests/reference/Geom/clean_stencil=1.geom b/python/tests/reference/Geom/clean_stencil=1.geom new file mode 100644 index 000000000..2fe5314fe --- /dev/null +++ b/python/tests/reference/Geom/clean_stencil=1.geom @@ -0,0 +1,25 @@ +4 header +grid a 8 b 5 c 4 +size x 8e-06 y 5e-06 z 4e-06 +origin x 0.0 y 0.0 z 0.0 +homogenization 1 + 1 1 2 22 2 2 1 21 + 1 1 6 26 2 2 5 25 + 1 1 10 30 2 2 9 29 + 1 1 14 34 2 2 13 33 + 1 1 18 38 2 2 17 37 + 1 1 3 23 2 2 2 22 + 1 1 7 27 2 2 6 26 + 1 1 11 31 2 2 10 30 + 1 1 15 35 2 2 14 34 + 1 1 19 39 2 2 18 38 + 1 1 4 24 2 2 3 23 + 1 1 8 28 2 2 7 27 + 1 1 12 32 2 2 11 31 + 1 1 16 36 2 2 15 35 + 1 1 20 40 2 2 19 39 + 1 1 5 25 2 2 4 24 + 1 1 9 29 2 2 8 28 + 1 1 13 33 2 2 12 32 + 1 1 17 37 2 2 16 36 + 1 1 21 41 2 2 20 40 diff --git a/python/tests/reference/Geom/clean_stencil=2.geom b/python/tests/reference/Geom/clean_stencil=2.geom new file mode 100644 index 000000000..f074fea56 --- /dev/null +++ b/python/tests/reference/Geom/clean_stencil=2.geom @@ -0,0 +1,25 @@ +4 header +grid a 8 b 5 c 4 +size x 8e-06 y 5e-06 z 4e-06 +origin x 0.0 y 0.0 z 0.0 +homogenization 1 + 1 1 1 2 2 2 1 1 + 1 1 1 2 2 2 2 1 + 1 1 1 6 2 2 2 5 + 1 1 1 10 2 2 2 9 + 1 1 1 14 2 2 2 13 + 1 1 1 2 2 2 2 1 + 1 1 1 2 2 2 2 1 + 1 1 1 6 2 2 2 5 + 1 1 1 10 2 2 2 9 + 1 1 1 14 2 2 2 13 + 1 1 1 3 2 2 2 2 + 1 1 1 3 2 2 2 2 + 1 1 1 7 2 2 2 6 + 1 1 1 11 2 2 2 10 + 1 1 1 15 2 2 2 14 + 1 1 1 4 2 2 2 3 + 1 1 1 4 2 2 2 3 + 1 1 1 8 2 2 2 7 + 1 1 1 12 2 2 2 11 + 1 1 1 16 2 2 2 15 diff --git a/python/tests/reference/Geom/clean_stencil=3.geom b/python/tests/reference/Geom/clean_stencil=3.geom new file mode 100644 index 000000000..63e1dce5a --- /dev/null +++ b/python/tests/reference/Geom/clean_stencil=3.geom @@ -0,0 +1,25 @@ +4 header +grid a 8 b 5 c 4 +size x 8e-06 y 5e-06 z 4e-06 +origin x 0.0 y 0.0 z 0.0 +homogenization 1 + 1 1 1 2 2 2 2 21 + 1 1 1 2 2 2 2 21 + 1 1 1 2 2 2 2 25 + 1 1 1 2 2 2 2 29 + 1 1 1 2 2 2 2 37 + 1 1 1 2 2 2 2 21 + 1 1 1 2 2 2 2 21 + 1 1 1 2 2 2 2 25 + 1 1 1 2 2 2 2 29 + 1 1 1 2 2 2 2 37 + 1 1 1 2 2 2 2 22 + 1 1 1 2 2 2 2 22 + 1 1 1 2 2 2 2 26 + 1 1 1 2 2 2 2 30 + 1 1 1 2 2 2 2 38 + 1 1 1 2 2 2 2 24 + 1 1 1 2 2 2 2 24 + 1 1 1 2 2 2 2 28 + 1 1 1 2 2 2 2 32 + 1 1 1 2 2 2 2 40 diff --git a/python/tests/reference/Geom/clean_stencil=4.geom b/python/tests/reference/Geom/clean_stencil=4.geom new file mode 100644 index 000000000..eef322d3f --- /dev/null +++ b/python/tests/reference/Geom/clean_stencil=4.geom @@ -0,0 +1,25 @@ +4 header +grid a 8 b 5 c 4 +size x 8e-06 y 5e-06 z 4e-06 +origin x 0.0 y 0.0 z 0.0 +homogenization 1 +1 1 1 2 2 2 2 2 +1 1 1 2 2 2 2 2 +1 1 1 2 2 2 2 2 +1 1 1 1 2 2 2 2 +1 1 1 1 2 2 2 2 +1 1 1 2 2 2 2 2 +1 1 1 2 2 2 2 2 +1 1 1 2 2 2 2 2 +1 1 1 1 2 2 2 2 +1 1 1 1 2 2 2 2 +1 1 1 2 2 2 2 2 +1 1 1 2 2 2 2 2 +1 1 1 2 2 2 2 2 +1 1 1 1 2 2 2 2 +1 1 1 1 2 2 2 2 +1 1 1 1 2 2 2 2 +1 1 1 1 2 2 2 2 +1 1 1 1 2 2 2 2 +1 1 1 1 2 2 2 2 +1 1 1 1 2 2 2 2 diff --git a/python/tests/reference/Geom/mirror_directions=x-y-z_reflect=True.geom b/python/tests/reference/Geom/mirror_directions=x-y-z_reflect=True.geom new file mode 100644 index 000000000..77ff709d7 --- /dev/null +++ b/python/tests/reference/Geom/mirror_directions=x-y-z_reflect=True.geom @@ -0,0 +1,85 @@ +4 header +grid a 16 b 10 c 8 +size x 1.6e-05 y 1e-05 z 8e-06 +origin x 0.0 y 0.0 z 0.0 +homogenization 1 + 1 1 2 22 2 2 1 21 21 1 2 2 22 2 1 1 + 1 1 6 26 2 2 5 25 25 5 2 2 26 6 1 1 + 1 1 10 30 2 2 9 29 29 9 2 2 30 10 1 1 + 1 1 14 34 2 2 13 33 33 13 2 2 34 14 1 1 + 1 1 18 38 2 2 17 37 37 17 2 2 38 18 1 1 + 1 1 18 38 2 2 17 37 37 17 2 2 38 18 1 1 + 1 1 14 34 2 2 13 33 33 13 2 2 34 14 1 1 + 1 1 10 30 2 2 9 29 29 9 2 2 30 10 1 1 + 1 1 6 26 2 2 5 25 25 5 2 2 26 6 1 1 + 1 1 2 22 2 2 1 21 21 1 2 2 22 2 1 1 + 1 1 3 23 2 2 2 22 22 2 2 2 23 3 1 1 + 1 1 7 27 2 2 6 26 26 6 2 2 27 7 1 1 + 1 1 11 31 2 2 10 30 30 10 2 2 31 11 1 1 + 1 1 15 35 2 2 14 34 34 14 2 2 35 15 1 1 + 1 1 19 39 2 2 18 38 38 18 2 2 39 19 1 1 + 1 1 19 39 2 2 18 38 38 18 2 2 39 19 1 1 + 1 1 15 35 2 2 14 34 34 14 2 2 35 15 1 1 + 1 1 11 31 2 2 10 30 30 10 2 2 31 11 1 1 + 1 1 7 27 2 2 6 26 26 6 2 2 27 7 1 1 + 1 1 3 23 2 2 2 22 22 2 2 2 23 3 1 1 + 1 1 4 24 2 2 3 23 23 3 2 2 24 4 1 1 + 1 1 8 28 2 2 7 27 27 7 2 2 28 8 1 1 + 1 1 12 32 2 2 11 31 31 11 2 2 32 12 1 1 + 1 1 16 36 2 2 15 35 35 15 2 2 36 16 1 1 + 1 1 20 40 2 2 19 39 39 19 2 2 40 20 1 1 + 1 1 20 40 2 2 19 39 39 19 2 2 40 20 1 1 + 1 1 16 36 2 2 15 35 35 15 2 2 36 16 1 1 + 1 1 12 32 2 2 11 31 31 11 2 2 32 12 1 1 + 1 1 8 28 2 2 7 27 27 7 2 2 28 8 1 1 + 1 1 4 24 2 2 3 23 23 3 2 2 24 4 1 1 + 1 1 5 25 2 2 4 24 24 4 2 2 25 5 1 1 + 1 1 9 29 2 2 8 28 28 8 2 2 29 9 1 1 + 1 1 13 33 2 2 12 32 32 12 2 2 33 13 1 1 + 1 1 17 37 2 2 16 36 36 16 2 2 37 17 1 1 + 1 1 21 41 2 2 20 40 40 20 2 2 41 21 1 1 + 1 1 21 41 2 2 20 40 40 20 2 2 41 21 1 1 + 1 1 17 37 2 2 16 36 36 16 2 2 37 17 1 1 + 1 1 13 33 2 2 12 32 32 12 2 2 33 13 1 1 + 1 1 9 29 2 2 8 28 28 8 2 2 29 9 1 1 + 1 1 5 25 2 2 4 24 24 4 2 2 25 5 1 1 + 1 1 5 25 2 2 4 24 24 4 2 2 25 5 1 1 + 1 1 9 29 2 2 8 28 28 8 2 2 29 9 1 1 + 1 1 13 33 2 2 12 32 32 12 2 2 33 13 1 1 + 1 1 17 37 2 2 16 36 36 16 2 2 37 17 1 1 + 1 1 21 41 2 2 20 40 40 20 2 2 41 21 1 1 + 1 1 21 41 2 2 20 40 40 20 2 2 41 21 1 1 + 1 1 17 37 2 2 16 36 36 16 2 2 37 17 1 1 + 1 1 13 33 2 2 12 32 32 12 2 2 33 13 1 1 + 1 1 9 29 2 2 8 28 28 8 2 2 29 9 1 1 + 1 1 5 25 2 2 4 24 24 4 2 2 25 5 1 1 + 1 1 4 24 2 2 3 23 23 3 2 2 24 4 1 1 + 1 1 8 28 2 2 7 27 27 7 2 2 28 8 1 1 + 1 1 12 32 2 2 11 31 31 11 2 2 32 12 1 1 + 1 1 16 36 2 2 15 35 35 15 2 2 36 16 1 1 + 1 1 20 40 2 2 19 39 39 19 2 2 40 20 1 1 + 1 1 20 40 2 2 19 39 39 19 2 2 40 20 1 1 + 1 1 16 36 2 2 15 35 35 15 2 2 36 16 1 1 + 1 1 12 32 2 2 11 31 31 11 2 2 32 12 1 1 + 1 1 8 28 2 2 7 27 27 7 2 2 28 8 1 1 + 1 1 4 24 2 2 3 23 23 3 2 2 24 4 1 1 + 1 1 3 23 2 2 2 22 22 2 2 2 23 3 1 1 + 1 1 7 27 2 2 6 26 26 6 2 2 27 7 1 1 + 1 1 11 31 2 2 10 30 30 10 2 2 31 11 1 1 + 1 1 15 35 2 2 14 34 34 14 2 2 35 15 1 1 + 1 1 19 39 2 2 18 38 38 18 2 2 39 19 1 1 + 1 1 19 39 2 2 18 38 38 18 2 2 39 19 1 1 + 1 1 15 35 2 2 14 34 34 14 2 2 35 15 1 1 + 1 1 11 31 2 2 10 30 30 10 2 2 31 11 1 1 + 1 1 7 27 2 2 6 26 26 6 2 2 27 7 1 1 + 1 1 3 23 2 2 2 22 22 2 2 2 23 3 1 1 + 1 1 2 22 2 2 1 21 21 1 2 2 22 2 1 1 + 1 1 6 26 2 2 5 25 25 5 2 2 26 6 1 1 + 1 1 10 30 2 2 9 29 29 9 2 2 30 10 1 1 + 1 1 14 34 2 2 13 33 33 13 2 2 34 14 1 1 + 1 1 18 38 2 2 17 37 37 17 2 2 38 18 1 1 + 1 1 18 38 2 2 17 37 37 17 2 2 38 18 1 1 + 1 1 14 34 2 2 13 33 33 13 2 2 34 14 1 1 + 1 1 10 30 2 2 9 29 29 9 2 2 30 10 1 1 + 1 1 6 26 2 2 5 25 25 5 2 2 26 6 1 1 + 1 1 2 22 2 2 1 21 21 1 2 2 22 2 1 1 diff --git a/python/tests/reference/Geom/mirror_directions=x_reflect=False.geom b/python/tests/reference/Geom/mirror_directions=x_reflect=False.geom new file mode 100644 index 000000000..afb3bb5f8 --- /dev/null +++ b/python/tests/reference/Geom/mirror_directions=x_reflect=False.geom @@ -0,0 +1,25 @@ +4 header +grid a 14 b 5 c 4 +size x 1.4e-05 y 5e-06 z 4e-06 +origin x 0.0 y 0.0 z 0.0 +homogenization 1 + 1 1 2 22 2 2 1 21 1 2 2 22 2 1 + 1 1 6 26 2 2 5 25 5 2 2 26 6 1 + 1 1 10 30 2 2 9 29 9 2 2 30 10 1 + 1 1 14 34 2 2 13 33 13 2 2 34 14 1 + 1 1 18 38 2 2 17 37 17 2 2 38 18 1 + 1 1 3 23 2 2 2 22 2 2 2 23 3 1 + 1 1 7 27 2 2 6 26 6 2 2 27 7 1 + 1 1 11 31 2 2 10 30 10 2 2 31 11 1 + 1 1 15 35 2 2 14 34 14 2 2 35 15 1 + 1 1 19 39 2 2 18 38 18 2 2 39 19 1 + 1 1 4 24 2 2 3 23 3 2 2 24 4 1 + 1 1 8 28 2 2 7 27 7 2 2 28 8 1 + 1 1 12 32 2 2 11 31 11 2 2 32 12 1 + 1 1 16 36 2 2 15 35 15 2 2 36 16 1 + 1 1 20 40 2 2 19 39 19 2 2 40 20 1 + 1 1 5 25 2 2 4 24 4 2 2 25 5 1 + 1 1 9 29 2 2 8 28 8 2 2 29 9 1 + 1 1 13 33 2 2 12 32 12 2 2 33 13 1 + 1 1 17 37 2 2 16 36 16 2 2 37 17 1 + 1 1 21 41 2 2 20 40 20 2 2 41 21 1 diff --git a/python/tests/reference/Geom/mirror_directions=y-z_reflect=False.geom b/python/tests/reference/Geom/mirror_directions=y-z_reflect=False.geom new file mode 100644 index 000000000..37d8ae18e --- /dev/null +++ b/python/tests/reference/Geom/mirror_directions=y-z_reflect=False.geom @@ -0,0 +1,53 @@ +4 header +grid a 8 b 8 c 6 +size x 8e-06 y 8.000000000000001e-06 z 6e-06 +origin x 0.0 y 0.0 z 0.0 +homogenization 1 + 1 1 2 22 2 2 1 21 + 1 1 6 26 2 2 5 25 + 1 1 10 30 2 2 9 29 + 1 1 14 34 2 2 13 33 + 1 1 18 38 2 2 17 37 + 1 1 14 34 2 2 13 33 + 1 1 10 30 2 2 9 29 + 1 1 6 26 2 2 5 25 + 1 1 3 23 2 2 2 22 + 1 1 7 27 2 2 6 26 + 1 1 11 31 2 2 10 30 + 1 1 15 35 2 2 14 34 + 1 1 19 39 2 2 18 38 + 1 1 15 35 2 2 14 34 + 1 1 11 31 2 2 10 30 + 1 1 7 27 2 2 6 26 + 1 1 4 24 2 2 3 23 + 1 1 8 28 2 2 7 27 + 1 1 12 32 2 2 11 31 + 1 1 16 36 2 2 15 35 + 1 1 20 40 2 2 19 39 + 1 1 16 36 2 2 15 35 + 1 1 12 32 2 2 11 31 + 1 1 8 28 2 2 7 27 + 1 1 5 25 2 2 4 24 + 1 1 9 29 2 2 8 28 + 1 1 13 33 2 2 12 32 + 1 1 17 37 2 2 16 36 + 1 1 21 41 2 2 20 40 + 1 1 17 37 2 2 16 36 + 1 1 13 33 2 2 12 32 + 1 1 9 29 2 2 8 28 + 1 1 4 24 2 2 3 23 + 1 1 8 28 2 2 7 27 + 1 1 12 32 2 2 11 31 + 1 1 16 36 2 2 15 35 + 1 1 20 40 2 2 19 39 + 1 1 16 36 2 2 15 35 + 1 1 12 32 2 2 11 31 + 1 1 8 28 2 2 7 27 + 1 1 3 23 2 2 2 22 + 1 1 7 27 2 2 6 26 + 1 1 11 31 2 2 10 30 + 1 1 15 35 2 2 14 34 + 1 1 19 39 2 2 18 38 + 1 1 15 35 2 2 14 34 + 1 1 11 31 2 2 10 30 + 1 1 7 27 2 2 6 26 diff --git a/python/tests/reference/Geom/mirror_directions=z-x-y_reflect=False.geom b/python/tests/reference/Geom/mirror_directions=z-x-y_reflect=False.geom new file mode 100644 index 000000000..5d7c23eb0 --- /dev/null +++ b/python/tests/reference/Geom/mirror_directions=z-x-y_reflect=False.geom @@ -0,0 +1,53 @@ +4 header +grid a 14 b 8 c 6 +size x 1.4e-05 y 8.000000000000001e-06 z 6e-06 +origin x 0.0 y 0.0 z 0.0 +homogenization 1 + 1 1 2 22 2 2 1 21 1 2 2 22 2 1 + 1 1 6 26 2 2 5 25 5 2 2 26 6 1 + 1 1 10 30 2 2 9 29 9 2 2 30 10 1 + 1 1 14 34 2 2 13 33 13 2 2 34 14 1 + 1 1 18 38 2 2 17 37 17 2 2 38 18 1 + 1 1 14 34 2 2 13 33 13 2 2 34 14 1 + 1 1 10 30 2 2 9 29 9 2 2 30 10 1 + 1 1 6 26 2 2 5 25 5 2 2 26 6 1 + 1 1 3 23 2 2 2 22 2 2 2 23 3 1 + 1 1 7 27 2 2 6 26 6 2 2 27 7 1 + 1 1 11 31 2 2 10 30 10 2 2 31 11 1 + 1 1 15 35 2 2 14 34 14 2 2 35 15 1 + 1 1 19 39 2 2 18 38 18 2 2 39 19 1 + 1 1 15 35 2 2 14 34 14 2 2 35 15 1 + 1 1 11 31 2 2 10 30 10 2 2 31 11 1 + 1 1 7 27 2 2 6 26 6 2 2 27 7 1 + 1 1 4 24 2 2 3 23 3 2 2 24 4 1 + 1 1 8 28 2 2 7 27 7 2 2 28 8 1 + 1 1 12 32 2 2 11 31 11 2 2 32 12 1 + 1 1 16 36 2 2 15 35 15 2 2 36 16 1 + 1 1 20 40 2 2 19 39 19 2 2 40 20 1 + 1 1 16 36 2 2 15 35 15 2 2 36 16 1 + 1 1 12 32 2 2 11 31 11 2 2 32 12 1 + 1 1 8 28 2 2 7 27 7 2 2 28 8 1 + 1 1 5 25 2 2 4 24 4 2 2 25 5 1 + 1 1 9 29 2 2 8 28 8 2 2 29 9 1 + 1 1 13 33 2 2 12 32 12 2 2 33 13 1 + 1 1 17 37 2 2 16 36 16 2 2 37 17 1 + 1 1 21 41 2 2 20 40 20 2 2 41 21 1 + 1 1 17 37 2 2 16 36 16 2 2 37 17 1 + 1 1 13 33 2 2 12 32 12 2 2 33 13 1 + 1 1 9 29 2 2 8 28 8 2 2 29 9 1 + 1 1 4 24 2 2 3 23 3 2 2 24 4 1 + 1 1 8 28 2 2 7 27 7 2 2 28 8 1 + 1 1 12 32 2 2 11 31 11 2 2 32 12 1 + 1 1 16 36 2 2 15 35 15 2 2 36 16 1 + 1 1 20 40 2 2 19 39 19 2 2 40 20 1 + 1 1 16 36 2 2 15 35 15 2 2 36 16 1 + 1 1 12 32 2 2 11 31 11 2 2 32 12 1 + 1 1 8 28 2 2 7 27 7 2 2 28 8 1 + 1 1 3 23 2 2 2 22 2 2 2 23 3 1 + 1 1 7 27 2 2 6 26 6 2 2 27 7 1 + 1 1 11 31 2 2 10 30 10 2 2 31 11 1 + 1 1 15 35 2 2 14 34 14 2 2 35 15 1 + 1 1 19 39 2 2 18 38 18 2 2 39 19 1 + 1 1 15 35 2 2 14 34 14 2 2 35 15 1 + 1 1 11 31 2 2 10 30 10 2 2 31 11 1 + 1 1 7 27 2 2 6 26 6 2 2 27 7 1 diff --git a/python/tests/reference/Geom/scale_grid=10-10-10.geom b/python/tests/reference/Geom/scale_grid=10-10-10.geom new file mode 100644 index 000000000..43587a615 --- /dev/null +++ b/python/tests/reference/Geom/scale_grid=10-10-10.geom @@ -0,0 +1,105 @@ +4 header +grid a 10 b 10 c 10 +size x 8e-06 y 5e-06 z 4e-06 +origin x 0.0 y 0.0 z 0.0 +homogenization 1 + 1 1 2 2 22 2 2 2 1 21 + 1 1 2 2 22 2 2 2 1 21 + 1 1 6 6 26 2 2 2 5 25 + 1 1 6 6 26 2 2 2 5 25 + 1 1 10 10 30 2 2 2 9 29 + 1 1 10 10 30 2 2 2 9 29 + 1 1 14 14 34 2 2 2 13 33 + 1 1 14 14 34 2 2 2 13 33 + 1 1 18 18 38 2 2 2 17 37 + 1 1 18 18 38 2 2 2 17 37 + 1 1 2 2 22 2 2 2 1 21 + 1 1 2 2 22 2 2 2 1 21 + 1 1 6 6 26 2 2 2 5 25 + 1 1 6 6 26 2 2 2 5 25 + 1 1 10 10 30 2 2 2 9 29 + 1 1 10 10 30 2 2 2 9 29 + 1 1 14 14 34 2 2 2 13 33 + 1 1 14 14 34 2 2 2 13 33 + 1 1 18 18 38 2 2 2 17 37 + 1 1 18 18 38 2 2 2 17 37 + 1 1 3 3 23 2 2 2 2 22 + 1 1 3 3 23 2 2 2 2 22 + 1 1 7 7 27 2 2 2 6 26 + 1 1 7 7 27 2 2 2 6 26 + 1 1 11 11 31 2 2 2 10 30 + 1 1 11 11 31 2 2 2 10 30 + 1 1 15 15 35 2 2 2 14 34 + 1 1 15 15 35 2 2 2 14 34 + 1 1 19 19 39 2 2 2 18 38 + 1 1 19 19 39 2 2 2 18 38 + 1 1 3 3 23 2 2 2 2 22 + 1 1 3 3 23 2 2 2 2 22 + 1 1 7 7 27 2 2 2 6 26 + 1 1 7 7 27 2 2 2 6 26 + 1 1 11 11 31 2 2 2 10 30 + 1 1 11 11 31 2 2 2 10 30 + 1 1 15 15 35 2 2 2 14 34 + 1 1 15 15 35 2 2 2 14 34 + 1 1 19 19 39 2 2 2 18 38 + 1 1 19 19 39 2 2 2 18 38 + 1 1 3 3 23 2 2 2 2 22 + 1 1 3 3 23 2 2 2 2 22 + 1 1 7 7 27 2 2 2 6 26 + 1 1 7 7 27 2 2 2 6 26 + 1 1 11 11 31 2 2 2 10 30 + 1 1 11 11 31 2 2 2 10 30 + 1 1 15 15 35 2 2 2 14 34 + 1 1 15 15 35 2 2 2 14 34 + 1 1 19 19 39 2 2 2 18 38 + 1 1 19 19 39 2 2 2 18 38 + 1 1 4 4 24 2 2 2 3 23 + 1 1 4 4 24 2 2 2 3 23 + 1 1 8 8 28 2 2 2 7 27 + 1 1 8 8 28 2 2 2 7 27 + 1 1 12 12 32 2 2 2 11 31 + 1 1 12 12 32 2 2 2 11 31 + 1 1 16 16 36 2 2 2 15 35 + 1 1 16 16 36 2 2 2 15 35 + 1 1 20 20 40 2 2 2 19 39 + 1 1 20 20 40 2 2 2 19 39 + 1 1 4 4 24 2 2 2 3 23 + 1 1 4 4 24 2 2 2 3 23 + 1 1 8 8 28 2 2 2 7 27 + 1 1 8 8 28 2 2 2 7 27 + 1 1 12 12 32 2 2 2 11 31 + 1 1 12 12 32 2 2 2 11 31 + 1 1 16 16 36 2 2 2 15 35 + 1 1 16 16 36 2 2 2 15 35 + 1 1 20 20 40 2 2 2 19 39 + 1 1 20 20 40 2 2 2 19 39 + 1 1 4 4 24 2 2 2 3 23 + 1 1 4 4 24 2 2 2 3 23 + 1 1 8 8 28 2 2 2 7 27 + 1 1 8 8 28 2 2 2 7 27 + 1 1 12 12 32 2 2 2 11 31 + 1 1 12 12 32 2 2 2 11 31 + 1 1 16 16 36 2 2 2 15 35 + 1 1 16 16 36 2 2 2 15 35 + 1 1 20 20 40 2 2 2 19 39 + 1 1 20 20 40 2 2 2 19 39 + 1 1 5 5 25 2 2 2 4 24 + 1 1 5 5 25 2 2 2 4 24 + 1 1 9 9 29 2 2 2 8 28 + 1 1 9 9 29 2 2 2 8 28 + 1 1 13 13 33 2 2 2 12 32 + 1 1 13 13 33 2 2 2 12 32 + 1 1 17 17 37 2 2 2 16 36 + 1 1 17 17 37 2 2 2 16 36 + 1 1 21 21 41 2 2 2 20 40 + 1 1 21 21 41 2 2 2 20 40 + 1 1 5 5 25 2 2 2 4 24 + 1 1 5 5 25 2 2 2 4 24 + 1 1 9 9 29 2 2 2 8 28 + 1 1 9 9 29 2 2 2 8 28 + 1 1 13 13 33 2 2 2 12 32 + 1 1 13 13 33 2 2 2 12 32 + 1 1 17 17 37 2 2 2 16 36 + 1 1 17 17 37 2 2 2 16 36 + 1 1 21 21 41 2 2 2 20 40 + 1 1 21 21 41 2 2 2 20 40 diff --git a/python/tests/reference/Geom/scale_grid=10-11-10.geom b/python/tests/reference/Geom/scale_grid=10-11-10.geom new file mode 100644 index 000000000..e12fc64fc --- /dev/null +++ b/python/tests/reference/Geom/scale_grid=10-11-10.geom @@ -0,0 +1,115 @@ +4 header +grid a 10 b 11 c 10 +size x 8e-06 y 5e-06 z 4e-06 +origin x 0.0 y 0.0 z 0.0 +homogenization 1 + 1 1 2 2 22 2 2 2 1 21 + 1 1 2 2 22 2 2 2 1 21 + 1 1 6 6 26 2 2 2 5 25 + 1 1 6 6 26 2 2 2 5 25 + 1 1 10 10 30 2 2 2 9 29 + 1 1 10 10 30 2 2 2 9 29 + 1 1 10 10 30 2 2 2 9 29 + 1 1 14 14 34 2 2 2 13 33 + 1 1 14 14 34 2 2 2 13 33 + 1 1 18 18 38 2 2 2 17 37 + 1 1 18 18 38 2 2 2 17 37 + 1 1 2 2 22 2 2 2 1 21 + 1 1 2 2 22 2 2 2 1 21 + 1 1 6 6 26 2 2 2 5 25 + 1 1 6 6 26 2 2 2 5 25 + 1 1 10 10 30 2 2 2 9 29 + 1 1 10 10 30 2 2 2 9 29 + 1 1 10 10 30 2 2 2 9 29 + 1 1 14 14 34 2 2 2 13 33 + 1 1 14 14 34 2 2 2 13 33 + 1 1 18 18 38 2 2 2 17 37 + 1 1 18 18 38 2 2 2 17 37 + 1 1 3 3 23 2 2 2 2 22 + 1 1 3 3 23 2 2 2 2 22 + 1 1 7 7 27 2 2 2 6 26 + 1 1 7 7 27 2 2 2 6 26 + 1 1 11 11 31 2 2 2 10 30 + 1 1 11 11 31 2 2 2 10 30 + 1 1 11 11 31 2 2 2 10 30 + 1 1 15 15 35 2 2 2 14 34 + 1 1 15 15 35 2 2 2 14 34 + 1 1 19 19 39 2 2 2 18 38 + 1 1 19 19 39 2 2 2 18 38 + 1 1 3 3 23 2 2 2 2 22 + 1 1 3 3 23 2 2 2 2 22 + 1 1 7 7 27 2 2 2 6 26 + 1 1 7 7 27 2 2 2 6 26 + 1 1 11 11 31 2 2 2 10 30 + 1 1 11 11 31 2 2 2 10 30 + 1 1 11 11 31 2 2 2 10 30 + 1 1 15 15 35 2 2 2 14 34 + 1 1 15 15 35 2 2 2 14 34 + 1 1 19 19 39 2 2 2 18 38 + 1 1 19 19 39 2 2 2 18 38 + 1 1 3 3 23 2 2 2 2 22 + 1 1 3 3 23 2 2 2 2 22 + 1 1 7 7 27 2 2 2 6 26 + 1 1 7 7 27 2 2 2 6 26 + 1 1 11 11 31 2 2 2 10 30 + 1 1 11 11 31 2 2 2 10 30 + 1 1 11 11 31 2 2 2 10 30 + 1 1 15 15 35 2 2 2 14 34 + 1 1 15 15 35 2 2 2 14 34 + 1 1 19 19 39 2 2 2 18 38 + 1 1 19 19 39 2 2 2 18 38 + 1 1 4 4 24 2 2 2 3 23 + 1 1 4 4 24 2 2 2 3 23 + 1 1 8 8 28 2 2 2 7 27 + 1 1 8 8 28 2 2 2 7 27 + 1 1 12 12 32 2 2 2 11 31 + 1 1 12 12 32 2 2 2 11 31 + 1 1 12 12 32 2 2 2 11 31 + 1 1 16 16 36 2 2 2 15 35 + 1 1 16 16 36 2 2 2 15 35 + 1 1 20 20 40 2 2 2 19 39 + 1 1 20 20 40 2 2 2 19 39 + 1 1 4 4 24 2 2 2 3 23 + 1 1 4 4 24 2 2 2 3 23 + 1 1 8 8 28 2 2 2 7 27 + 1 1 8 8 28 2 2 2 7 27 + 1 1 12 12 32 2 2 2 11 31 + 1 1 12 12 32 2 2 2 11 31 + 1 1 12 12 32 2 2 2 11 31 + 1 1 16 16 36 2 2 2 15 35 + 1 1 16 16 36 2 2 2 15 35 + 1 1 20 20 40 2 2 2 19 39 + 1 1 20 20 40 2 2 2 19 39 + 1 1 4 4 24 2 2 2 3 23 + 1 1 4 4 24 2 2 2 3 23 + 1 1 8 8 28 2 2 2 7 27 + 1 1 8 8 28 2 2 2 7 27 + 1 1 12 12 32 2 2 2 11 31 + 1 1 12 12 32 2 2 2 11 31 + 1 1 12 12 32 2 2 2 11 31 + 1 1 16 16 36 2 2 2 15 35 + 1 1 16 16 36 2 2 2 15 35 + 1 1 20 20 40 2 2 2 19 39 + 1 1 20 20 40 2 2 2 19 39 + 1 1 5 5 25 2 2 2 4 24 + 1 1 5 5 25 2 2 2 4 24 + 1 1 9 9 29 2 2 2 8 28 + 1 1 9 9 29 2 2 2 8 28 + 1 1 13 13 33 2 2 2 12 32 + 1 1 13 13 33 2 2 2 12 32 + 1 1 13 13 33 2 2 2 12 32 + 1 1 17 17 37 2 2 2 16 36 + 1 1 17 17 37 2 2 2 16 36 + 1 1 21 21 41 2 2 2 20 40 + 1 1 21 21 41 2 2 2 20 40 + 1 1 5 5 25 2 2 2 4 24 + 1 1 5 5 25 2 2 2 4 24 + 1 1 9 9 29 2 2 2 8 28 + 1 1 9 9 29 2 2 2 8 28 + 1 1 13 13 33 2 2 2 12 32 + 1 1 13 13 33 2 2 2 12 32 + 1 1 13 13 33 2 2 2 12 32 + 1 1 17 17 37 2 2 2 16 36 + 1 1 17 17 37 2 2 2 16 36 + 1 1 21 21 41 2 2 2 20 40 + 1 1 21 21 41 2 2 2 20 40 diff --git a/python/tests/reference/Geom/scale_grid=10-13-10.geom b/python/tests/reference/Geom/scale_grid=10-13-10.geom new file mode 100644 index 000000000..cbe4afc00 --- /dev/null +++ b/python/tests/reference/Geom/scale_grid=10-13-10.geom @@ -0,0 +1,135 @@ +4 header +grid a 10 b 13 c 10 +size x 8e-06 y 5e-06 z 4e-06 +origin x 0.0 y 0.0 z 0.0 +homogenization 1 + 1 1 2 2 22 2 2 2 1 21 + 1 1 2 2 22 2 2 2 1 21 + 1 1 6 6 26 2 2 2 5 25 + 1 1 6 6 26 2 2 2 5 25 + 1 1 6 6 26 2 2 2 5 25 + 1 1 10 10 30 2 2 2 9 29 + 1 1 10 10 30 2 2 2 9 29 + 1 1 10 10 30 2 2 2 9 29 + 1 1 14 14 34 2 2 2 13 33 + 1 1 14 14 34 2 2 2 13 33 + 1 1 14 14 34 2 2 2 13 33 + 1 1 18 18 38 2 2 2 17 37 + 1 1 18 18 38 2 2 2 17 37 + 1 1 2 2 22 2 2 2 1 21 + 1 1 2 2 22 2 2 2 1 21 + 1 1 6 6 26 2 2 2 5 25 + 1 1 6 6 26 2 2 2 5 25 + 1 1 6 6 26 2 2 2 5 25 + 1 1 10 10 30 2 2 2 9 29 + 1 1 10 10 30 2 2 2 9 29 + 1 1 10 10 30 2 2 2 9 29 + 1 1 14 14 34 2 2 2 13 33 + 1 1 14 14 34 2 2 2 13 33 + 1 1 14 14 34 2 2 2 13 33 + 1 1 18 18 38 2 2 2 17 37 + 1 1 18 18 38 2 2 2 17 37 + 1 1 3 3 23 2 2 2 2 22 + 1 1 3 3 23 2 2 2 2 22 + 1 1 7 7 27 2 2 2 6 26 + 1 1 7 7 27 2 2 2 6 26 + 1 1 7 7 27 2 2 2 6 26 + 1 1 11 11 31 2 2 2 10 30 + 1 1 11 11 31 2 2 2 10 30 + 1 1 11 11 31 2 2 2 10 30 + 1 1 15 15 35 2 2 2 14 34 + 1 1 15 15 35 2 2 2 14 34 + 1 1 15 15 35 2 2 2 14 34 + 1 1 19 19 39 2 2 2 18 38 + 1 1 19 19 39 2 2 2 18 38 + 1 1 3 3 23 2 2 2 2 22 + 1 1 3 3 23 2 2 2 2 22 + 1 1 7 7 27 2 2 2 6 26 + 1 1 7 7 27 2 2 2 6 26 + 1 1 7 7 27 2 2 2 6 26 + 1 1 11 11 31 2 2 2 10 30 + 1 1 11 11 31 2 2 2 10 30 + 1 1 11 11 31 2 2 2 10 30 + 1 1 15 15 35 2 2 2 14 34 + 1 1 15 15 35 2 2 2 14 34 + 1 1 15 15 35 2 2 2 14 34 + 1 1 19 19 39 2 2 2 18 38 + 1 1 19 19 39 2 2 2 18 38 + 1 1 3 3 23 2 2 2 2 22 + 1 1 3 3 23 2 2 2 2 22 + 1 1 7 7 27 2 2 2 6 26 + 1 1 7 7 27 2 2 2 6 26 + 1 1 7 7 27 2 2 2 6 26 + 1 1 11 11 31 2 2 2 10 30 + 1 1 11 11 31 2 2 2 10 30 + 1 1 11 11 31 2 2 2 10 30 + 1 1 15 15 35 2 2 2 14 34 + 1 1 15 15 35 2 2 2 14 34 + 1 1 15 15 35 2 2 2 14 34 + 1 1 19 19 39 2 2 2 18 38 + 1 1 19 19 39 2 2 2 18 38 + 1 1 4 4 24 2 2 2 3 23 + 1 1 4 4 24 2 2 2 3 23 + 1 1 8 8 28 2 2 2 7 27 + 1 1 8 8 28 2 2 2 7 27 + 1 1 8 8 28 2 2 2 7 27 + 1 1 12 12 32 2 2 2 11 31 + 1 1 12 12 32 2 2 2 11 31 + 1 1 12 12 32 2 2 2 11 31 + 1 1 16 16 36 2 2 2 15 35 + 1 1 16 16 36 2 2 2 15 35 + 1 1 16 16 36 2 2 2 15 35 + 1 1 20 20 40 2 2 2 19 39 + 1 1 20 20 40 2 2 2 19 39 + 1 1 4 4 24 2 2 2 3 23 + 1 1 4 4 24 2 2 2 3 23 + 1 1 8 8 28 2 2 2 7 27 + 1 1 8 8 28 2 2 2 7 27 + 1 1 8 8 28 2 2 2 7 27 + 1 1 12 12 32 2 2 2 11 31 + 1 1 12 12 32 2 2 2 11 31 + 1 1 12 12 32 2 2 2 11 31 + 1 1 16 16 36 2 2 2 15 35 + 1 1 16 16 36 2 2 2 15 35 + 1 1 16 16 36 2 2 2 15 35 + 1 1 20 20 40 2 2 2 19 39 + 1 1 20 20 40 2 2 2 19 39 + 1 1 4 4 24 2 2 2 3 23 + 1 1 4 4 24 2 2 2 3 23 + 1 1 8 8 28 2 2 2 7 27 + 1 1 8 8 28 2 2 2 7 27 + 1 1 8 8 28 2 2 2 7 27 + 1 1 12 12 32 2 2 2 11 31 + 1 1 12 12 32 2 2 2 11 31 + 1 1 12 12 32 2 2 2 11 31 + 1 1 16 16 36 2 2 2 15 35 + 1 1 16 16 36 2 2 2 15 35 + 1 1 16 16 36 2 2 2 15 35 + 1 1 20 20 40 2 2 2 19 39 + 1 1 20 20 40 2 2 2 19 39 + 1 1 5 5 25 2 2 2 4 24 + 1 1 5 5 25 2 2 2 4 24 + 1 1 9 9 29 2 2 2 8 28 + 1 1 9 9 29 2 2 2 8 28 + 1 1 9 9 29 2 2 2 8 28 + 1 1 13 13 33 2 2 2 12 32 + 1 1 13 13 33 2 2 2 12 32 + 1 1 13 13 33 2 2 2 12 32 + 1 1 17 17 37 2 2 2 16 36 + 1 1 17 17 37 2 2 2 16 36 + 1 1 17 17 37 2 2 2 16 36 + 1 1 21 21 41 2 2 2 20 40 + 1 1 21 21 41 2 2 2 20 40 + 1 1 5 5 25 2 2 2 4 24 + 1 1 5 5 25 2 2 2 4 24 + 1 1 9 9 29 2 2 2 8 28 + 1 1 9 9 29 2 2 2 8 28 + 1 1 9 9 29 2 2 2 8 28 + 1 1 13 13 33 2 2 2 12 32 + 1 1 13 13 33 2 2 2 12 32 + 1 1 13 13 33 2 2 2 12 32 + 1 1 17 17 37 2 2 2 16 36 + 1 1 17 17 37 2 2 2 16 36 + 1 1 17 17 37 2 2 2 16 36 + 1 1 21 21 41 2 2 2 20 40 + 1 1 21 21 41 2 2 2 20 40 diff --git a/python/tests/reference/Geom/scale_grid=10-20-2.geom b/python/tests/reference/Geom/scale_grid=10-20-2.geom new file mode 100644 index 000000000..6b1888f17 --- /dev/null +++ b/python/tests/reference/Geom/scale_grid=10-20-2.geom @@ -0,0 +1,45 @@ +4 header +grid a 10 b 20 c 2 +size x 8e-06 y 5e-06 z 4e-06 +origin x 0.0 y 0.0 z 0.0 +homogenization 1 + 1 1 2 2 22 2 2 2 1 21 + 1 1 2 2 22 2 2 2 1 21 + 1 1 2 2 22 2 2 2 1 21 + 1 1 6 6 26 2 2 2 5 25 + 1 1 6 6 26 2 2 2 5 25 + 1 1 6 6 26 2 2 2 5 25 + 1 1 6 6 26 2 2 2 5 25 + 1 1 6 6 26 2 2 2 5 25 + 1 1 10 10 30 2 2 2 9 29 + 1 1 10 10 30 2 2 2 9 29 + 1 1 10 10 30 2 2 2 9 29 + 1 1 10 10 30 2 2 2 9 29 + 1 1 14 14 34 2 2 2 13 33 + 1 1 14 14 34 2 2 2 13 33 + 1 1 14 14 34 2 2 2 13 33 + 1 1 14 14 34 2 2 2 13 33 + 1 1 14 14 34 2 2 2 13 33 + 1 1 18 18 38 2 2 2 17 37 + 1 1 18 18 38 2 2 2 17 37 + 1 1 18 18 38 2 2 2 17 37 + 1 1 5 5 25 2 2 2 4 24 + 1 1 5 5 25 2 2 2 4 24 + 1 1 5 5 25 2 2 2 4 24 + 1 1 9 9 29 2 2 2 8 28 + 1 1 9 9 29 2 2 2 8 28 + 1 1 9 9 29 2 2 2 8 28 + 1 1 9 9 29 2 2 2 8 28 + 1 1 9 9 29 2 2 2 8 28 + 1 1 13 13 33 2 2 2 12 32 + 1 1 13 13 33 2 2 2 12 32 + 1 1 13 13 33 2 2 2 12 32 + 1 1 13 13 33 2 2 2 12 32 + 1 1 17 17 37 2 2 2 16 36 + 1 1 17 17 37 2 2 2 16 36 + 1 1 17 17 37 2 2 2 16 36 + 1 1 17 17 37 2 2 2 16 36 + 1 1 17 17 37 2 2 2 16 36 + 1 1 21 21 41 2 2 2 20 40 + 1 1 21 21 41 2 2 2 20 40 + 1 1 21 21 41 2 2 2 20 40 diff --git a/python/tests/reference/Geom/scale_grid=5-4-20.geom b/python/tests/reference/Geom/scale_grid=5-4-20.geom new file mode 100644 index 000000000..043683f6a --- /dev/null +++ b/python/tests/reference/Geom/scale_grid=5-4-20.geom @@ -0,0 +1,85 @@ +4 header +grid a 5 b 4 c 20 +size x 8e-06 y 5e-06 z 4e-06 +origin x 0.0 y 0.0 z 0.0 +homogenization 1 + 1 2 2 2 21 + 1 6 2 2 25 + 1 14 2 2 33 + 1 18 2 2 37 + 1 2 2 2 21 + 1 6 2 2 25 + 1 14 2 2 33 + 1 18 2 2 37 + 1 2 2 2 21 + 1 6 2 2 25 + 1 14 2 2 33 + 1 18 2 2 37 + 1 2 2 2 21 + 1 6 2 2 25 + 1 14 2 2 33 + 1 18 2 2 37 + 1 3 2 2 22 + 1 7 2 2 26 + 1 15 2 2 34 + 1 19 2 2 38 + 1 3 2 2 22 + 1 7 2 2 26 + 1 15 2 2 34 + 1 19 2 2 38 + 1 3 2 2 22 + 1 7 2 2 26 + 1 15 2 2 34 + 1 19 2 2 38 + 1 3 2 2 22 + 1 7 2 2 26 + 1 15 2 2 34 + 1 19 2 2 38 + 1 3 2 2 22 + 1 7 2 2 26 + 1 15 2 2 34 + 1 19 2 2 38 + 1 3 2 2 22 + 1 7 2 2 26 + 1 15 2 2 34 + 1 19 2 2 38 + 1 4 2 2 23 + 1 8 2 2 27 + 1 16 2 2 35 + 1 20 2 2 39 + 1 4 2 2 23 + 1 8 2 2 27 + 1 16 2 2 35 + 1 20 2 2 39 + 1 4 2 2 23 + 1 8 2 2 27 + 1 16 2 2 35 + 1 20 2 2 39 + 1 4 2 2 23 + 1 8 2 2 27 + 1 16 2 2 35 + 1 20 2 2 39 + 1 4 2 2 23 + 1 8 2 2 27 + 1 16 2 2 35 + 1 20 2 2 39 + 1 4 2 2 23 + 1 8 2 2 27 + 1 16 2 2 35 + 1 20 2 2 39 + 1 5 2 2 24 + 1 9 2 2 28 + 1 17 2 2 36 + 1 21 2 2 40 + 1 5 2 2 24 + 1 9 2 2 28 + 1 17 2 2 36 + 1 21 2 2 40 + 1 5 2 2 24 + 1 9 2 2 28 + 1 17 2 2 36 + 1 21 2 2 40 + 1 5 2 2 24 + 1 9 2 2 28 + 1 17 2 2 36 + 1 21 2 2 40 diff --git a/python/tests/reference/Geom/scale_grid=8-10-12.geom b/python/tests/reference/Geom/scale_grid=8-10-12.geom new file mode 100644 index 000000000..5cfe66aba --- /dev/null +++ b/python/tests/reference/Geom/scale_grid=8-10-12.geom @@ -0,0 +1,125 @@ +4 header +grid a 8 b 10 c 12 +size x 8e-06 y 5e-06 z 4e-06 +origin x 0.0 y 0.0 z 0.0 +homogenization 1 + 1 1 2 22 2 2 1 21 + 1 1 2 22 2 2 1 21 + 1 1 6 26 2 2 5 25 + 1 1 6 26 2 2 5 25 + 1 1 10 30 2 2 9 29 + 1 1 10 30 2 2 9 29 + 1 1 14 34 2 2 13 33 + 1 1 14 34 2 2 13 33 + 1 1 18 38 2 2 17 37 + 1 1 18 38 2 2 17 37 + 1 1 2 22 2 2 1 21 + 1 1 2 22 2 2 1 21 + 1 1 6 26 2 2 5 25 + 1 1 6 26 2 2 5 25 + 1 1 10 30 2 2 9 29 + 1 1 10 30 2 2 9 29 + 1 1 14 34 2 2 13 33 + 1 1 14 34 2 2 13 33 + 1 1 18 38 2 2 17 37 + 1 1 18 38 2 2 17 37 + 1 1 3 23 2 2 2 22 + 1 1 3 23 2 2 2 22 + 1 1 7 27 2 2 6 26 + 1 1 7 27 2 2 6 26 + 1 1 11 31 2 2 10 30 + 1 1 11 31 2 2 10 30 + 1 1 15 35 2 2 14 34 + 1 1 15 35 2 2 14 34 + 1 1 19 39 2 2 18 38 + 1 1 19 39 2 2 18 38 + 1 1 3 23 2 2 2 22 + 1 1 3 23 2 2 2 22 + 1 1 7 27 2 2 6 26 + 1 1 7 27 2 2 6 26 + 1 1 11 31 2 2 10 30 + 1 1 11 31 2 2 10 30 + 1 1 15 35 2 2 14 34 + 1 1 15 35 2 2 14 34 + 1 1 19 39 2 2 18 38 + 1 1 19 39 2 2 18 38 + 1 1 3 23 2 2 2 22 + 1 1 3 23 2 2 2 22 + 1 1 7 27 2 2 6 26 + 1 1 7 27 2 2 6 26 + 1 1 11 31 2 2 10 30 + 1 1 11 31 2 2 10 30 + 1 1 15 35 2 2 14 34 + 1 1 15 35 2 2 14 34 + 1 1 19 39 2 2 18 38 + 1 1 19 39 2 2 18 38 + 1 1 3 23 2 2 2 22 + 1 1 3 23 2 2 2 22 + 1 1 7 27 2 2 6 26 + 1 1 7 27 2 2 6 26 + 1 1 11 31 2 2 10 30 + 1 1 11 31 2 2 10 30 + 1 1 15 35 2 2 14 34 + 1 1 15 35 2 2 14 34 + 1 1 19 39 2 2 18 38 + 1 1 19 39 2 2 18 38 + 1 1 4 24 2 2 3 23 + 1 1 4 24 2 2 3 23 + 1 1 8 28 2 2 7 27 + 1 1 8 28 2 2 7 27 + 1 1 12 32 2 2 11 31 + 1 1 12 32 2 2 11 31 + 1 1 16 36 2 2 15 35 + 1 1 16 36 2 2 15 35 + 1 1 20 40 2 2 19 39 + 1 1 20 40 2 2 19 39 + 1 1 4 24 2 2 3 23 + 1 1 4 24 2 2 3 23 + 1 1 8 28 2 2 7 27 + 1 1 8 28 2 2 7 27 + 1 1 12 32 2 2 11 31 + 1 1 12 32 2 2 11 31 + 1 1 16 36 2 2 15 35 + 1 1 16 36 2 2 15 35 + 1 1 20 40 2 2 19 39 + 1 1 20 40 2 2 19 39 + 1 1 4 24 2 2 3 23 + 1 1 4 24 2 2 3 23 + 1 1 8 28 2 2 7 27 + 1 1 8 28 2 2 7 27 + 1 1 12 32 2 2 11 31 + 1 1 12 32 2 2 11 31 + 1 1 16 36 2 2 15 35 + 1 1 16 36 2 2 15 35 + 1 1 20 40 2 2 19 39 + 1 1 20 40 2 2 19 39 + 1 1 4 24 2 2 3 23 + 1 1 4 24 2 2 3 23 + 1 1 8 28 2 2 7 27 + 1 1 8 28 2 2 7 27 + 1 1 12 32 2 2 11 31 + 1 1 12 32 2 2 11 31 + 1 1 16 36 2 2 15 35 + 1 1 16 36 2 2 15 35 + 1 1 20 40 2 2 19 39 + 1 1 20 40 2 2 19 39 + 1 1 5 25 2 2 4 24 + 1 1 5 25 2 2 4 24 + 1 1 9 29 2 2 8 28 + 1 1 9 29 2 2 8 28 + 1 1 13 33 2 2 12 32 + 1 1 13 33 2 2 12 32 + 1 1 17 37 2 2 16 36 + 1 1 17 37 2 2 16 36 + 1 1 21 41 2 2 20 40 + 1 1 21 41 2 2 20 40 + 1 1 5 25 2 2 4 24 + 1 1 5 25 2 2 4 24 + 1 1 9 29 2 2 8 28 + 1 1 9 29 2 2 8 28 + 1 1 13 33 2 2 12 32 + 1 1 13 33 2 2 12 32 + 1 1 17 37 2 2 16 36 + 1 1 17 37 2 2 16 36 + 1 1 21 41 2 2 20 40 + 1 1 21 41 2 2 20 40 diff --git a/python/tests/test_DADF5.py b/python/tests/test_DADF5.py new file mode 100644 index 000000000..5a6478f03 --- /dev/null +++ b/python/tests/test_DADF5.py @@ -0,0 +1,67 @@ +import shutil +import os + +import pytest +import numpy as np + +from damask import DADF5 +from damask import mechanics + +@pytest.fixture +def default(tmp_path,reference_dir): + """Small DADF5 file in temp location for modification.""" + fname = '12grains6x7x8_tensionY.hdf5' + shutil.copy(os.path.join(reference_dir,fname),tmp_path) + f = DADF5(os.path.join(tmp_path,fname)) + f.set_by_time(20.0,20.0) + return f + +@pytest.fixture +def reference_dir(reference_dir_base): + """Directory containing reference results.""" + return os.path.join(reference_dir_base,'DADF5') + + +class TestDADF5: + + def test_add_deviator(self,default): + default.add_deviator('P') + loc = {'P' :default.get_dataset_location('P'), + 's_P':default.get_dataset_location('s_P')} + in_memory = mechanics.deviatoric_part(default.read_dataset(loc['P'],0)) + in_file = default.read_dataset(loc['s_P'],0) + assert np.allclose(in_memory,in_file) + + def test_add_Cauchy(self,default): + default.add_Cauchy('P','F') + loc = {'F': default.get_dataset_location('F'), + 'P': default.get_dataset_location('P'), + 'sigma':default.get_dataset_location('sigma')} + in_memory = mechanics.Cauchy(default.read_dataset(loc['F'],0), + default.read_dataset(loc['P'],0)) + in_file = default.read_dataset(loc['sigma'],0) + assert np.allclose(in_memory,in_file) + + def test_add_absolute(self,default): + default.add_absolute('Fe') + loc = {'Fe': default.get_dataset_location('Fe'), + '|Fe|': default.get_dataset_location('|Fe|')} + in_memory = np.abs(default.read_dataset(loc['Fe'],0)) + in_file = default.read_dataset(loc['|Fe|'],0) + assert np.allclose(in_memory,in_file) + + def test_add_determinant(self,default): + default.add_determinant('P') + loc = {'P': default.get_dataset_location('P'), + 'det(P)': default.get_dataset_location('det(P)')} + in_memory = np.linalg.det(default.read_dataset(loc['P'],0)).reshape(-1,1) + in_file = default.read_dataset(loc['det(P)'],0) + assert np.allclose(in_memory,in_file) + + def test_add_spherical(self,default): + default.add_spherical('P') + loc = {'P': default.get_dataset_location('P'), + 'p_P': default.get_dataset_location('p_P')} + in_memory = mechanics.spherical_part(default.read_dataset(loc['P'],0)).reshape(-1,1) + in_file = default.read_dataset(loc['p_P'],0) + assert np.allclose(in_memory,in_file) diff --git a/python/tests/test_Geom.py b/python/tests/test_Geom.py new file mode 100644 index 000000000..bc3a3e751 --- /dev/null +++ b/python/tests/test_Geom.py @@ -0,0 +1,99 @@ +import copy +import os + +import pytest +import numpy as np + +from damask import Geom + + +def geom_equal(a,b): + return np.all(a.get_microstructure() == b.get_microstructure()) and \ + np.all(a.get_size() == b.get_size()) and \ + np.all(a.get_grid() == b.get_grid()) + +@pytest.fixture +def default(): + """Simple geometry.""" + x=np.concatenate((np.ones(40,dtype=int), + np.arange(2,42), + np.ones(40,dtype=int)*2, + np.arange(1,41))).reshape((8,5,4)) + return Geom(x,[8e-6,5e-6,4e-6]) + +@pytest.fixture +def reference_dir(reference_dir_base): + """Directory containing reference results.""" + return os.path.join(reference_dir_base,'Geom') + + +class TestGeom: + + def test_update(self,default): + modified = copy.deepcopy(default) + modified.update( + default.get_microstructure(), + default.get_size(), + default.get_origin() + ) + assert geom_equal(modified,default) + + + def test_write_read_str(self,default,tmpdir): + default.to_file(str(tmpdir.join('default.geom'))) + new = Geom.from_file(str(tmpdir.join('default.geom'))) + assert geom_equal(new,default) + + def test_write_read_file(self,default,tmpdir): + with open(tmpdir.join('default.geom'),'w') as f: + default.to_file(f) + with open(tmpdir.join('default.geom')) as f: + new = Geom.from_file(f) + assert geom_equal(new,default) + + @pytest.mark.parametrize('pack',[True,False]) + def test_pack(self,default,tmpdir,pack): + default.to_file(tmpdir.join('default.geom'),pack=pack) + new = Geom.from_file(tmpdir.join('default.geom')) + assert geom_equal(new,default) + + @pytest.mark.parametrize('directions,reflect',[ + (['x'], False), + (['x','y','z'],True), + (['z','x','y'],False), + (['y','z'], False) + ] + ) + def test_mirror(self,default,update,reference_dir,directions,reflect): + modified = copy.deepcopy(default) + modified.mirror(directions,reflect) + tag = 'directions={}_reflect={}'.format('-'.join(directions),reflect) + reference = os.path.join(reference_dir,'mirror_{}.geom'.format(tag)) + if update: modified.to_file(reference) + assert geom_equal(modified,Geom.from_file(reference)) + + @pytest.mark.parametrize('stencil',[(1),(2),(3),(4)]) + def test_clean(self,default,update,reference_dir,stencil): + modified = copy.deepcopy(default) + modified.clean(stencil) + tag = 'stencil={}'.format(stencil) + reference = os.path.join(reference_dir,'clean_{}.geom'.format(tag)) + if update: modified.to_file(reference) + assert geom_equal(modified,Geom.from_file(reference)) + + @pytest.mark.parametrize('grid',[ + ((10,11,10)), + ([10,13,10]), + (np.array((10,10,10))), + (np.array((8, 10,12))), + (np.array((5, 4, 20))), + (np.array((10,20,2)) ) + ] + ) + def test_scale(self,default,update,reference_dir,grid): + modified = copy.deepcopy(default) + modified.scale(grid) + tag = 'grid={}'.format('-'.join([str(x) for x in grid])) + reference = os.path.join(reference_dir,'scale_{}.geom'.format(tag)) + if update: modified.to_file(reference) + assert geom_equal(modified,Geom.from_file(reference)) diff --git a/python/tests/test_Rotation.py b/python/tests/test_Rotation.py new file mode 100644 index 000000000..72956c013 --- /dev/null +++ b/python/tests/test_Rotation.py @@ -0,0 +1,55 @@ +import pytest +import numpy as np + +from damask import Rotation + +n = 1000 + +@pytest.fixture +def default(): + """A set of n random rotations.""" + return [Rotation.fromRandom() for r in range(n)] + + +class TestRotation: + + def test_Eulers(self,default): + for rot in default: + assert np.allclose(rot.asQuaternion(), + Rotation.fromEulers(rot.asEulers()).asQuaternion()) + + + def test_AxisAngle(self,default): + for rot in default: + assert np.allclose(rot.asEulers(), + Rotation.fromAxisAngle(rot.asAxisAngle()).asEulers()) + + + def test_Matrix(self,default): + for rot in default: + assert np.allclose(rot.asAxisAngle(), + Rotation.fromMatrix(rot.asMatrix()).asAxisAngle()) + + + def test_Rodriques(self,default): + for rot in default: + assert np.allclose(rot.asMatrix(), + Rotation.fromRodrigues(rot.asRodrigues()).asMatrix()) + + + def test_Homochoric(self,default): + for rot in default: + assert np.allclose(rot.asRodrigues(), + Rotation.fromHomochoric(rot.asHomochoric()).asRodrigues()) + + + def test_Cubochoric(self,default): + for rot in default: + assert np.allclose(rot.asHomochoric(), + Rotation.fromCubochoric(rot.asCubochoric()).asHomochoric()) + + + def test_Quaternion(self,default): + for rot in default: + assert np.allclose(rot.asCubochoric(), + Rotation.fromQuaternion(rot.asQuaternion()).asCubochoric()) diff --git a/python/tests/test_mechanics.py b/python/tests/test_mechanics.py new file mode 100644 index 000000000..aab92bef3 --- /dev/null +++ b/python/tests/test_mechanics.py @@ -0,0 +1,142 @@ +import numpy as np +from damask import mechanics + +class TestMechanics: + + n = 1000 + c = np.random.randint(n) + + + def test_vectorize_Cauchy(self): + P = np.random.random((self.n,3,3)) + F = np.random.random((self.n,3,3)) + assert np.allclose(mechanics.Cauchy(F,P)[self.c], + mechanics.Cauchy(F[self.c],P[self.c])) + + + def test_vectorize_strain_tensor(self): + F = np.random.random((self.n,3,3)) + t = ['V','U'][np.random.randint(0,2)] + m = np.random.random()*10. -5.0 + assert np.allclose(mechanics.strain_tensor(F,t,m)[self.c], + mechanics.strain_tensor(F[self.c],t,m)) + + + def test_vectorize_deviatoric_part(self): + x = np.random.random((self.n,3,3)) + assert np.allclose(mechanics.deviatoric_part(x)[self.c], + mechanics.deviatoric_part(x[self.c])) + + + def test_vectorize_spherical_part(self): + x = np.random.random((self.n,3,3)) + assert np.allclose(mechanics.spherical_part(x)[self.c], + mechanics.spherical_part(x[self.c])) + + + def test_vectorize_Mises_stress(self): + sigma = np.random.random((self.n,3,3)) + assert np.allclose(mechanics.Mises_stress(sigma)[self.c], + mechanics.Mises_stress(sigma[self.c])) + + + def test_vectorize_Mises_strain(self): + epsilon = np.random.random((self.n,3,3)) + assert np.allclose(mechanics.Mises_strain(epsilon)[self.c], + mechanics.Mises_strain(epsilon[self.c])) + + + def test_vectorize_symmetric(self): + x = np.random.random((self.n,3,3)) + assert np.allclose(mechanics.symmetric(x)[self.c], + mechanics.symmetric(x[self.c])) + + + def test_vectorize_maximum_shear(self): + x = np.random.random((self.n,3,3)) + assert np.allclose(mechanics.maximum_shear(x)[self.c], + mechanics.maximum_shear(x[self.c])) + + + def test_vectorize_principal_components(self): + x = np.random.random((self.n,3,3)) + assert np.allclose(mechanics.principal_components(x)[self.c], + mechanics.principal_components(x[self.c])) + + + def test_vectorize_transpose(self): + x = np.random.random((self.n,3,3)) + assert np.allclose(mechanics.transpose(x)[self.c], + mechanics.transpose(x[self.c])) + + + def test_vectorize_rotational_part(self): + x = np.random.random((self.n,3,3)) + assert np.allclose(mechanics.rotational_part(x)[self.c], + mechanics.rotational_part(x[self.c])) + + + def test_vectorize_left_stretch(self): + x = np.random.random((self.n,3,3)) + assert np.allclose(mechanics.left_stretch(x)[self.c], + mechanics.left_stretch(x[self.c])) + + + def test_vectorize_right_stretch(self): + x = np.random.random((self.n,3,3)) + assert np.allclose(mechanics.right_stretch(x)[self.c], + mechanics.right_stretch(x[self.c])) + + + def test_Cauchy(self): + """Ensure Cauchy stress is symmetrized 1. Piola-Kirchhoff stress for no deformation.""" + P = np.random.random((self.n,3,3)) + assert np.allclose(mechanics.Cauchy(np.broadcast_to(np.eye(3),(self.n,3,3)),P), + mechanics.symmetric(P)) + + + def test_strain_tensor_no_rotation(self): + """Ensure that left and right stretch give same results for no rotation.""" + F = np.broadcast_to(np.eye(3),[self.n,3,3])*np.random.random((self.n,3,3)) + m = np.random.random()*20.0-10.0 + assert np.allclose(mechanics.strain_tensor(F,'U',m), + mechanics.strain_tensor(F,'V',m)) + + + def test_strain_tensor_rotation(self): + """Ensure that pure rotation results in no strain.""" + F = mechanics.rotational_part(np.random.random((self.n,3,3))) + t = ['V','U'][np.random.randint(0,2)] + m = np.random.random()*2.0 - 1.0 + assert np.allclose(mechanics.strain_tensor(F,t,m), + 0.0) + + + def test_spherical_deviatoric_part(self): + """Ensure that full tensor is sum of spherical and deviatoric part.""" + x = np.random.random((self.n,3,3)) + sph = np.broadcast_to(np.eye(3),(self.n,3,3))\ + * np.repeat(mechanics.spherical_part(x),9).reshape(self.n,3,3) + assert np.allclose(sph + mechanics.deviatoric_part(x), + x) + + + def test_symmetric(self): + """Ensure that a symmetric tensor is half of the sum of a tensor and its transpose.""" + x = np.random.random((self.n,3,3)) + assert np.allclose(mechanics.symmetric(x)*2.0, + mechanics.transpose(x)+x) + + + def test_transpose(self): + """Ensure that a symmetric tensor equals its transpose.""" + x = mechanics.symmetric(np.random.random((self.n,3,3))) + assert np.allclose(mechanics.transpose(x), + x) + + + def test_Mises(self): + """Ensure that equivalent stress is 3/2 of equivalent strain.""" + x = np.random.random((self.n,3,3)) + assert np.allclose(mechanics.Mises_stress(x)/mechanics.Mises_strain(x), + 1.5) diff --git a/src/source_thermal_dissipation.f90 b/src/source_thermal_dissipation.f90 index 9b18efef5..0d16a9171 100644 --- a/src/source_thermal_dissipation.f90 +++ b/src/source_thermal_dissipation.f90 @@ -18,12 +18,6 @@ module source_thermal_dissipation source_thermal_dissipation_offset, & !< which source is my current thermal dissipation mechanism? source_thermal_dissipation_instance !< instance of thermal dissipation source mechanism - integer, dimension(:,:), allocatable, target, public :: & - source_thermal_dissipation_sizePostResult !< size of each post result output - - character(len=64), dimension(:,:), allocatable, target, public :: & - source_thermal_dissipation_output !< name of each post result output - type :: tParameters !< container type for internal constitutive parameters real(pReal) :: & kappa @@ -68,10 +62,6 @@ subroutine source_thermal_dissipation_init enddo enddo - allocate(source_thermal_dissipation_sizePostResult(maxval(phase_Noutput),Ninstance),source=0) - allocate(source_thermal_dissipation_output (maxval(phase_Noutput),Ninstance)) - source_thermal_dissipation_output = '' - do p=1, size(config_phase) if (all(phase_source(:,p) /= SOURCE_THERMAL_DISSIPATION_ID)) cycle instance = source_thermal_dissipation_instance(p) diff --git a/src/source_thermal_externalheat.f90 b/src/source_thermal_externalheat.f90 index 1b9d03529..00e6da6bf 100644 --- a/src/source_thermal_externalheat.f90 +++ b/src/source_thermal_externalheat.f90 @@ -15,17 +15,8 @@ module source_thermal_externalheat private integer, dimension(:), allocatable, public, protected :: & - source_thermal_externalheat_offset, & !< which source is my current thermal dissipation mechanism? - source_thermal_externalheat_instance !< instance of thermal dissipation source mechanism - - integer, dimension(:,:), allocatable, target, public :: & - source_thermal_externalheat_sizePostResult !< size of each post result output - - character(len=64), dimension(:,:), allocatable, target, public :: & - source_thermal_externalheat_output !< name of each post result output - - integer, dimension(:), allocatable, target, public :: & - source_thermal_externalheat_Noutput !< number of outputs per instance of this source + source_thermal_externalheat_offset, & !< which source is my current thermal dissipation mechanism? + source_thermal_externalheat_instance !< instance of thermal dissipation source mechanism type :: tParameters !< container type for internal constitutive parameters real(pReal), dimension(:), allocatable :: & @@ -73,11 +64,6 @@ subroutine source_thermal_externalheat_init enddo enddo - allocate(source_thermal_externalheat_sizePostResult(maxval(phase_Noutput),maxNinstance),source=0) - allocate(source_thermal_externalheat_output (maxval(phase_Noutput),maxNinstance)) - source_thermal_externalheat_output = '' - allocate(source_thermal_externalheat_Noutput(maxNinstance), source=0) - allocate(param(maxNinstance)) do p=1, size(config_phase) @@ -117,6 +103,7 @@ subroutine source_thermal_externalheat_dotState(phase, of) end subroutine source_thermal_externalheat_dotState + !-------------------------------------------------------------------------------------------------- !> @brief returns local heat generation rate !--------------------------------------------------------------------------------------------------