Skip to content

Commit

Permalink
Merge pull request firemodels#13759 from marcosvanella/master
Browse files Browse the repository at this point in the history
FDS Source : Avoid unnecessary Poisson solver setups at startup.
  • Loading branch information
marcosvanella authored Nov 14, 2024
2 parents e9f7ccd + ec84e98 commit b87915f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 30 deletions.
4 changes: 2 additions & 2 deletions Source/dump.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8206,7 +8206,7 @@ REAL(EB) RECURSIVE FUNCTION GAS_PHASE_OUTPUT(T,DT,NM,II,JJ,KK,IND,IND2,Y_INDEX,Z

CASE(253) ! ZONE PRESSURE SOLVER TYPE
GAS_PHASE_OUTPUT_RES = REAL(PRES_FLAG,EB)
IF (PRES_FLAG==ULMAT_FLAG) THEN
IF (PRES_FLAG==ULMAT_FLAG .AND. ALLOCATED(MESHES(NM)%ZONE_MESH)) THEN
IF (ZONE_MESH(ZONE_MESH(PRESSURE_ZONE(II,JJ,KK))%CONNECTED_ZONE_PARENT)%USE_FFT) THEN
GAS_PHASE_OUTPUT_RES = REAL(FFT_FLAG,EB)
ELSE
Expand All @@ -8217,7 +8217,7 @@ REAL(EB) RECURSIVE FUNCTION GAS_PHASE_OUTPUT(T,DT,NM,II,JJ,KK,IND,IND2,Y_INDEX,Z

CASE(254) ! PRESSURE ZONE PARENT
GAS_PHASE_OUTPUT_RES = 0._EB
IF (PRES_FLAG==ULMAT_FLAG) THEN
IF (PRES_FLAG==ULMAT_FLAG .AND. ALLOCATED(MESHES(NM)%ZONE_MESH)) THEN
GAS_PHASE_OUTPUT_RES = REAL(ZONE_MESH(PRESSURE_ZONE(II,JJ,KK))%CONNECTED_ZONE_PARENT,EB)
ENDIF

Expand Down
39 changes: 11 additions & 28 deletions Source/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -282,28 +282,6 @@ PROGRAM FDS
CALL STOP_CHECK(1)
ENDIF

! Poisson solver initialization

SELECT CASE(PRES_FLAG)
CASE(FFT_FLAG)
! All solvers require INITIALIZE_POISSON_SOLVER in INITIALIZE_MESH_VARIABLES_2
CASE(GLMAT_FLAG,UGLMAT_FLAG)
CALL GLMAT_SOLVER_SETUP(1)
CALL STOP_CHECK(1)
CALL MESH_EXCHANGE(3) ! Exchange guard cell info for CCVAR(I,J,K,CGSC) -> HS.
CALL GLMAT_SOLVER_SETUP(2)
CALL MESH_EXCHANGE(3) ! Exchange guard cell info for CCVAR(I,J,K,UNKH) -> HS.
CALL GLMAT_SOLVER_SETUP(3)
CALL STOP_CHECK(1)
CASE(ULMAT_FLAG)
DO NM=LOWER_MESH_INDEX,UPPER_MESH_INDEX
CALL ULMAT_SOLVER_SETUP(NM)
ENDDO
CALL STOP_CHECK(1)
END SELECT

IF (MY_RANK==0 .AND. VERBOSE) CALL VERBOSE_PRINTOUT('Completed Poisson initialization')

! Initialize the flow field with random noise to eliminate false symmetries

DO NM=LOWER_MESH_INDEX,UPPER_MESH_INDEX
Expand Down Expand Up @@ -524,7 +502,9 @@ PROGRAM FDS

IF (HVAC_SOLVE .AND. N_ZONE>0 .AND. .NOT.SOLID_PHASE_ONLY) CALL EXCHANGE_DIVERGENCE_INFO

CALL GLOBAL_MATRIX_REASSIGN
CALL GLOBAL_MATRIX_REASSIGN(FORCE_REASSIGN=.TRUE.)

IF (MY_RANK==0 .AND. VERBOSE) CALL VERBOSE_PRINTOUT('Completed Poisson initialization')

! Write out character strings to .smv file

Expand Down Expand Up @@ -889,7 +869,7 @@ PROGRAM FDS

! Update global pressure matrices after zone connections

CALL GLOBAL_MATRIX_REASSIGN
CALL GLOBAL_MATRIX_REASSIGN(FORCE_REASSIGN=.FALSE.)

! Exchange mass loss information for OBSTs abutting interpolated boundaries

Expand Down Expand Up @@ -1613,17 +1593,20 @@ END SUBROUTINE CREATE_OR_REMOVE_OBSTRUCTIONS
!> CREATE_OR_REMOVE_OBSTRUCTIONS or CONNECTED_ZONES has been updated. Zone connections are established
!> in DIVERGENCE_PART_1, so global reassignment must follow.

SUBROUTINE GLOBAL_MATRIX_REASSIGN
SUBROUTINE GLOBAL_MATRIX_REASSIGN(FORCE_REASSIGN)

LOGICAL, INTENT(IN) :: FORCE_REASSIGN

IF (OBST_CREATED_OR_REMOVED .OR. ICYC==1) THEN
IF (OBST_CREATED_OR_REMOVED .OR. FORCE_REASSIGN) THEN
SELECT CASE (PRES_FLAG)
CASE (ULMAT_FLAG)
DO NM=LOWER_MESH_INDEX,UPPER_MESH_INDEX
CALL FINISH_ULMAT_SOLVER(NM)
IF(ALLOCATED(MESHES(NM)%ZONE_MESH)) CALL FINISH_ULMAT_SOLVER(NM)
CALL ULMAT_SOLVER_SETUP(NM)
ENDDO
CALL STOP_CHECK(1)
CASE (UGLMAT_FLAG,GLMAT_FLAG)
CALL FINISH_GLMAT_SOLVER
IF(ALLOCATED(ZONE_SOLVE)) CALL FINISH_GLMAT_SOLVER
CALL GLMAT_SOLVER_SETUP(1)
CALL STOP_CHECK(1)
CALL MESH_EXCHANGE(3) ! Exchange guard cell info for CCVAR(I,J,K,CGSC) -> HS.
Expand Down

0 comments on commit b87915f

Please sign in to comment.