Skip to content

Commit

Permalink
Merge pull request #12167 from drjfloyd/master
Browse files Browse the repository at this point in the history
FDS Source: Fix MATL diffusion between 1D layers, Issue #12160
  • Loading branch information
drjfloyd authored Oct 3, 2023
2 parents 3c4fa5b + 603fe64 commit 0193f02
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
20 changes: 13 additions & 7 deletions Source/func.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2698,31 +2698,39 @@ 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(1: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
IF (N_LAYER_CELLS(NL) > 0) THEN
II = II + 1
X_S(II) = X_S(II-1) + LAYER_THICKNESS(NL) - DX_SUM
ENDIF
IL = IL + N_LAYER_CELLS_OLD(NL)
ENDDO

Expand Down Expand Up @@ -2898,11 +2906,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)
Expand Down
2 changes: 1 addition & 1 deletion Source/init.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Source/read.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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, &
Expand Down
2 changes: 1 addition & 1 deletion Source/wall.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0193f02

Please sign in to comment.