pres.f90 Additional optimization with automated check #15617
Replies: 3 comments 4 replies
-
|
Hi @firegoaway, great to see you are diving into the source code. A couple of discussion points:
|
Beta Was this translation helpful? Give feedback.
-
|
Because this conversation is technically not a pull request, I suggest you create an issue and assign Marcos as the owner. That way, the thread will not get lost among the general discussion posts. |
Beta Was this translation helpful? Give feedback.
-
|
@marcosvanella @mcgratta thank you for contacting this thread, gentlemen. We are pleased for having this approach to be questioned. Currently we are continuing to work on verifying this approach and cannot yet say with certainty that ULMAT will be more effective than FFT. That is the main reason why we are not ready to make any PR and list to contribution. You're absolutely right that FFT should theoretically be more efficient for clean meshes. However, in practice with FDS, we've observed that for extremely high aspect ratio meshes (particularly those with cell count ratios > 10:1), the FFT solver can encounter numerical stability issues and performance degradation due to:
The performance crossover point, where ULMAT becomes advantageous, appears to be around aspect ratios of 10:1 or higher in at least one dimension. However, we agree that benchmark cases with aspect ratios of 5:1, 10:1, 20:1, and 50:1 should be performed. A more conservative approach looks like this: ! Test if FFT solver can be used for this MESH
USE_FFT = .TRUE.
IF (M%N_OBST>0) USE_FFT = .FALSE.
IF (FISHPAK_BC(1)/=FISHPAK_BC_PERIODIC .AND. FISHPAK_BC(1)/=FISHPAK_BC_NEUMANN) USE_FFT = .FALSE.
IF (FISHPAK_BC(2)/=FISHPAK_BC_PERIODIC .AND. FISHPAK_BC(2)/=FISHPAK_BC_NEUMANN) USE_FFT = .FALSE.
IF (FISHPAK_BC(3)/=FISHPAK_BC_PERIODIC .AND. FISHPAK_BC(3)/=FISHPAK_BC_NEUMANN) USE_FFT = .FALSE.
! Experimental purpose. For very high aspect ratio meshes, ULMAT may be more robust
IF (USE_FFT .AND. M%IBAR > 0 .AND. M%JBAR > 0 .AND. M%KBAR > 0) THEN
REAL(EB) :: MAX_ASPECT_RATIO
MAX_ASPECT_RATIO = MAX(REAL(M%JBAR*M%KBAR,EB)/REAL(M%IBAR,EB), &
REAL(M%IBAR*M%KBAR,EB)/REAL(M%JBAR,EB), &
REAL(M%IBAR*M%JBAR,EB)/REAL(M%KBAR,EB))
! Use conservative threshold that can be validated through testing
IF (MAX_ASPECT_RATIO > ASPECT_RATIO_THRESHOLD) THEN
USE_FFT = .FALSE.
! Log this decision for debugging
IF (MY_RANK==0) WRITE(LU_ERR,*) 'Note: Using ULMAT solver for high aspect ratio mesh: ', MAX_ASPECT_RATIO
ENDIF
ENDIFTherefore, this change shows itself to be safe for single-threaded computing in particular cases. For example, long tunnel simulations, thin slab geometries or boundary layer-type meshes where extreme grid stretching is used near walls, creating very high effective aspect ratios in localized regions. The verification status for today is under pressure solution convergence check-up and specific cases compatibility. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
pres.f90
Description:
This PR introduces an optimization to automatically select the most efficient pressure solver algorithm based on mesh geometry characteristics. The change enhances performance for meshes with high aspect ratios by preferring the ULMAT solver over FFT in appropriate scenarios.
-*Maintained backward compatibility with existing functionality
Technical Details:
(JBAR * KBAR)/IBAR,(IBAR * KBAR)/JBAR, and(IBAR * JBAR)/KBAR-Automatically switches to ULMAT when any aspect ratio exceeds 10.0
Performance impact:
Testing and verifying:
Beta Was this translation helpful? Give feedback.
All reactions