From b11ad8c774e9353558e32fa15b36d9ce834f6c53 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 23 Mar 2023 07:51:34 +0100 Subject: [PATCH 1/6] helpful information on strain calculation --- python/damask/_result.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index f6dddc9a0..b18d9a11c 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -1203,7 +1203,7 @@ class Result: 'label': f"epsilon_{t}^{m}({F['label']})", 'meta': { 'unit': F['meta']['unit'], - 'description': f'strain tensor of order {m} based on {side} stretch tensor '+\ + 'description': f'Seth-Hill strain tensor of order {m} based on {side} stretch tensor '+\ f"of {F['label']} ({F['meta']['description']})", 'creator': 'add_strain' } @@ -1212,10 +1212,11 @@ class Result: F: str = 'F', t: Literal['V', 'U'] = 'V', m: float = 0.0): - """ - Add strain tensor of a deformation gradient. + r""" + Add strain tensor (Seth-Hill family) of a deformation gradient. - For details, see damask.mechanics.strain. + By default, the logarithmic strain based on the + left stretch tensor is added. Parameters ---------- @@ -1249,6 +1250,18 @@ class Result: spatial/Eulerian strain measures (based on 'V') for elastic strains when calculating averages. + The strain is defined as: + + .. math:: + + \vb*{\epsilon}_V^{(m)} = \frac{1}{2m} (\vb{V}^{2m} - \vb{I}) \\\\ + \vb*{\epsilon}_U^{(m)} = \frac{1}{2m} (\vb{U}^{2m} - \vb{I}) + + References + ---------- + | https://en.wikipedia.org/wiki/Finite_strain_theory + | https://de.wikipedia.org/wiki/Verzerrungstensor + """ self._add_generic_pointwise(self._add_strain,{'F':F},{'t':t,'m':m}) From 09858317d8c8077df9cbe7c719e34e554804a8ca Mon Sep 17 00:00:00 2001 From: Yi Hu Date: Tue, 4 Jul 2023 16:44:31 +0200 Subject: [PATCH 2/6] add m=0 (default) case in docstring --- PRIVATE | 2 +- python/damask/_result.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index 9f4ffce8b..fc04b9ef6 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 9f4ffce8b2df951191a14dc3229de1aee6e544e6 +Subproject commit fc04b9ef621161e60a2f8b72bfa8c99e77687c71 diff --git a/python/damask/_result.py b/python/damask/_result.py index fd70ff1c0..5d04a79b7 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -1252,6 +1252,11 @@ class Result: .. math:: + m = 0 \\\\ + \vb*{\epsilon}_V^{(0)} = \ln (\vb{V}) \\\\ + \vb*{\epsilon}_U^{(0)} = \ln (\vb{U}) \\\\ + + m \neq 0 \\\\ \vb*{\epsilon}_V^{(m)} = \frac{1}{2m} (\vb{V}^{2m} - \vb{I}) \\\\ \vb*{\epsilon}_U^{(m)} = \frac{1}{2m} (\vb{U}^{2m} - \vb{I}) From bd0a35a94648478eb2b9c7f3c100b7a07341236e Mon Sep 17 00:00:00 2001 From: Yi Hu Date: Tue, 4 Jul 2023 18:30:06 +0200 Subject: [PATCH 3/6] upd PRIVATE --- PRIVATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRIVATE b/PRIVATE index fc04b9ef6..9f4ffce8b 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit fc04b9ef621161e60a2f8b72bfa8c99e77687c71 +Subproject commit 9f4ffce8b2df951191a14dc3229de1aee6e544e6 From bb49289b76ec2cf05d40d16f4de4ae3d5530ab85 Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 5 Jul 2023 18:47:49 +0200 Subject: [PATCH 4/6] [skip ci] updated version information after successful test of v3.0.0-alpha7-610-g716600299 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 13e6f3049..888ca7265 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0-alpha7-604-g65fa62b3f +3.0.0-alpha7-610-g716600299 From cf74a687c5e69409282bd8124c73e4f40d2539c6 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 10 Jul 2023 20:40:22 +0200 Subject: [PATCH 5/6] not needed --- src/grid/grid_mech_FEM.f90 | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/grid/grid_mech_FEM.f90 b/src/grid/grid_mech_FEM.f90 index 534cf952f..6500f30ce 100644 --- a/src/grid/grid_mech_FEM.f90 +++ b/src/grid/grid_mech_FEM.f90 @@ -351,15 +351,8 @@ subroutine grid_mechanical_FEM_forward(cutBack,guess,Delta_t,Delta_t_old,t_remai rotation_BC PetscErrorCode :: err_PETSc - PetscScalar, pointer, dimension(:,:,:,:) :: & - u,u_lastInc - call DMDAVecGetArrayF90(mechanical_grid,solution_current,u,err_PETSc) - CHKERRQ(err_PETSc) - call DMDAVecGetArrayF90(mechanical_grid,solution_lastInc,u_lastInc,err_PETSc) - CHKERRQ(err_PETSc) - if (cutBack) then C_volAvg = C_volAvgLastInc else @@ -408,10 +401,6 @@ subroutine grid_mechanical_FEM_forward(cutBack,guess,Delta_t,Delta_t_old,t_remai call VecAXPY(solution_current,Delta_t,solution_rate,err_PETSc) CHKERRQ(err_PETSc) - call DMDAVecRestoreArrayF90(mechanical_grid,solution_current,u,err_PETSc) - CHKERRQ(err_PETSc) - call DMDAVecRestoreArrayF90(mechanical_grid,solution_lastInc,u_lastInc,err_PETSc) - CHKERRQ(err_PETSc) !-------------------------------------------------------------------------------------------------- ! set module wide available data From 15e5bce7e4a535ab54573f50a3b2087139295963 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 10 Jul 2023 20:50:24 +0200 Subject: [PATCH 6/6] indicate read-only access --- src/grid/grid_damage_spectral.f90 | 6 +++--- src/grid/grid_mech_FEM.f90 | 20 ++++++++++---------- src/grid/grid_mech_spectral_basic.f90 | 12 ++++++------ src/grid/grid_mech_spectral_polarisation.f90 | 12 ++++++------ src/grid/grid_thermal_spectral.f90 | 6 +++--- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/grid/grid_damage_spectral.f90 b/src/grid/grid_damage_spectral.f90 index 4724f03d0..90680daea 100644 --- a/src/grid/grid_damage_spectral.f90 +++ b/src/grid/grid_damage_spectral.f90 @@ -307,7 +307,7 @@ end subroutine grid_damage_spectral_forward !-------------------------------------------------------------------------------------------------- !> @brief Write current solver and constitutive data for restart to file. !-------------------------------------------------------------------------------------------------- -subroutine grid_damage_spectral_restartWrite +subroutine grid_damage_spectral_restartWrite() PetscErrorCode :: err_PETSc DM :: dm_local @@ -316,7 +316,7 @@ subroutine grid_damage_spectral_restartWrite call SNESGetDM(SNES_damage,dm_local,err_PETSc); CHKERRQ(err_PETSc) - call DMDAVecGetArrayF90(dm_local,solution_vec,phi,err_PETSc); + call DMDAVecGetArrayReadF90(dm_local,solution_vec,phi,err_PETSc); CHKERRQ(err_PETSc) print'(1x,a)', 'saving damage solver data required for restart'; flush(IO_STDOUT) @@ -328,7 +328,7 @@ subroutine grid_damage_spectral_restartWrite call HDF5_closeGroup(groupHandle) call HDF5_closeFile(fileHandle) - call DMDAVecRestoreArrayF90(dm_local,solution_vec,phi,err_PETSc); + call DMDAVecRestoreArrayReadF90(dm_local,solution_vec,phi,err_PETSc); CHKERRQ(err_PETSc) end subroutine grid_damage_spectral_restartWrite diff --git a/src/grid/grid_mech_FEM.f90 b/src/grid/grid_mech_FEM.f90 index 6500f30ce..17bf01ac0 100644 --- a/src/grid/grid_mech_FEM.f90 +++ b/src/grid/grid_mech_FEM.f90 @@ -414,7 +414,7 @@ end subroutine grid_mechanical_FEM_forward !-------------------------------------------------------------------------------------------------- !> @brief Update coordinates !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_FEM_updateCoords +subroutine grid_mechanical_FEM_updateCoords() call utilities_updateCoords(F) @@ -424,16 +424,16 @@ end subroutine grid_mechanical_FEM_updateCoords !-------------------------------------------------------------------------------------------------- !> @brief Write current solver and constitutive data for restart to file !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_FEM_restartWrite +subroutine grid_mechanical_FEM_restartWrite() PetscErrorCode :: err_PETSc integer(HID_T) :: fileHandle, groupHandle PetscScalar, dimension(:,:,:,:), pointer :: u,u_lastInc - call DMDAVecGetArrayF90(mechanical_grid,solution_current,u,err_PETSc) + call DMDAVecGetArrayReadF90(mechanical_grid,solution_current,u,err_PETSc) CHKERRQ(err_PETSc) - call DMDAVecGetArrayF90(mechanical_grid,solution_lastInc,u_lastInc,err_PETSc) + call DMDAVecGetArrayReadF90(mechanical_grid,solution_lastInc,u_lastInc,err_PETSc) CHKERRQ(err_PETSc) print'(1x,a)', 'saving solver data required for restart'; flush(IO_STDOUT) @@ -460,9 +460,9 @@ subroutine grid_mechanical_FEM_restartWrite call HDF5_closeFile(fileHandle) end if - call DMDAVecRestoreArrayF90(mechanical_grid,solution_current,u,err_PETSc) + call DMDAVecRestoreArrayReadF90(mechanical_grid,solution_current,u,err_PETSc) CHKERRQ(err_PETSc) - call DMDAVecRestoreArrayF90(mechanical_grid,solution_lastInc,u_lastInc,err_PETSc) + call DMDAVecRestoreArrayReadF90(mechanical_grid,solution_lastInc,u_lastInc,err_PETSc) CHKERRQ(err_PETSc) end subroutine grid_mechanical_FEM_restartWrite @@ -555,7 +555,7 @@ subroutine formResidual(da_local,x_local, & !-------------------------------------------------------------------------------------------------- ! get deformation gradient - call DMDAVecGetArrayF90(da_local,x_local,x_scal,err_PETSc) + call DMDAVecGetArrayReadF90(da_local,x_local,x_scal,err_PETSc) CHKERRQ(err_PETSc) do k = cells3Offset+1, cells3Offset+cells3; do j = 1, cells(2); do i = 1, cells(1) ctr = 0 @@ -565,7 +565,7 @@ subroutine formResidual(da_local,x_local, & end do; end do; end do F(1:3,1:3,i,j,k-cells3Offset) = params%rotation_BC%rotate(F_aim,active=.true.) + transpose(matmul(BMat,x_elem)) end do; end do; end do - call DMDAVecRestoreArrayF90(da_local,x_local,x_scal,err_PETSc) + call DMDAVecRestoreArrayReadF90(da_local,x_local,x_scal,err_PETSc) CHKERRQ(err_PETSc) !-------------------------------------------------------------------------------------------------- @@ -585,7 +585,7 @@ subroutine formResidual(da_local,x_local, & ! constructing residual call DMDAVecGetArrayF90(da_local,f_local,r,err_PETSc) CHKERRQ(err_PETSc) - call DMDAVecGetArrayF90(da_local,x_local,x_scal,err_PETSc) + call DMDAVecGetArrayReadF90(da_local,x_local,x_scal,err_PETSc) CHKERRQ(err_PETSc) ele = 0 r = 0.0_pREAL @@ -606,7 +606,7 @@ subroutine formResidual(da_local,x_local, & r(0:2,i+ii,j+jj,k+kk) = r(0:2,i+ii,j+jj,k+kk) + f_elem(ctr,1:3) end do; end do; end do end do; end do; end do - call DMDAVecRestoreArrayF90(da_local,x_local,x_scal,err_PETSc) + call DMDAVecRestoreArrayReadF90(da_local,x_local,x_scal,err_PETSc) CHKERRQ(err_PETSc) !-------------------------------------------------------------------------------------------------- diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index 81d00db3f..70e764549 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -377,15 +377,15 @@ end subroutine grid_mechanical_spectral_basic_forward !-------------------------------------------------------------------------------------------------- !> @brief Update coordinates !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_spectral_basic_updateCoords +subroutine grid_mechanical_spectral_basic_updateCoords() PetscErrorCode :: err_PETSc real(pREAL), dimension(:,:,:,:), pointer :: F - call DMDAVecGetArrayF90(da,solution_vec,F,err_PETSc) + call DMDAVecGetArrayReadF90(da,solution_vec,F,err_PETSc) CHKERRQ(err_PETSc) call utilities_updateCoords(F) - call DMDAVecRestoreArrayF90(da,solution_vec,F,err_PETSc) + call DMDAVecRestoreArrayReadF90(da,solution_vec,F,err_PETSc) CHKERRQ(err_PETSc) end subroutine grid_mechanical_spectral_basic_updateCoords @@ -394,13 +394,13 @@ end subroutine grid_mechanical_spectral_basic_updateCoords !-------------------------------------------------------------------------------------------------- !> @brief Write current solver and constitutive data for restart to file !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_spectral_basic_restartWrite +subroutine grid_mechanical_spectral_basic_restartWrite() PetscErrorCode :: err_PETSc integer(HID_T) :: fileHandle, groupHandle real(pREAL), dimension(:,:,:,:), pointer :: F - call DMDAVecGetArrayF90(da,solution_vec,F,err_PETSc) + call DMDAVecGetArrayReadF90(da,solution_vec,F,err_PETSc) CHKERRQ(err_PETSc) if (num%update_gamma) C_minMaxAvgRestart = C_minMaxAvg @@ -428,7 +428,7 @@ subroutine grid_mechanical_spectral_basic_restartWrite call HDF5_closeFile(fileHandle) end if - call DMDAVecRestoreArrayF90(da,solution_vec,F,err_PETSc) + call DMDAVecRestoreArrayReadF90(da,solution_vec,F,err_PETSc) CHKERRQ(err_PETSc) end subroutine grid_mechanical_spectral_basic_restartWrite diff --git a/src/grid/grid_mech_spectral_polarisation.f90 b/src/grid/grid_mech_spectral_polarisation.f90 index 73d2b89f2..168794316 100644 --- a/src/grid/grid_mech_spectral_polarisation.f90 +++ b/src/grid/grid_mech_spectral_polarisation.f90 @@ -434,15 +434,15 @@ end subroutine grid_mechanical_spectral_polarisation_forward !-------------------------------------------------------------------------------------------------- !> @brief Update coordinates !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_spectral_polarisation_updateCoords +subroutine grid_mechanical_spectral_polarisation_updateCoords() PetscErrorCode :: err_PETSc real(pREAL), dimension(:,:,:,:), pointer :: FandF_tau - call DMDAVecGetArrayF90(da,solution_vec,FandF_tau,err_PETSc) + call DMDAVecGetArrayReadF90(da,solution_vec,FandF_tau,err_PETSc) CHKERRQ(err_PETSc) call utilities_updateCoords(FandF_tau(0:8,:,:,:)) - call DMDAVecRestoreArrayF90(da,solution_vec,FandF_tau,err_PETSc) + call DMDAVecRestoreArrayReadF90(da,solution_vec,FandF_tau,err_PETSc) CHKERRQ(err_PETSc) end subroutine grid_mechanical_spectral_polarisation_updateCoords @@ -451,13 +451,13 @@ end subroutine grid_mechanical_spectral_polarisation_updateCoords !-------------------------------------------------------------------------------------------------- !> @brief Write current solver and constitutive data for restart to file !-------------------------------------------------------------------------------------------------- -subroutine grid_mechanical_spectral_polarisation_restartWrite +subroutine grid_mechanical_spectral_polarisation_restartWrite() PetscErrorCode :: err_PETSc integer(HID_T) :: fileHandle, groupHandle real(pREAL), dimension(:,:,:,:), pointer :: FandF_tau, F, F_tau - call DMDAVecGetArrayF90(da,solution_vec,FandF_tau,err_PETSc) + call DMDAVecGetArrayReadF90(da,solution_vec,FandF_tau,err_PETSc) CHKERRQ(err_PETSc) F => FandF_tau(0: 8,:,:,:) F_tau => FandF_tau(9:17,:,:,:) @@ -489,7 +489,7 @@ subroutine grid_mechanical_spectral_polarisation_restartWrite call HDF5_closeFile(fileHandle) end if - call DMDAVecRestoreArrayF90(da,solution_vec,FandF_tau,err_PETSc) + call DMDAVecRestoreArrayReadF90(da,solution_vec,FandF_tau,err_PETSc) CHKERRQ(err_PETSc) end subroutine grid_mechanical_spectral_polarisation_restartWrite diff --git a/src/grid/grid_thermal_spectral.f90 b/src/grid/grid_thermal_spectral.f90 index 70d307ed9..1c3f2129a 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -285,7 +285,7 @@ end subroutine grid_thermal_spectral_forward !-------------------------------------------------------------------------------------------------- !> @brief Write current solver and constitutive data for restart to file. !-------------------------------------------------------------------------------------------------- -subroutine grid_thermal_spectral_restartWrite +subroutine grid_thermal_spectral_restartWrite() PetscErrorCode :: err_PETSc DM :: dm_local @@ -294,7 +294,7 @@ subroutine grid_thermal_spectral_restartWrite call SNESGetDM(SNES_thermal,dm_local,err_PETSc); CHKERRQ(err_PETSc) - call DMDAVecGetArrayF90(dm_local,solution_vec,T,err_PETSc); + call DMDAVecGetArrayReadF90(dm_local,solution_vec,T,err_PETSc); CHKERRQ(err_PETSc) print'(1x,a)', 'saving thermal solver data required for restart'; flush(IO_STDOUT) @@ -307,7 +307,7 @@ subroutine grid_thermal_spectral_restartWrite call HDF5_closeGroup(groupHandle) call HDF5_closeFile(fileHandle) - call DMDAVecRestoreArrayF90(dm_local,solution_vec,T,err_PETSc); + call DMDAVecRestoreArrayReadF90(dm_local,solution_vec,T,err_PETSc); CHKERRQ(err_PETSc) end subroutine grid_thermal_spectral_restartWrite