From 015cf02bd6622c7b20dd25bc5de6848005d4acc0 Mon Sep 17 00:00:00 2001 From: PauloChambelGit Date: Thu, 25 May 2017 17:12:47 +0100 Subject: [PATCH 1/3] CRITICAL ERROR related with the option EXTRAPOLATE In November 2016 I introduce same changes in the extrapolation process. Howver, the code was not tested correctly. The erro was related with the programming of EXIT action from a set of do loops. WRONG WAY do k = KLB, KUB do j = JLB, JUB do i = ILB, IUB if (OutValues3D(i, j, k) > FillValueReal/1e4) then kfirst = k exit endif enddo enddo enddo RIGHT WAY d2: do k = KLB, KUB do j = JLB, JUB do i = ILB, IUB if (OutValues3D(i, j, k) > FillValueReal/1e4) then kfirst = k exit d2 endif enddo enddo enddo d2 --- Software/MOHIDBase1/ModuleFunctions.F90 | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Software/MOHIDBase1/ModuleFunctions.F90 b/Software/MOHIDBase1/ModuleFunctions.F90 index f5e1639c6..31a20d96c 100644 --- a/Software/MOHIDBase1/ModuleFunctions.F90 +++ b/Software/MOHIDBase1/ModuleFunctions.F90 @@ -5194,7 +5194,7 @@ subroutine FillMatrix3D (ILB, IUB, JLB, JUB, KLB, KUB, ComputePoints3D, OutValue real, dimension(:,: ), pointer :: Value2D integer, dimension(:,: ), pointer :: Map2D - integer :: k, kfirst, klast + integer :: k, kfirst, klast, i, j !Begin----------------------------------------------------------------- @@ -5218,10 +5218,14 @@ subroutine FillMatrix3D (ILB, IUB, JLB, JUB, KLB, KUB, ComputePoints3D, OutValue !Search for the first layer with data d2: do k = KLB, KUB - if (OutValues3D(ILB, JLB, k) > FillValueReal/1e4) then + do j = JLB, JUB + do i = ILB, IUB + if (OutValues3D(i, j, k) > FillValueReal/1e4) then kfirst = k - exit + exit d2 endif + enddo + enddo enddo d2 !Extrapolate for the bottom layers @@ -5231,10 +5235,14 @@ subroutine FillMatrix3D (ILB, IUB, JLB, JUB, KLB, KUB, ComputePoints3D, OutValue !Search for the last layer with data d4: do k = KUB, KLB,-1 + do j = JLB, JUB + do i = ILB, IUB if (OutValues3D(ILB, JLB, k) > FillValueReal/1e4) then klast = k - exit + exit d4 endif + enddo + enddo enddo d4 !Extrapolate for the surface layers From 5ebc9465fbd117ae9c668b5c4814aac905cc1932 Mon Sep 17 00:00:00 2001 From: guifranz Date: Fri, 26 May 2017 18:37:09 +0100 Subject: [PATCH 2/3] Small change --- Software/MOHIDWater/ModuleSediment.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Software/MOHIDWater/ModuleSediment.F90 b/Software/MOHIDWater/ModuleSediment.F90 index 0a76bf9e4..12cd51aff 100644 --- a/Software/MOHIDWater/ModuleSediment.F90 +++ b/Software/MOHIDWater/ModuleSediment.F90 @@ -8113,7 +8113,7 @@ subroutine ReadLockExternalVar call GetComputeFaces2D(Me%ObjHorizontalMap, & ComputeFaces2DU = Me%ExternalVar%ComputeFacesU2D, & ComputeFaces2DV = Me%ExternalVar%ComputeFacesV2D, & - ActualTime = Me%ExternalVar%Now, & + !ActualTime = Me%ExternalVar%Now, & STAT = STAT_CALL) if (STAT_CALL /= SUCCESS_) stop 'ReadLockExternalVar - ModuleSediment - ERR06' From 03c0c17ee299ac92ac4a001b8bebf02d6a4ed99c Mon Sep 17 00:00:00 2001 From: guifranz Date: Wed, 7 Jun 2017 12:19:35 +0100 Subject: [PATCH 3/3] Bug fix Bug introduced on Nov 10 2016 was fixed. --- Software/MOHIDWater/ModuleSediment.F90 | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Software/MOHIDWater/ModuleSediment.F90 b/Software/MOHIDWater/ModuleSediment.F90 index 12cd51aff..bac943a54 100644 --- a/Software/MOHIDWater/ModuleSediment.F90 +++ b/Software/MOHIDWater/ModuleSediment.F90 @@ -5335,15 +5335,13 @@ subroutine ComputeBedSlopeEffects dhdy = 0. if (SandClass%FluxU(i, j) < 0.) then - !if (Me%ExternalVar%ComputeFacesU2D(i, j) == Covered ) then - if (Me%ExternalVar%WaterPoints2D(i, j-1) == WaterPoint) then + if (Me%ExternalVar%ComputeFacesU2D(i, j) == Covered ) then dhdx = (Me%ExternalVar%Bathymetry(i, j) - Me%ExternalVar%Bathymetry(i, j-1)) / & Me%ExternalVar%DZX(i,j-1) endif else - !if (Me%ExternalVar%ComputeFacesU2D(i,j+1) == Covered) then - if (Me%ExternalVar%WaterPoints2D(i, j+1) == WaterPoint) then + if (Me%ExternalVar%ComputeFacesU2D(i,j+1) == Covered) then dhdx = (Me%ExternalVar%Bathymetry(i, j+1) - Me%ExternalVar%Bathymetry(i, j)) / & Me%ExternalVar%DZX(i,j) @@ -5351,15 +5349,13 @@ subroutine ComputeBedSlopeEffects endif if (SandClass%FluxV(i, j) < 0.) then - !if (Me%ExternalVar%ComputeFacesV2D(i, j) == Covered) then - if (Me%ExternalVar%WaterPoints2D(i-1, j) == WaterPoint) then + if (Me%ExternalVar%ComputeFacesV2D(i, j) == Covered) then dhdy = (Me%ExternalVar%Bathymetry(i, j) - Me%ExternalVar%Bathymetry(i-1, j)) / & Me%ExternalVar%DZY(i-1,j) endif else - !if (Me%ExternalVar%ComputeFacesV2D(i+1, j) == Covered) then - if (Me%ExternalVar%WaterPoints2D(i+1, j) == WaterPoint) then + if (Me%ExternalVar%ComputeFacesV2D(i+1, j) == Covered) then dhdy = (Me%ExternalVar%Bathymetry(i+1, j) - Me%ExternalVar%Bathymetry(i, j)) / & Me%ExternalVar%DZY(i,j) @@ -5708,8 +5704,7 @@ subroutine ComputeEvolution do i=WILB, WIUB if (SandClass%FluxU(i, j) < 0.) then - !if (Me%ExternalVar%ComputeFacesU2D(i, j) == Covered ) then - if (Me%ExternalVar%WaterPoints2D(i, j-1) == WaterPoint) then + if (Me%ExternalVar%ComputeFacesU2D(i, j) == Covered ) then SandClass%DM(i, j-1) = SandClass%DM(i, j-1) - Me%Evolution%SedimentDT * SandClass%FluxU(i, j) SandClass%DM(i, j ) = SandClass%DM(i, j ) + Me%Evolution%SedimentDT * SandClass%FluxU(i, j) @@ -5721,8 +5716,7 @@ subroutine ComputeEvolution endif elseif (SandClass%FluxU(i, j) > 0.) then - !if (Me%ExternalVar%ComputeFacesU2D(i,j+1) == Covered) then - if (Me%ExternalVar%WaterPoints2D(i, j+1) == WaterPoint) then + if (Me%ExternalVar%ComputeFacesU2D(i,j+1) == Covered) then SandClass%DM(i, j+1) = SandClass%DM(i, j+1) + Me%Evolution%SedimentDT * SandClass%FluxU(i, j) SandClass%DM(i, j ) = SandClass%DM(i, j ) - Me%Evolution%SedimentDT * SandClass%FluxU(i, j)