From e2ce882d73c3f212ce7ad01f0e001d390e5339a1 Mon Sep 17 00:00:00 2001 From: Abisheik Panneerselvam Date: Thu, 10 Jun 2021 17:13:42 +0200 Subject: [PATCH 01/15] Test added --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 4e63593fa..ddfefc187 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 4e63593fa25bbb296fc734c82aff3353190565f7 +Subproject commit ddfefc187a4268665b779bb847a41d810aece201 From c64f9eb8051c5a4bf7c0d4cc8500ff4a6102a734 Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Fri, 11 Jun 2021 20:39:44 +0200 Subject: [PATCH 02/15] hardcoding '3' is an issue for 2d simulations --- PRIVATE | 2 +- src/discretization.f90 | 4 ++-- src/mesh/discretization_mesh.f90 | 10 ++++------ 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/PRIVATE b/PRIVATE index ddfefc187..f1fd2f2e8 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit ddfefc187a4268665b779bb847a41d810aece201 +Subproject commit f1fd2f2e8cdb8df36e27f421acbaff0bad22f8c0 diff --git a/src/discretization.f90 b/src/discretization.f90 index 7014a6d62..17077d5aa 100644 --- a/src/discretization.f90 +++ b/src/discretization.f90 @@ -80,8 +80,8 @@ subroutine discretization_results call results_closeGroup(results_addGroup('current/geometry')) - u = discretization_NodeCoords (1:3,:discretization_sharedNodesBegin) & - - discretization_NodeCoords0(1:3,:discretization_sharedNodesBegin) + u = discretization_NodeCoords (:,:discretization_sharedNodesBegin) & + - discretization_NodeCoords0(:,:discretization_sharedNodesBegin) call results_writeDataset(u,'current/geometry','u_n','displacements of the nodes','m') u = discretization_IPcoords & diff --git a/src/mesh/discretization_mesh.f90 b/src/mesh/discretization_mesh.f90 index b345e1974..c3c10cd98 100644 --- a/src/mesh/discretization_mesh.f90 +++ b/src/mesh/discretization_mesh.f90 @@ -146,10 +146,9 @@ subroutine discretization_mesh_init(restart) ! Get initial nodal coordinates call DMGetCoordinates(geomMesh,coords_node0,ierr) CHKERRQ(ierr) - allocate(mesh_node0_temp(dimPlex*mesh_Nnodes)) call VecGetArrayF90(coords_node0, mesh_node0_temp,ierr) CHKERRQ(ierr) - + mesh_maxNips = FEM_nQuadrature(dimPlex,integrationOrder) call mesh_FEM_build_ipCoordinates(dimPlex,FEM_quadrature_points(dimPlex,integrationOrder)%p) @@ -165,14 +164,13 @@ subroutine discretization_mesh_init(restart) if (debug_element < 1 .or. debug_element > mesh_NcpElems) call IO_error(602,ext_msg='element') if (debug_ip < 1 .or. debug_ip > mesh_maxNips) call IO_error(602,ext_msg='IP') - allocate(mesh_node0(3,mesh_Nnodes),source=0.0_pReal) mesh_node0 = reshape(mesh_node0_temp,[dimPlex,mesh_Nnodes]) call discretization_init(materialAt,& - reshape(mesh_ipCoordinates,[3,mesh_maxNips*mesh_NcpElems]), & + reshape(mesh_ipCoordinates,[dimPlex,mesh_maxNips*mesh_NcpElems]), & mesh_node0) - call writeGeometry(reshape(mesh_ipCoordinates,[3,mesh_maxNips*mesh_NcpElems]),mesh_node0) + call writeGeometry(reshape(mesh_ipCoordinates,[dimPlex,mesh_maxNips*mesh_NcpElems]),mesh_node0) end subroutine discretization_mesh_init @@ -216,7 +214,7 @@ subroutine mesh_FEM_build_ipCoordinates(dimPlex,qPoints) PetscErrorCode :: ierr - allocate(mesh_ipCoordinates(3,mesh_maxNips,mesh_NcpElems),source=0.0_pReal) + allocate(mesh_ipCoordinates(dimPlex,mesh_maxNips,mesh_NcpElems),source=0.0_pReal) allocate(pV0(dimPlex)) allocatE(pCellJ(dimPlex**2)) From 5f01b076d20a1a9fd072c6c066a4cc76c0e1a168 Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Mon, 14 Jun 2021 14:58:14 +0200 Subject: [PATCH 03/15] This change makes the test work for GNU too Probably something was uninitialized and GNU was accessing unallocated memory --- src/mesh/FEM_quadrature.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesh/FEM_quadrature.f90 b/src/mesh/FEM_quadrature.f90 index 4cc5e5468..79f02c84d 100644 --- a/src/mesh/FEM_quadrature.f90 +++ b/src/mesh/FEM_quadrature.f90 @@ -224,6 +224,7 @@ pure function permutationStar111(point) result(qPt) real(pReal), dimension(3,6) :: temp + temp = 0.0_pReal temp(:,1) = [point(1), point(2), 1.0_pReal - point(1) - point(2)] temp(:,2) = [point(1), 1.0_pReal - point(1) - point(2), point(2)] temp(:,4) = [point(2), 1.0_pReal - point(1) - point(2), point(1)] From e10701b32a320372e45a8b6a311ac8d637c3d4aa Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 14 Jun 2021 15:21:10 +0200 Subject: [PATCH 04/15] easier to understand --- src/mesh/FEM_quadrature.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/FEM_quadrature.f90 b/src/mesh/FEM_quadrature.f90 index 79f02c84d..5c5c3f260 100644 --- a/src/mesh/FEM_quadrature.f90 +++ b/src/mesh/FEM_quadrature.f90 @@ -224,9 +224,9 @@ pure function permutationStar111(point) result(qPt) real(pReal), dimension(3,6) :: temp - temp = 0.0_pReal temp(:,1) = [point(1), point(2), 1.0_pReal - point(1) - point(2)] temp(:,2) = [point(1), 1.0_pReal - point(1) - point(2), point(2)] + temp(:,3) = 0.0_pReal temp(:,4) = [point(2), 1.0_pReal - point(1) - point(2), point(1)] temp(:,5) = [1.0_pReal - point(1) - point(2), point(2), point(1)] temp(:,6) = [1.0_pReal - point(1) - point(2), point(1), point(2)] From b9d4217d86c704dddc4dbe2a0dae4221709d45c8 Mon Sep 17 00:00:00 2001 From: Abisheik Panneerselvam Date: Wed, 16 Jun 2021 14:58:26 +0200 Subject: [PATCH 05/15] permutationStar111 for 4th order integration is updataed --- src/mesh/FEM_quadrature.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/FEM_quadrature.f90 b/src/mesh/FEM_quadrature.f90 index 5c5c3f260..ed0bbef9a 100644 --- a/src/mesh/FEM_quadrature.f90 +++ b/src/mesh/FEM_quadrature.f90 @@ -226,7 +226,7 @@ pure function permutationStar111(point) result(qPt) temp(:,1) = [point(1), point(2), 1.0_pReal - point(1) - point(2)] temp(:,2) = [point(1), 1.0_pReal - point(1) - point(2), point(2)] - temp(:,3) = 0.0_pReal + temp(:,3) = [point(2), point(1), 1.0_pReal - point(1) - point(2)] temp(:,4) = [point(2), 1.0_pReal - point(1) - point(2), point(1)] temp(:,5) = [1.0_pReal - point(1) - point(2), point(2), point(1)] temp(:,6) = [1.0_pReal - point(1) - point(2), point(1), point(2)] From 331cb80cf2fc6a905eee64175e784891f9aaa6c8 Mon Sep 17 00:00:00 2001 From: Abisheik Panneerselvam Date: Wed, 16 Jun 2021 18:16:10 +0200 Subject: [PATCH 06/15] Reference result is updated correct ip coordinates for 4th and 5th order integration --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index f1fd2f2e8..cd1ec13c4 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit f1fd2f2e8cdb8df36e27f421acbaff0bad22f8c0 +Subproject commit cd1ec13c4bda3ab0e162f2e40a25671b51de58b1 From 36bf68b33689b6681702a5706da4fa4e6ced9c97 Mon Sep 17 00:00:00 2001 From: Abisheik Panneerselvam Date: Thu, 17 Jun 2021 20:26:37 +0200 Subject: [PATCH 07/15] Out of plane coordinates for 2D elements are updated with dummy values --- src/mesh/discretization_mesh.f90 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mesh/discretization_mesh.f90 b/src/mesh/discretization_mesh.f90 index c3c10cd98..d4206fcf5 100644 --- a/src/mesh/discretization_mesh.f90 +++ b/src/mesh/discretization_mesh.f90 @@ -164,13 +164,15 @@ subroutine discretization_mesh_init(restart) if (debug_element < 1 .or. debug_element > mesh_NcpElems) call IO_error(602,ext_msg='element') if (debug_ip < 1 .or. debug_ip > mesh_maxNips) call IO_error(602,ext_msg='IP') - mesh_node0 = reshape(mesh_node0_temp,[dimPlex,mesh_Nnodes]) + allocate(mesh_node0(3,mesh_Nnodes),source=0.0_pReal) + mesh_node0(1:dimPlex,:) = reshape(mesh_node0_temp,[dimPlex,mesh_Nnodes]) + call discretization_init(materialAt,& - reshape(mesh_ipCoordinates,[dimPlex,mesh_maxNips*mesh_NcpElems]), & + reshape(mesh_ipCoordinates,[3,mesh_maxNips*mesh_NcpElems]), & mesh_node0) - call writeGeometry(reshape(mesh_ipCoordinates,[dimPlex,mesh_maxNips*mesh_NcpElems]),mesh_node0) + call writeGeometry(reshape(mesh_ipCoordinates,[3,mesh_maxNips*mesh_NcpElems]),mesh_node0) end subroutine discretization_mesh_init @@ -214,7 +216,7 @@ subroutine mesh_FEM_build_ipCoordinates(dimPlex,qPoints) PetscErrorCode :: ierr - allocate(mesh_ipCoordinates(dimPlex,mesh_maxNips,mesh_NcpElems),source=0.0_pReal) + allocate(mesh_ipCoordinates(3,mesh_maxNips,mesh_NcpElems),source=0.0_pReal) allocate(pV0(dimPlex)) allocatE(pCellJ(dimPlex**2)) From e5fdcdf1a6edf26debdb6e48267a63ad979155cd Mon Sep 17 00:00:00 2001 From: Abisheik Panneerselvam Date: Thu, 17 Jun 2021 20:28:02 +0200 Subject: [PATCH 08/15] Reference results updated for 2D elements with dummy dimensions --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index cd1ec13c4..8c915aedb 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit cd1ec13c4bda3ab0e162f2e40a25671b51de58b1 +Subproject commit 8c915aedb96a7b32822fd126cda8d980f1605881 From ce8ec6d4718b5ccbaf85d30340f572a7ab25b77b Mon Sep 17 00:00:00 2001 From: Abisheik Panneerselvam Date: Thu, 17 Jun 2021 20:44:07 +0200 Subject: [PATCH 09/15] Reference file updated with 2D elements with dummy dimensions --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 8c915aedb..4fcf6bba5 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 8c915aedb96a7b32822fd126cda8d980f1605881 +Subproject commit 4fcf6bba5cb6aedf45b0b91c0e9d1c0e4d530519 From 0551c5c16976aa643197cd7b3dd95bc514b2542a Mon Sep 17 00:00:00 2001 From: Abisheik Panneerselvam Date: Fri, 18 Jun 2021 12:10:53 +0200 Subject: [PATCH 10/15] Private branch updated --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 4fcf6bba5..6363147d0 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 4fcf6bba5cb6aedf45b0b91c0e9d1c0e4d530519 +Subproject commit 6363147d0a8bb45e681c5dc39041828a6b34664e From 0805445ea89e587b946e5d54d5ae0fb332710655 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 18 Jun 2021 10:17:39 -0400 Subject: [PATCH 11/15] exchanged x/z dimension in XDMF writing --- python/damask/_result.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index d90a87f14..9801c13a8 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -1437,7 +1437,7 @@ class Result: topology = ET.SubElement(grid, 'Topology') topology.attrib = {'TopologyType': '3DCoRectMesh', - 'Dimensions': '{} {} {}'.format(*(self.cells+1))} + 'Dimensions': '{} {} {}'.format(*(self.cells[::-1]+1))} geometry = ET.SubElement(grid, 'Geometry') geometry.attrib = {'GeometryType':'Origin_DxDyDz'} @@ -1446,13 +1446,13 @@ class Result: origin.attrib = {'Format': 'XML', 'NumberType': 'Float', 'Dimensions': '3'} - origin.text = "{} {} {}".format(*self.origin) + origin.text = "{} {} {}".format(*self.origin[::-1]) delta = ET.SubElement(geometry, 'DataItem') delta.attrib = {'Format': 'XML', 'NumberType': 'Float', 'Dimensions': '3'} - delta.text="{} {} {}".format(*(self.size/self.cells)) + delta.text="{} {} {}".format(*(self.size/self.cells)[::-1]) attributes.append(ET.SubElement(grid, 'Attribute')) attributes[-1].attrib = {'Name': 'u / m', @@ -1461,7 +1461,7 @@ class Result: data_items.append(ET.SubElement(attributes[-1], 'DataItem')) data_items[-1].attrib = {'Format': 'HDF', 'Precision': '8', - 'Dimensions': '{} {} {} 3'.format(*(self.cells+1))} + 'Dimensions': '{} {} {} 3'.format(*(self.cells[::-1]+1))} data_items[-1].text = f'{os.path.split(self.fname)[1]}:/{inc}/geometry/u_n' for ty in ['phase','homogenization']: @@ -1483,7 +1483,7 @@ class Result: data_items[-1].attrib = {'Format': 'HDF', 'NumberType': number_type_map(dtype), 'Precision': f'{dtype.itemsize}', - 'Dimensions': '{} {} {} {}'.format(*self.cells,1 if shape == () else + 'Dimensions': '{} {} {} {}'.format(*self.cells[::-1],1 if shape == () else np.prod(shape))} data_items[-1].text = f'{os.path.split(self.fname)[1]}:{name}' @@ -1516,10 +1516,9 @@ class Result: Export to VTK cell/point data. One VTK file per visible increment is created. - For cell data, the VTK format is a image data (.vti) for - grid-based simulations and an unstructured grid (.vtu) for - mesh-baed simulations. For point data, the VTK format is poly - data (.vtp). + For point data, the VTK format is poly data (.vtp). + For cell data, either a rectilinear (.vtr) or unstructured (.vtu) dataset + is written for grid-based or mesh-based simulations, respectively. Parameters ---------- @@ -1539,7 +1538,7 @@ class Result: Fill value for non-existent entries of integer type. Defaults to 0. parallel : bool - Write out VTK files in parallel in a separate background process. + Write VTK files in parallel in a separate background process. Defaults to True. """ From 56b011aa547daa43644fb0e52baa52fb641a5deb Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 18 Jun 2021 21:11:01 +0200 Subject: [PATCH 12/15] better have tests --- python/damask/_result.py | 2 +- python/tests/test_Result.py | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index 9801c13a8..9bd16be0e 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -1517,7 +1517,7 @@ class Result: One VTK file per visible increment is created. For point data, the VTK format is poly data (.vtp). - For cell data, either a rectilinear (.vtr) or unstructured (.vtu) dataset + For cell data, either an image (.vti) or unstructured (.vtu) dataset is written for grid-based or mesh-based simulations, respectively. Parameters diff --git a/python/tests/test_Result.py b/python/tests/test_Result.py index d7f1bc3d1..b0648c67b 100644 --- a/python/tests/test_Result.py +++ b/python/tests/test_Result.py @@ -8,6 +8,7 @@ import hashlib from datetime import datetime import pytest +import vtk import numpy as np from damask import Result @@ -410,10 +411,27 @@ class TestResult: single_phase.add_calculation(f"np.ones(np.shape(#F#)[0:1]+{shape[1]},'{dtype}')",f'{shape[0]}_{dtype}') fname = os.path.splitext(os.path.basename(single_phase.fname))[0]+'.xdmf' os.chdir(tmp_path) + single_phase.save_XDMF() + single_phase.view('increments',0).save_VTK() + + reader_xdmf = vtk.vtkXdmfReader() + reader_xdmf.SetFileName(fname) + reader_xdmf.Update() + dim_xdmf = reader_xdmf.GetOutput().GetDimensions() + bounds_xdmf = reader_xdmf.GetOutput().GetBounds() + + reader_vti = vtk.vtkXMLImageDataReader() + reader_vti.SetFileName(os.path.splitext(fname)[0]+'_inc00.vti') + reader_vti.Update() + dim_vti = reader_vti.GetOutput().GetDimensions() + bounds_vti = reader_vti.GetOutput().GetBounds() + if update: shutil.copy(tmp_path/fname,ref_path/fname) - assert sorted(open(tmp_path/fname).read()) == sorted(open(ref_path/fname).read()) # XML is not ordered + + assert dim_vti == dim_xdmf and bounds_vti == bounds_xdmf and \ + sorted(open(tmp_path/fname).read()) == sorted(open(ref_path/fname).read()) # XML is not ordered def test_XDMF_invalid(self,default): with pytest.raises(TypeError): From acd0eb139a85c973b958da7b71bd583958962f96 Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 18 Jun 2021 23:19:01 +0200 Subject: [PATCH 13/15] [skip ci] updated version information after successful test of v3.0.0-alpha3-247-g8bba021fe --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 1b360bb70..d48b78dfd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.0.0-alpha3-235-gdee255ae7 +v3.0.0-alpha3-247-g8bba021fe From 71634f6ce948abcc97fc7f764b6c5b082307fcfc Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 19 Jun 2021 08:12:49 +0200 Subject: [PATCH 14/15] split into two tests, one will fail on Ubuntu --- python/tests/test_Result.py | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/python/tests/test_Result.py b/python/tests/test_Result.py index b0648c67b..dbc3caf44 100644 --- a/python/tests/test_Result.py +++ b/python/tests/test_Result.py @@ -405,7 +405,7 @@ class TestResult: os.chdir(tmp_path) single_phase.save_VTK(mode=mode) - def test_XDMF(self,tmp_path,single_phase,update,ref_path): + def test_XDMF_datatypes(self,tmp_path,single_phase,update,ref_path): for shape in [('scalar',()),('vector',(3,)),('tensor',(3,3)),('matrix',(12,))]: for dtype in ['f4','f8','i1','i2','i4','i8','u1','u2','u4','u8']: single_phase.add_calculation(f"np.ones(np.shape(#F#)[0:1]+{shape[1]},'{dtype}')",f'{shape[0]}_{dtype}') @@ -413,25 +413,37 @@ class TestResult: os.chdir(tmp_path) single_phase.save_XDMF() - single_phase.view('increments',0).save_VTK() + if update: + shutil.copy(tmp_path/fname,ref_path/fname) + + assert sorted(open(tmp_path/fname).read()) == sorted(open(ref_path/fname).read()) # XML is not ordered + + @pytest.mark.skipif(not hasattr(vtk,'vtkXdmfReader'),reason='https://discourse.vtk.org/t/2450') + def test_XDMF_shape(self,tmp_path,single_phase): + os.chdir(tmp_path) + + single_phase.save_XDMF() + fname = os.path.splitext(os.path.basename(single_phase.fname))[0]+'.xdmf' reader_xdmf = vtk.vtkXdmfReader() reader_xdmf.SetFileName(fname) reader_xdmf.Update() dim_xdmf = reader_xdmf.GetOutput().GetDimensions() bounds_xdmf = reader_xdmf.GetOutput().GetBounds() - reader_vti = vtk.vtkXMLImageDataReader() - reader_vti.SetFileName(os.path.splitext(fname)[0]+'_inc00.vti') - reader_vti.Update() - dim_vti = reader_vti.GetOutput().GetDimensions() - bounds_vti = reader_vti.GetOutput().GetBounds() + single_phase.view('increments',0).save_VTK() + fname = os.path.splitext(os.path.basename(single_phase.fname))[0]+'_inc00.vti' + for i in range(10): # waiting for parallel IO + reader_vti = vtk.vtkXMLImageDataReader() + reader_vti.SetFileName(fname) + reader_vti.Update() + dim_vti = reader_vti.GetOutput().GetDimensions() + bounds_vti = reader_vti.GetOutput().GetBounds() + if dim_vti == dim_xdmf and bounds_vti == bounds_xdmf: + return + time.sleep(.5) - if update: - shutil.copy(tmp_path/fname,ref_path/fname) - - assert dim_vti == dim_xdmf and bounds_vti == bounds_xdmf and \ - sorted(open(tmp_path/fname).read()) == sorted(open(ref_path/fname).read()) # XML is not ordered + assert False def test_XDMF_invalid(self,default): with pytest.raises(TypeError): From 3a6b054cf60c62cd804cf302b55940721e2c2a89 Mon Sep 17 00:00:00 2001 From: Test User Date: Sat, 19 Jun 2021 11:59:23 +0200 Subject: [PATCH 15/15] [skip ci] updated version information after successful test of v3.0.0-alpha3-252-g723737c99 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index d48b78dfd..c12640b34 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.0.0-alpha3-247-g8bba021fe +v3.0.0-alpha3-252-g723737c99