From 7c6a231ef465fd737093aa8e5d973f861f675787 Mon Sep 17 00:00:00 2001 From: Jason Floyd Date: Tue, 3 Oct 2023 12:25:41 -0400 Subject: [PATCH] FDS Source: Fix MALT diffusion between 1D layers, Issue #12160 --- Source/func.f90 | 18 +++++++++++------- Source/init.f90 | 2 +- Source/read.f90 | 2 +- Source/wall.f90 | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Source/func.f90 b/Source/func.f90 index 4c3d9868d7a..66183e75c03 100644 --- a/Source/func.f90 +++ b/Source/func.f90 @@ -2698,31 +2698,37 @@ END SUBROUTINE GET_N_LAYER_CELLS !> \param X_S_OLD Array containing old boundaries of the interior cells used when skipping remesh for a layer SUBROUTINE GET_WALL_NODE_COORDINATES(N_CELLS,N_CELLS_OLD,N_LAYERS,N_LAYER_CELLS,N_LAYER_CELLS_OLD,SMALLEST_CELL_SIZE,& - STRETCH_FACTOR,REMESH_LAYER,X_S,X_S_OLD) + STRETCH_FACTOR,REMESH_LAYER,X_S,X_S_OLD,LAYER_THICKNESS) INTEGER, INTENT(IN) :: N_CELLS,N_CELLS_OLD,N_LAYERS, N_LAYER_CELLS(N_LAYERS),N_LAYER_CELLS_OLD(N_LAYERS) -REAL(EB), INTENT(IN) :: SMALLEST_CELL_SIZE(N_LAYERS),STRETCH_FACTOR(N_LAYERS),X_S_OLD(0:N_CELLS_OLD) +REAL(EB), INTENT(IN) :: SMALLEST_CELL_SIZE(N_LAYERS),STRETCH_FACTOR(N_LAYERS),X_S_OLD(0:N_CELLS_OLD),LAYER_THICKNESS(N_LAYERS) REAL(EB), INTENT(OUT) :: X_S(0:N_CELLS) LOGICAL, INTENT(IN) :: REMESH_LAYER(N_LAYERS) INTEGER I, II, NL, IL, I_START -REAL(EB) DX_S +REAL(EB) DX_S,DX_SUM II = 0 IL = 0 X_S(0) = 0._EB I_START = 0 + DO NL=1,N_LAYERS IF (NL > 1) I_START = I_START+N_LAYER_CELLS_OLD(NL-1) - DO I=1,N_LAYER_CELLS(NL) - II = II+1 + DX_SUM = 0._EB + DO I=1,N_LAYER_CELLS(NL)-1 + II = II + 1 IF (REMESH_LAYER(NL)) THEN DX_S = SMALLEST_CELL_SIZE(NL)*STRETCH_FACTOR(NL)**(MIN(I-1,N_LAYER_CELLS(NL)-I)) + DX_SUM = DX_SUM + DX_S ELSE DX_S = X_S_OLD(I_START+I) - X_S_OLD(I_START+I-1) + DX_SUM = DX_SUM + DX_S ENDIF X_S(II) = X_S(II-1) + DX_S ENDDO + II = II + 1 + X_S(II) = X_S(II-1) + LAYER_THICKNESS(NL) - DX_SUM IL = IL + N_LAYER_CELLS_OLD(NL) ENDDO @@ -2898,11 +2904,9 @@ SUBROUTINE GET_INTERPOLATION_WEIGHTS(GEOMETRY,NWP,NWP_NEW,INNER_RADIUS,X_S,X_S_N I_OLD = 1 INT_WGT = 0._EB THICKNESS = X_S(NWP) - POINT_LOOP: DO I_NEW=1,NWP_NEW XLOW_NEW = X_S_NEW(I_NEW-1) XUP_NEW = X_S_NEW(I_NEW) - OLD_POINT_LOOP: DO XLOW = X_S(I_OLD-1) XUP = X_S(I_OLD) diff --git a/Source/init.f90 b/Source/init.f90 index 90a604929aa..89b5ce300c0 100644 --- a/Source/init.f90 +++ b/Source/init.f90 @@ -1965,7 +1965,7 @@ SUBROUTINE ADJUST_HT3D_ONE_D ALLOCATE(REMESH_LAYER(SF%N_LAYERS)) ; REMESH_LAYER=.TRUE. CALL GET_WALL_NODE_COORDINATES(ONE_D%N_LAYER_CELLS(1),1,SF%N_LAYERS,ONE_D%N_LAYER_CELLS, & N_LAYER_CELLS_OLD,ONE_D%SMALLEST_CELL_SIZE, & - SF%STRETCH_FACTOR,REMESH_LAYER,ONE_D%X,X_S_OLD) + SF%STRETCH_FACTOR,REMESH_LAYER,ONE_D%X,X_S_OLD,ONE_D%LAYER_THICKNESS(1:SF%N_LAYERS)) DEALLOCATE(X_S_OLD) DEALLOCATE(N_LAYER_CELLS_OLD) DEALLOCATE(REMESH_LAYER) diff --git a/Source/read.f90 b/Source/read.f90 index 03e3edbaf70..5457927c18f 100644 --- a/Source/read.f90 +++ b/Source/read.f90 @@ -8836,7 +8836,7 @@ SUBROUTINE PROC_WALL ALLOCATE(X_S_OLD(0:SF%N_CELLS_MAX)); X_S_OLD=0._EB CALL GET_WALL_NODE_COORDINATES(SF%N_CELLS_INI,SF%N_CELLS_MAX+1,SF%N_LAYERS,SF%N_LAYER_CELLS, N_LAYER_CELLS_OLD(1:SF%N_LAYERS), & SF%SMALLEST_CELL_SIZE(1:SF%N_LAYERS),SF%STRETCH_FACTOR(1:SF%N_LAYERS),REMESH_LAYER(1:SF%N_LAYERS),& - SF%X_S,X_S_OLD(0:SF%N_CELLS_MAX)) + SF%X_S,X_S_OLD(0:SF%N_CELLS_MAX),SF%LAYER_THICKNESS(1:SF%N_LAYERS)) DEALLOCATE(X_S_OLD) CALL GET_WALL_NODE_WEIGHTS(SF%N_CELLS_INI,SF%N_LAYERS,SF%N_LAYER_CELLS,SF%LAYER_THICKNESS,SF%GEOMETRY, & diff --git a/Source/wall.f90 b/Source/wall.f90 index 2b51fdb90d5..16823b2ad55 100644 --- a/Source/wall.f90 +++ b/Source/wall.f90 @@ -2394,7 +2394,7 @@ SUBROUTINE SOLID_HEAT_TRANSFER_1D(NM,T,DT_BC,PARTICLE_INDEX,WALL_INDEX,CFACE_IND CALL GET_WALL_NODE_COORDINATES(NWP_NEW,NWP,ONE_D%N_LAYERS,N_LAYER_CELLS_NEW,ONE_D%N_LAYER_CELLS, & ONE_D%SMALLEST_CELL_SIZE(1:ONE_D%N_LAYERS),SF%STRETCH_FACTOR(1:ONE_D%N_LAYERS),REMESH_LAYER(1:ONE_D%N_LAYERS),& - X_S_NEW(0:NWP_NEW),ONE_D%X(0:NWP)) + X_S_NEW(0:NWP_NEW),ONE_D%X(0:NWP),ONE_D%LAYER_THICKNESS(1:ONE_D%N_LAYERS)) CALL GET_WALL_NODE_WEIGHTS(NWP_NEW,ONE_D%N_LAYERS,N_LAYER_CELLS_NEW,ONE_D%LAYER_THICKNESS,SF%GEOMETRY, & X_S_NEW(0:NWP_NEW),LAYER_DIVIDE,DX_S(1:NWP_NEW),RDX_S(0:NWP_NEW+1),RDXN_S(0:NWP_NEW),& DX_WGT_S(0:NWP_NEW),DXF,DXB,LAYER_INDEX(0:NWP_NEW+1),MF_FRAC(1:NWP_NEW),SF%INNER_RADIUS)