From 8675ecae95aebab51f4ca9ecb1a721b4a37deded Mon Sep 17 00:00:00 2001 From: David A Minton Date: Tue, 5 Sep 2023 15:38:04 -0400 Subject: [PATCH] Restructured the regolith stacks so that there is no longer a buffer layer. Layer 1 is now a bedrock layer down to the centerl starts from bedrock now. --- src/Makefile.am | 2 +- src/globals/module_globals.f90 | 3 --- src/init/init_regolith_stack.f90 | 29 +++-------------------------- src/util/module_util.f90 | 2 +- src/util/util_init_array.f90 | 21 ++------------------- 5 files changed, 7 insertions(+), 50 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index efe3c311..2e8c1902 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,7 +11,7 @@ AM_FCFLAGS = $(IPRODUCTION) #ifort debug flags #gfortran optimized flags -AM_FCFLAGS = -O3 -fopenmp -ffree-form -g -fbounds-check -fbacktrace +#AM_FCFLAGS = -O3 -fopenmp -ffree-form -g -fbounds-check -fbacktrace #gfortran debug flags #AM_FCFLAGS = -O0 -g -fopenmp -fbounds-check -Wall -Warray-bounds -Warray-temporaries -Wimplicit-interface -ffree-form -fsanitize-address-use-after-scope -fstack-check -fsanitize=bounds-strict -fsanitize=undefined -fsanitize=signed-integer-overflow -fsanitize=object-size -fstack-protector-all diff --git a/src/globals/module_globals.f90 b/src/globals/module_globals.f90 index d4ae2f8b..cbc4e539 100644 --- a/src/globals/module_globals.f90 +++ b/src/globals/module_globals.f90 @@ -67,9 +67,6 @@ module module_globals real(SP),dimension(MAXAGEBINS) :: age real(DP) :: thickness real(DP) :: comp - real(DP) :: porosity ! Porosity: Maximum 1, Minium 0. - real(DP) :: damage ! Damage : Maximum 1, Minium 0. - real(DP) :: depth ! Absolute location with respect to the initial surface. real(DP) :: meltvolume real(DP) :: totvolume real(DP) :: ejm !ejected melt diff --git a/src/init/init_regolith_stack.f90 b/src/init/init_regolith_stack.f90 index 27649e33..7115a63c 100644 --- a/src/init/init_regolith_stack.f90 +++ b/src/init/init_regolith_stack.f90 @@ -28,41 +28,18 @@ subroutine init_regolith_stack(user,surf,domain) type(usertype),intent(in) :: user type(surftype),dimension(:,:),intent(inout) :: surf type(domaintype),intent(in) :: domain - type(regodatatype) :: bedrock - integer(I4B) :: xp,yp,k + integer(I4B) :: xp,yp ! Internal variables logical :: initstat - ! Temporary variable setup for initialize a pre-exising structure - type(regodatatype) :: test_stratig - !call init_regolith_parab(user,surf) !======================================= ! Initialize the grid space !======================================= - bedrock%thickness = user%trad - bedrock%comp = 0._DP - bedrock%age(:) = 0.0_SP - allocate(bedrock%distvol(1+domain%rcnum)) - bedrock%distvol(:) = 0.0_SP - bedrock%meltvolume = 0.0_DP - bedrock%totvolume = bedrock%thickness * user%pix * user%pix - bedrock%ejm = 0.0_DP - - do yp = 1, user%gridsize - do xp = 1, user%gridsize - - !call util_init_list(surf(xp,yp)%regolayer,initstat) - call util_init_array(user,surf(xp,yp)%regolayer,domain,initstat) - - if (initstat) then - call util_push_array(surf(xp,yp)%regolayer,bedrock) - else - write(*,*) 'init_regolith_stack: Initialization of regolayer failed.' - end if - end do + do concurrent(xp=1:user%gridsize,yp=1:user%gridsize) + call util_init_array(user,surf(xp,yp)%regolayer,domain,initstat) end do return diff --git a/src/util/module_util.f90 b/src/util/module_util.f90 index a15dfaf6..20dd4d87 100644 --- a/src/util/module_util.f90 +++ b/src/util/module_util.f90 @@ -111,7 +111,7 @@ end subroutine util_destroy_list ! end interface interface - subroutine util_init_array(user,regolayer,domain,initstat) + pure subroutine util_init_array(user,regolayer,domain,initstat) use module_globals implicit none type(usertype),intent(in) :: user diff --git a/src/util/util_init_array.f90 b/src/util/util_init_array.f90 index 812efaf8..0ad02335 100644 --- a/src/util/util_init_array.f90 +++ b/src/util/util_init_array.f90 @@ -19,7 +19,7 @@ ! Notes : ! !********************************************************************************************************************************** -subroutine util_init_array(user,regolayer,domain,initstat) +pure subroutine util_init_array(user,regolayer,domain,initstat) use module_globals use module_util, EXCEPT_THIS_ONE => util_init_array implicit none @@ -35,23 +35,12 @@ subroutine util_init_array(user,regolayer,domain,initstat) ! Executable code initstat = .false. - ! if (.not. associated(regolayer)) then - ! allocate(regolayer, STAT=allocstat) - ! if (allocstat == 0) then - ! initstat = .true. - ! nullify(regolayer%next) - ! regolayer%regodata%thickness = sqrt(VBIG) ! This generates a buffer layer that the model should never reach if the run is structured properly - ! regolayer%regodata%comp = 0.0_DP - ! regolayer%regodata%meltfrac = 0.0_DP - ! regolayer%regodata%porosity = 0.0_DP - ! regolayer%regodata%age(:) = 0.0_SP if (allocated(regolayer)) deallocate(regolayer) allocate(regolayer(1),stat=allocstat) if (allocstat == 0) then initstat = .true. - regolayer(1)%thickness = sqrt(VBIG) ! This generates a buffer layer that the model should never reach if the run is structured properly + regolayer(1)%thickness = user%trad ! This generates a buffer layer that the model should never reach if the run is structured properly regolayer(1)%comp = 0.0_DP - regolayer(1)%porosity = 0.0_DP regolayer(1)%age(:) = 0.0_SP regolayer(1)%ejm = 0.0_DP allocate(regolayer(1)%distvol(1+domain%rcnum)) @@ -59,12 +48,6 @@ subroutine util_init_array(user,regolayer,domain,initstat) regolayer(1)%meltvolume = 0.0_DP regolayer(1)%totvolume = regolayer(1)%thickness * user%pix * user%pix end if - ! else - ! write(*,*) 'util_init_list: Initialization failed. Exhausted memory.' - ! end if - ! else - ! write(*,*) 'util_init_list: Initialization failed. Regolayer already associated.' - ! end if return end subroutine util_init_array \ No newline at end of file