From 7d7d0c26591ac067fb2e385e9468d83907b6abdc Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 11 Dec 2021 08:49:30 +0100 Subject: [PATCH 1/5] only local variable are good variables --- src/grid/DAMASK_grid.f90 | 9 +++++++++ src/grid/spectral_utilities.f90 | 15 +-------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index de324e0f5..b1da0c2a2 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -43,6 +43,15 @@ program DAMASK_grid logical :: estimate_rate !< follow trajectory of former loadcase end type tLoadCase +!-------------------------------------------------------------------------------------------------- +! field labels information + enum, bind(c); enumerator :: & + FIELD_UNDEFINED_ID, & + FIELD_MECH_ID, & + FIELD_THERMAL_ID, & + FIELD_DAMAGE_ID + end enum + integer(kind(FIELD_UNDEFINED_ID)), allocatable :: ID(:) !-------------------------------------------------------------------------------------------------- diff --git a/src/grid/spectral_utilities.f90 b/src/grid/spectral_utilities.f90 index 29777db3b..69b1d8fda 100644 --- a/src/grid/spectral_utilities.f90 +++ b/src/grid/spectral_utilities.f90 @@ -28,15 +28,6 @@ module spectral_utilities include 'fftw3-mpi.f03' -!-------------------------------------------------------------------------------------------------- -! field labels information - enum, bind(c); enumerator :: & - FIELD_UNDEFINED_ID, & - FIELD_MECH_ID, & - FIELD_THERMAL_ID, & - FIELD_DAMAGE_ID - end enum - !-------------------------------------------------------------------------------------------------- ! grid related information information real(pReal), protected, public :: wgt !< weighting factor 1/Nelems @@ -139,11 +130,7 @@ module spectral_utilities utilities_calculateRate, & utilities_forwardField, & utilities_updateCoords, & - utilities_saveReferenceStiffness, & - FIELD_UNDEFINED_ID, & - FIELD_MECH_ID, & - FIELD_THERMAL_ID, & - FIELD_DAMAGE_ID + utilities_saveReferenceStiffness contains From f51633d43a32a98b4117009971d7eb37a6783692 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 11 Dec 2021 09:01:42 +0100 Subject: [PATCH 2/5] forall is deprecated do concurrent is the successor but ifort had problems and generated faulty code --- src/grid/spectral_utilities.f90 | 40 ++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/src/grid/spectral_utilities.f90 b/src/grid/spectral_utilities.f90 index 69b1d8fda..f40025039 100644 --- a/src/grid/spectral_utilities.f90 +++ b/src/grid/spectral_utilities.f90 @@ -375,21 +375,24 @@ subroutine utilities_updateGamma(C) gamma_hat = cmplx(0.0_pReal,0.0_pReal,pReal) ! for the singular point and any non invertible A do k = grid3Offset+1, grid3Offset+grid3; do j = 1, grid(2); do i = 1, grid1Red if (any([i,j,k] /= 1)) then ! singular point at xi=(0.0,0.0,0.0) i.e. i=j=k=1 - forall(l = 1:3, m = 1:3) & + do concurrent (l = 1:3, m = 1:3) xiDyad_cmplx(l,m) = conjg(-xi1st(l,i,j,k-grid3Offset))*xi1st(m,i,j,k-grid3Offset) - forall(l = 1:3, m = 1:3) & + end do + do concurrent(l = 1:3, m = 1:3) temp33_complex(l,m) = sum(cmplx(C_ref(l,1:3,m,1:3),0.0_pReal)*xiDyad_cmplx) + end do A(1:3,1:3) = temp33_complex%re; A(4:6,4:6) = temp33_complex%re A(1:3,4:6) = temp33_complex%im; A(4:6,1:3) = -temp33_complex%im if (abs(math_det33(A(1:3,1:3))) > 1e-16) then call math_invert(A_inv, err, A) temp33_complex = cmplx(A_inv(1:3,1:3),A_inv(1:3,4:6),pReal) - forall(l=1:3, m=1:3, n=1:3, o=1:3) & + do concurrent(l=1:3, m=1:3, n=1:3, o=1:3) gamma_hat(l,m,n,o,i,j,k-grid3Offset) = temp33_complex(l,n)* & conjg(-xi1st(o,i,j,k-grid3Offset))*xi1st(m,i,j,k-grid3Offset) - endif - endif - enddo; enddo; enddo + end do + end if + end if + end do; end do; end do endif end subroutine utilities_updateGamma @@ -492,32 +495,37 @@ subroutine utilities_fourierGammaConvolution(fieldAim) memoryEfficient: if (num%memory_efficient) then do k = 1, grid3; do j = 1, grid(2); do i = 1, grid1Red if (any([i,j,k+grid3Offset] /= 1)) then ! singular point at xi=(0.0,0.0,0.0) i.e. i=j=k=1 - forall(l = 1:3, m = 1:3) & + do concurrent(l = 1:3, m = 1:3) xiDyad_cmplx(l,m) = conjg(-xi1st(l,i,j,k))*xi1st(m,i,j,k) - forall(l = 1:3, m = 1:3) & + end do + do concurrent(l = 1:3, m = 1:3) temp33_complex(l,m) = sum(cmplx(C_ref(l,1:3,m,1:3),0.0_pReal)*xiDyad_cmplx) + end do A(1:3,1:3) = temp33_complex%re; A(4:6,4:6) = temp33_complex%re A(1:3,4:6) = temp33_complex%im; A(4:6,1:3) = -temp33_complex%im if (abs(math_det33(A(1:3,1:3))) > 1e-16) then call math_invert(A_inv, err, A) temp33_complex = cmplx(A_inv(1:3,1:3),A_inv(1:3,4:6),pReal) - forall(l=1:3, m=1:3, n=1:3, o=1:3) & + do concurrent(l=1:3, m=1:3, n=1:3, o=1:3) gamma_hat(l,m,n,o,1,1,1) = temp33_complex(l,n)*conjg(-xi1st(o,i,j,k))*xi1st(m,i,j,k) + end do else gamma_hat(1:3,1:3,1:3,1:3,1,1,1) = cmplx(0.0_pReal,0.0_pReal,pReal) - endif - forall(l = 1:3, m = 1:3) & + end if + do concurrent(l = 1:3, m = 1:3) temp33_Complex(l,m) = sum(gamma_hat(l,m,1:3,1:3,1,1,1)*tensorField_fourier(1:3,1:3,i,j,k)) + end do tensorField_fourier(1:3,1:3,i,j,k) = temp33_Complex - endif - enddo; enddo; enddo + end if + end do; end do; end do else memoryEfficient do k = 1, grid3; do j = 1, grid(2); do i = 1,grid1Red - forall(l = 1:3, m = 1:3) & + do concurrent(l = 1:3, m = 1:3) temp33_Complex(l,m) = sum(gamma_hat(l,m,1:3,1:3,i,j,k) * tensorField_fourier(1:3,1:3,i,j,k)) + end do tensorField_fourier(1:3,1:3,i,j,k) = temp33_Complex - enddo; enddo; enddo - endif memoryEfficient + end do; end do; end do + end if memoryEfficient if (grid3Offset == 0) tensorField_fourier(1:3,1:3,1,1,1) = cmplx(fieldAim/wgt,0.0_pReal,pReal) From d6ba73d9e28589f9fb4a4e860e679edb19bd7dd2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 11 Dec 2021 09:54:46 +0100 Subject: [PATCH 3/5] consistent names --- src/phase_mechanical.f90 | 38 +++++++-------- src/phase_mechanical_eigen.f90 | 18 ++++---- src/phase_mechanical_elastic.f90 | 2 +- src/phase_mechanical_plastic.f90 | 56 +++++++++++------------ src/phase_mechanical_plastic_nonlocal.f90 | 4 +- 5 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index db2faf914..37e6fe7bf 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -5,17 +5,17 @@ submodule(phase) mechanical enum, bind(c); enumerator :: & - PLASTICITY_UNDEFINED_ID, & - PLASTICITY_NONE_ID, & - PLASTICITY_ISOTROPIC_ID, & - PLASTICITY_PHENOPOWERLAW_ID, & - PLASTICITY_KINEHARDENING_ID, & - PLASTICITY_DISLOTWIN_ID, & - PLASTICITY_DISLOTUNGSTEN_ID, & - PLASTICITY_NONLOCAL_ID, & - KINEMATICS_UNDEFINED_ID, & - KINEMATICS_CLEAVAGE_OPENING_ID, & - KINEMATICS_THERMAL_EXPANSION_ID + PLASTIC_UNDEFINED_ID, & + PLASTIC_NONE_ID, & + PLASTIC_ISOTROPIC_ID, & + PLASTIC_PHENOPOWERLAW_ID, & + PLASTIC_KINEHARDENING_ID, & + PLASTIC_DISLOTWIN_ID, & + PLASTIC_DISLOTUNGSTEN_ID, & + PLASTIC_NONLOCAL_ID, & + EIGEN_UNDEFINED_ID, & + EIGEN_CLEAVAGE_OPENING_ID, & + EIGEN_THERMAL_EXPANSION_ID end enum type(tTensorContainer), dimension(:), allocatable :: & @@ -37,7 +37,7 @@ submodule(phase) mechanical phase_mechanical_S0 - integer(kind(PLASTICITY_undefined_ID)), dimension(:), allocatable :: & + integer(kind(PLASTIC_undefined_ID)), dimension(:), allocatable :: & phase_plasticity !< plasticity of each phase integer :: phase_plasticity_maxSizeDotState @@ -291,7 +291,7 @@ module subroutine mechanical_init(phases) call elastic_init(phases) allocate(plasticState(phases%length)) - allocate(phase_plasticity(phases%length),source = PLASTICITY_undefined_ID) + allocate(phase_plasticity(phases%length),source = PLASTIC_UNDEFINED_ID) call plastic_init() do ph = 1,phases%length plasticState(ph)%state0 = plasticState(ph)%state @@ -340,22 +340,22 @@ module subroutine mechanical_results(group,ph) select case(phase_plasticity(ph)) - case(PLASTICITY_ISOTROPIC_ID) + case(PLASTIC_ISOTROPIC_ID) call plastic_isotropic_results(ph,group//'mechanical/') - case(PLASTICITY_PHENOPOWERLAW_ID) + case(PLASTIC_PHENOPOWERLAW_ID) call plastic_phenopowerlaw_results(ph,group//'mechanical/') - case(PLASTICITY_KINEHARDENING_ID) + case(PLASTIC_KINEHARDENING_ID) call plastic_kinehardening_results(ph,group//'mechanical/') - case(PLASTICITY_DISLOTWIN_ID) + case(PLASTIC_DISLOTWIN_ID) call plastic_dislotwin_results(ph,group//'mechanical/') - case(PLASTICITY_DISLOTUNGSTEN_ID) + case(PLASTIC_DISLOTUNGSTEN_ID) call plastic_dislotungsten_results(ph,group//'mechanical/') - case(PLASTICITY_NONLOCAL_ID) + case(PLASTIC_NONLOCAL_ID) call plastic_nonlocal_results(ph,group//'mechanical/') end select diff --git a/src/phase_mechanical_eigen.f90 b/src/phase_mechanical_eigen.f90 index c73665d17..f0b86319c 100644 --- a/src/phase_mechanical_eigen.f90 +++ b/src/phase_mechanical_eigen.f90 @@ -3,9 +3,9 @@ submodule(phase:mechanical) eigen integer, dimension(:), allocatable :: & Nmodels - integer(kind(KINEMATICS_UNDEFINED_ID)), dimension(:,:), allocatable :: & + integer(kind(EIGEN_UNDEFINED_ID)), dimension(:,:), allocatable :: & model - integer(kind(KINEMATICS_UNDEFINED_ID)), dimension(:), allocatable :: & + integer(kind(EIGEN_UNDEFINED_ID)), dimension(:), allocatable :: & model_damage interface @@ -57,15 +57,15 @@ module subroutine eigen_init(phases) Nmodels(ph) = kinematics%length end do - allocate(model(maxval(Nmodels),phases%length), source = KINEMATICS_undefined_ID) + allocate(model(maxval(Nmodels),phases%length), source = EIGEN_undefined_ID) if (maxval(Nmodels) /= 0) then - where(thermalexpansion_init(maxval(Nmodels))) model = KINEMATICS_thermal_expansion_ID + where(thermalexpansion_init(maxval(Nmodels))) model = EIGEN_thermal_expansion_ID endif - allocate(model_damage(phases%length), source = KINEMATICS_UNDEFINED_ID) + allocate(model_damage(phases%length), source = EIGEN_UNDEFINED_ID) - where(damage_anisobrittle_init()) model_damage = KINEMATICS_cleavage_opening_ID + where(damage_anisobrittle_init()) model_damage = EIGEN_cleavage_opening_ID end subroutine eigen_init @@ -173,7 +173,7 @@ module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & plasticType: select case (phase_plasticity(ph)) - case (PLASTICITY_isotropic_ID) plasticType + case (PLASTIC_isotropic_ID) plasticType call plastic_isotropic_LiAndItsTangent(my_Li, my_dLi_dS, S ,ph,en) Li = Li + my_Li dLi_dS = dLi_dS + my_dLi_dS @@ -182,7 +182,7 @@ module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & KinematicsLoop: do k = 1, Nmodels(ph) kinematicsType: select case (model(k,ph)) - case (KINEMATICS_thermal_expansion_ID) kinematicsType + case (EIGEN_thermal_expansion_ID) kinematicsType call thermalexpansion_LiAndItsTangent(my_Li, my_dLi_dS, ph,en) Li = Li + my_Li dLi_dS = dLi_dS + my_dLi_dS @@ -191,7 +191,7 @@ module subroutine phase_LiAndItsTangents(Li, dLi_dS, dLi_dFi, & end do KinematicsLoop select case (model_damage(ph)) - case (KINEMATICS_cleavage_opening_ID) + case (EIGEN_cleavage_opening_ID) call damage_anisobrittle_LiAndItsTangent(my_Li, my_dLi_dS, S, ph, en) Li = Li + my_Li dLi_dS = dLi_dS + my_dLi_dS diff --git a/src/phase_mechanical_elastic.f90 b/src/phase_mechanical_elastic.f90 index ea113ddfb..acbbac236 100644 --- a/src/phase_mechanical_elastic.f90 +++ b/src/phase_mechanical_elastic.f90 @@ -223,7 +223,7 @@ module function phase_homogenizedC66(ph,en) result(C) plasticType: select case (phase_plasticity(ph)) - case (PLASTICITY_DISLOTWIN_ID) plasticType + case (PLASTIC_DISLOTWIN_ID) plasticType C = plastic_dislotwin_homogenizedC(ph,en) case default plasticType C = elastic_C66(ph,en) diff --git a/src/phase_mechanical_plastic.f90 b/src/phase_mechanical_plastic.f90 index b2a9bdcc4..4951712fd 100644 --- a/src/phase_mechanical_plastic.f90 +++ b/src/phase_mechanical_plastic.f90 @@ -224,15 +224,15 @@ module subroutine plastic_init print'(/,1x,a)', '<<<+- phase:mechanical:plastic init -+>>>' - where(plastic_none_init()) phase_plasticity = PLASTICITY_NONE_ID - where(plastic_isotropic_init()) phase_plasticity = PLASTICITY_ISOTROPIC_ID - where(plastic_phenopowerlaw_init()) phase_plasticity = PLASTICITY_PHENOPOWERLAW_ID - where(plastic_kinehardening_init()) phase_plasticity = PLASTICITY_KINEHARDENING_ID - where(plastic_dislotwin_init()) phase_plasticity = PLASTICITY_DISLOTWIN_ID - where(plastic_dislotungsten_init()) phase_plasticity = PLASTICITY_DISLOTUNGSTEN_ID - where(plastic_nonlocal_init()) phase_plasticity = PLASTICITY_NONLOCAL_ID + where(plastic_none_init()) phase_plasticity = PLASTIC_NONE_ID + where(plastic_isotropic_init()) phase_plasticity = PLASTIC_ISOTROPIC_ID + where(plastic_phenopowerlaw_init()) phase_plasticity = PLASTIC_PHENOPOWERLAW_ID + where(plastic_kinehardening_init()) phase_plasticity = PLASTIC_KINEHARDENING_ID + where(plastic_dislotwin_init()) phase_plasticity = PLASTIC_DISLOTWIN_ID + where(plastic_dislotungsten_init()) phase_plasticity = PLASTIC_DISLOTUNGSTEN_ID + where(plastic_nonlocal_init()) phase_plasticity = PLASTIC_NONLOCAL_ID - if (any(phase_plasticity == PLASTICITY_undefined_ID)) call IO_error(201) + if (any(phase_plasticity == PLASTIC_undefined_ID)) call IO_error(201) end subroutine plastic_init @@ -262,7 +262,7 @@ module subroutine plastic_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, & i, j - if (phase_plasticity(ph) == PLASTICITY_NONE_ID) then + if (phase_plasticity(ph) == PLASTIC_NONE_ID) then Lp = 0.0_pReal dLp_dFi = 0.0_pReal dLp_dS = 0.0_pReal @@ -272,22 +272,22 @@ module subroutine plastic_LpAndItsTangents(Lp, dLp_dS, dLp_dFi, & plasticType: select case (phase_plasticity(ph)) - case (PLASTICITY_ISOTROPIC_ID) plasticType + case (PLASTIC_ISOTROPIC_ID) plasticType call isotropic_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,en) - case (PLASTICITY_PHENOPOWERLAW_ID) plasticType + case (PLASTIC_PHENOPOWERLAW_ID) plasticType call phenopowerlaw_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,en) - case (PLASTICITY_KINEHARDENING_ID) plasticType + case (PLASTIC_KINEHARDENING_ID) plasticType call kinehardening_LpAndItsTangent(Lp,dLp_dMp,Mp,ph,en) - case (PLASTICITY_NONLOCAL_ID) plasticType + case (PLASTIC_NONLOCAL_ID) plasticType call nonlocal_LpAndItsTangent(Lp,dLp_dMp,Mp, thermal_T(ph,en),ph,en) - case (PLASTICITY_DISLOTWIN_ID) plasticType + case (PLASTIC_DISLOTWIN_ID) plasticType call dislotwin_LpAndItsTangent(Lp,dLp_dMp,Mp, thermal_T(ph,en),ph,en) - case (PLASTICITY_DISLOTUNGSTEN_ID) plasticType + case (PLASTIC_DISLOTUNGSTEN_ID) plasticType call dislotungsten_LpAndItsTangent(Lp,dLp_dMp,Mp, thermal_T(ph,en),ph,en) end select plasticType @@ -321,28 +321,28 @@ module function plastic_dotState(subdt,co,ip,el,ph,en) result(broken) logical :: broken - if (phase_plasticity(ph) /= PLASTICITY_NONE_ID) then + if (phase_plasticity(ph) /= PLASTIC_NONE_ID) then Mp = matmul(matmul(transpose(phase_mechanical_Fi(ph)%data(1:3,1:3,en)),& phase_mechanical_Fi(ph)%data(1:3,1:3,en)),phase_mechanical_S(ph)%data(1:3,1:3,en)) plasticType: select case (phase_plasticity(ph)) - case (PLASTICITY_ISOTROPIC_ID) plasticType + case (PLASTIC_ISOTROPIC_ID) plasticType call isotropic_dotState(Mp,ph,en) - case (PLASTICITY_PHENOPOWERLAW_ID) plasticType + case (PLASTIC_PHENOPOWERLAW_ID) plasticType call phenopowerlaw_dotState(Mp,ph,en) - case (PLASTICITY_KINEHARDENING_ID) plasticType + case (PLASTIC_KINEHARDENING_ID) plasticType call plastic_kinehardening_dotState(Mp,ph,en) - case (PLASTICITY_DISLOTWIN_ID) plasticType + case (PLASTIC_DISLOTWIN_ID) plasticType call dislotwin_dotState(Mp,thermal_T(ph,en),ph,en) - case (PLASTICITY_DISLOTUNGSTEN_ID) plasticType + case (PLASTIC_DISLOTUNGSTEN_ID) plasticType call dislotungsten_dotState(Mp,thermal_T(ph,en),ph,en) - case (PLASTICITY_NONLOCAL_ID) plasticType + case (PLASTIC_NONLOCAL_ID) plasticType call nonlocal_dotState(Mp,thermal_T(ph,en),subdt,ph,en,ip,el) end select plasticType end if @@ -372,13 +372,13 @@ module subroutine plastic_dependentState(co, ip, el) plasticType: select case (phase_plasticity(ph)) - case (PLASTICITY_DISLOTWIN_ID) plasticType + case (PLASTIC_DISLOTWIN_ID) plasticType call dislotwin_dependentState(thermal_T(ph,en),ph,en) - case (PLASTICITY_DISLOTUNGSTEN_ID) plasticType + case (PLASTIC_DISLOTUNGSTEN_ID) plasticType call dislotungsten_dependentState(ph,en) - case (PLASTICITY_NONLOCAL_ID) plasticType + case (PLASTIC_NONLOCAL_ID) plasticType call nonlocal_dependentState(ph,en,ip,el) end select plasticType @@ -406,7 +406,7 @@ module function plastic_deltaState(ph, en) result(broken) broken = .false. select case (phase_plasticity(ph)) - case (PLASTICITY_NONLOCAL_ID,PLASTICITY_KINEHARDENING_ID) + case (PLASTIC_NONLOCAL_ID,PLASTIC_KINEHARDENING_ID) Mp = matmul(matmul(transpose(phase_mechanical_Fi(ph)%data(1:3,1:3,en)),& phase_mechanical_Fi(ph)%data(1:3,1:3,en)),& @@ -414,10 +414,10 @@ module function plastic_deltaState(ph, en) result(broken) plasticType: select case (phase_plasticity(ph)) - case (PLASTICITY_KINEHARDENING_ID) plasticType + case (PLASTIC_KINEHARDENING_ID) plasticType call plastic_kinehardening_deltaState(Mp,ph,en) - case (PLASTICITY_NONLOCAL_ID) plasticType + case (PLASTIC_NONLOCAL_ID) plasticType call plastic_nonlocal_deltaState(Mp,ph,en) end select plasticType diff --git a/src/phase_mechanical_plastic_nonlocal.f90 b/src/phase_mechanical_plastic_nonlocal.f90 index 6bd648eaa..c762039d4 100644 --- a/src/phase_mechanical_plastic_nonlocal.f90 +++ b/src/phase_mechanical_plastic_nonlocal.f90 @@ -1277,7 +1277,7 @@ function rhoDotFlux(timestep,ph,en,ip,el) !* The entering flux from my neighbor will be distributed on my slip systems according to the !* compatibility if (neighbor_n > 0) then - if (phase_plasticity(material_phaseAt(1,neighbor_el)) == PLASTICITY_NONLOCAL_ID .and. & + if (phase_plasticity(material_phaseAt(1,neighbor_el)) == PLASTIC_NONLOCAL_ID .and. & any(compatibility(:,:,:,n,ip,el) > 0.0_pReal)) then forall (s = 1:ns, t = 1:4) @@ -1323,7 +1323,7 @@ function rhoDotFlux(timestep,ph,en,ip,el) !* In case of reduced transmissivity, part of the leaving flux is stored as dead dislocation density. !* That means for an interface of zero transmissivity the leaving flux is fully converted to dead dislocations. if (opposite_n > 0) then - if (phase_plasticity(material_phaseAt(1,opposite_el)) == PLASTICITY_NONLOCAL_ID) then + if (phase_plasticity(material_phaseAt(1,opposite_el)) == PLASTIC_NONLOCAL_ID) then normal_me2neighbor_defConf = math_det33(Favg) & * matmul(math_inv33(transpose(Favg)),IPareaNormal(1:3,n,ip,el)) ! normal of the interface in (average) deformed configuration (pointing en => neighbor) From 6ba2a08e5a5fea121c1bb8693213f9bad249d4ca Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 11 Dec 2021 11:37:17 +0100 Subject: [PATCH 4/5] easier to read --- src/grid/grid_damage_spectral.f90 | 5 ++--- src/grid/grid_thermal_spectral.f90 | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/grid/grid_damage_spectral.f90 b/src/grid/grid_damage_spectral.f90 index 187a6f552..ef229368e 100644 --- a/src/grid/grid_damage_spectral.f90 +++ b/src/grid/grid_damage_spectral.f90 @@ -167,7 +167,7 @@ function grid_damage_spectral_solution(Delta_t) result(solution) integer :: i, j, k, ce type(tSolutionState) :: solution PetscInt :: devNull - PetscReal :: phi_min, phi_max, stagNorm, solnNorm + PetscReal :: phi_min, phi_max, stagNorm PetscErrorCode :: ierr SNESConvergedReason :: reason @@ -189,9 +189,8 @@ function grid_damage_spectral_solution(Delta_t) result(solution) solution%iterationsNeeded = totalIter end if stagNorm = maxval(abs(phi_current - phi_stagInc)) - solnNorm = maxval(abs(phi_current)) call MPI_Allreduce(MPI_IN_PLACE,stagNorm,1,MPI_DOUBLE,MPI_MAX,MPI_COMM_WORLD,ierr) - solution%stagConverged = stagNorm < max(num%eps_damage_atol, num%eps_damage_rtol*solnNorm) + solution%stagConverged = stagNorm < max(num%eps_damage_atol, num%eps_damage_rtol*maxval(phi_current)) call MPI_Allreduce(MPI_IN_PLACE,solution%stagConverged,1,MPI_LOGICAL,MPI_LAND,MPI_COMM_WORLD,ierr) phi_stagInc = phi_current diff --git a/src/grid/grid_thermal_spectral.f90 b/src/grid/grid_thermal_spectral.f90 index 868d3101e..67c7ba1c3 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -162,7 +162,7 @@ function grid_thermal_spectral_solution(Delta_t) result(solution) integer :: i, j, k, ce type(tSolutionState) :: solution PetscInt :: devNull - PetscReal :: T_min, T_max, stagNorm, solnNorm + PetscReal :: T_min, T_max, stagNorm PetscErrorCode :: ierr SNESConvergedReason :: reason @@ -184,9 +184,8 @@ function grid_thermal_spectral_solution(Delta_t) result(solution) solution%iterationsNeeded = totalIter end if stagNorm = maxval(abs(T_current - T_stagInc)) - solnNorm = maxval(abs(T_current)) call MPI_Allreduce(MPI_IN_PLACE,stagNorm,1,MPI_DOUBLE,MPI_MAX,MPI_COMM_WORLD,ierr) - solution%stagConverged = stagNorm < max(num%eps_thermal_atol, num%eps_thermal_rtol*solnNorm) + solution%stagConverged = stagNorm < max(num%eps_thermal_atol, num%eps_thermal_rtol*maxval(T_current)) call MPI_Allreduce(MPI_IN_PLACE,solution%stagConverged,1,MPI_LOGICAL,MPI_LAND,MPI_COMM_WORLD,ierr) T_stagInc = T_current From 5ef918e75b1e0d3cdfb8805e5a5389fa512f040b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 11 Dec 2021 14:55:56 +0100 Subject: [PATCH 5/5] PETSc 3.16.2 is out --- .github/workflows/Fortran.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/Fortran.yml b/.github/workflows/Fortran.yml index 0d11918bc..f852893ea 100644 --- a/.github/workflows/Fortran.yml +++ b/.github/workflows/Fortran.yml @@ -48,17 +48,17 @@ jobs: uses: actions/cache@v2 with: path: download - key: petsc-3.16.0.tar.gz + key: petsc-3.16.2.tar.gz - name: PETSc - Download if: steps.petsc-download.outputs.cache-hit != 'true' run: | - wget -q https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.16.0.tar.gz -P download + wget -q https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.16.2.tar.gz -P download - name: PETSc - Prepare run: | - tar -xf download/petsc-3.16.0.tar.gz -C . - export PETSC_DIR=${PWD}/petsc-3.16.0 + tar -xf download/petsc-3.16.2.tar.gz -C . + export PETSC_DIR=${PWD}/petsc-3.16.2 export PETSC_ARCH=gcc${GCC_V} printenv >> $GITHUB_ENV @@ -66,13 +66,13 @@ jobs: id: petsc-install uses: actions/cache@v2 with: - path: petsc-3.16.0 - key: petsc-3.16.0-${{ matrix.os }}-gcc${{ matrix.gcc_v }}-${{ hashFiles('**/petscversion.h') }} + path: petsc-3.16.2 + key: petsc-3.16.2-${{ matrix.os }}-gcc${{ matrix.gcc_v }}-${{ hashFiles('**/petscversion.h') }} - name: PETSc - Install (Linux) if: contains( matrix.os, 'ubuntu') run: | - cd petsc-3.16.0 + cd petsc-3.16.2 ./configure --with-fc=gfortran --with-cc=gcc --with-cxx=g++ \ --download-mpich --download-fftw --download-hdf5 --download-hdf5-fortran-bindings=1 --download-zlib \ --with-mpi-f90module-visibility=0 @@ -81,7 +81,7 @@ jobs: - name: PETSc - Install (macOS) if: contains( matrix.os, 'macos') run: | - cd petsc-3.16.0 + cd petsc-3.16.2 ./configure --with-fc=gfortran-${GCC_V} --with-cc=gcc-${GCC_V} --with-cxx=g++-${GCC_V} \ --download-openmpi --download-fftw --download-hdf5 --download-hdf5-fortran-bindings=1 --download-zlib make all @@ -132,17 +132,17 @@ jobs: uses: actions/cache@v2 with: path: download - key: petsc-3.16.0.tar.gz + key: petsc-3.16.2.tar.gz - name: PETSc - Download if: steps.petsc-download.outputs.cache-hit != 'true' run: | - wget -q https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.16.0.tar.gz -P download + wget -q https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.16.2.tar.gz -P download - name: PETSc - Prepare run: | - tar -xf download/petsc-3.16.0.tar.gz -C . - export PETSC_DIR=${PWD}/petsc-3.16.0 + tar -xf download/petsc-3.16.2.tar.gz -C . + export PETSC_DIR=${PWD}/petsc-3.16.2 export PETSC_ARCH=intel-${INTEL_V} printenv >> $GITHUB_ENV @@ -150,13 +150,13 @@ jobs: id: petsc-install uses: actions/cache@v2 with: - path: petsc-3.16.0 - key: petsc-3.16.0-intel-${{ matrix.intel_v }}-${{ hashFiles('**/petscversion.h') }} + path: petsc-3.16.2 + key: petsc-3.16.2-intel-${{ matrix.intel_v }}-${{ hashFiles('**/petscversion.h') }} - name: PETSc - Install (classic) if: contains( matrix.intel_v, 'classic') run: | - cd petsc-3.16.0 + cd petsc-3.16.2 ./configure --with-fc=mpiifort --with-cc=mpiicc --with-cxx=mpiicpc \ --download-fftw --download-hdf5 --download-hdf5-fortran-bindings=1 --download-zlib make all @@ -164,7 +164,7 @@ jobs: - name: PETSc - Install (LLVM) if: contains( matrix.intel_v, 'llvm') run: | - cd petsc-3.16.0 + cd petsc-3.16.2 ./configure --with-fc=mpiifort --with-cc="mpiicc -cc=icx" --with-cxx="mpiicpc -cxx=icpx" \ --download-fftw --download-hdf5 --download-hdf5-fortran-bindings=1 --download-zlib make all