firemodels / fds

Fire Dynamics Simulator
https://pages.nist.gov/fds-smv/
Other
625 stars 610 forks source link

N_LAYER_CELLS_MAX error #13064

Open ericvmueller opened 2 weeks ago

ericvmueller commented 2 weeks ago

Has something changed with the interpretation of N_LAYER_CELLS_MAX?

If I run a case like NIST_MCC_60K.fds, I get

forrtl: severe (408): fort: (2): Subscript #1 of the array X_S has value 1 which is greater than the upper bound of 0

Image              PC                Routine            Line        Source             
fds_ompi_intel_os  0000000112164CD0  Unknown               Unknown  Unknown
fds_ompi_intel_os  00000001074E7CC6  _geometry_functio        2837  func.f90
fds_ompi_intel_os  000000010BDCB204  _read_input_mp_pr        9423  read.f90
fds_ompi_intel_os  000000010BB1081B  _read_input_mp_re         150  read.f90
fds_ompi_intel_os  000000010C0DC73E  _MAIN__                   117  main.f90

and the surface information in the out file doesn't look right

     Layer  1
        Thickness   (m):  0.00010
        Density (kg/m3):  1210.00
        BLACK PMMA, Mass fraction:    1.00
     Total surface density     0.121 kg/m2
     Solid Phase Node, Layer, Coordinates(m):
                    0      0       0.0000000
     Insulated Backing

It looks like the last time this validation case was succesfully run was FDS-6.8.0-1116-gd8b2bf4-master

rmcdermo commented 2 weeks ago

Can you bisect and see where this went south?

ericvmueller commented 2 weeks ago

Sure, can do.

drjfloyd commented 2 weeks ago

CELL_SIZE is -1 since it isn't defined. So we don't set N_CELLS or DX_MIN there. In shrink_loop we don't enter the loop since it become N=1,0. Looks like we need an if block for N_LAYER_CELLS and if it is 1 to return N_CELLS=1 and DX_MIN = LAYER_THICKNESS?

IF (CELL_SIZE>0._EB) THEN N_CELLS = MAX(1,NINT(LAYER_THICKNESS/CELL_SIZE)) DDSUM = REAL(N_CELLS) DX_MIN = LAYER_THICKNESS/DDSUM RETURN ENDIF

SHRINK_LOOP: DO N=1,N_LAYER_CELLS_MAX-1 DDSUM = 0._EB SUM_LOOP: DO I=1,N DDSUM = DDSUM + STRETCH_FACTOR*(MIN(I-1,N-I)) ENDDO SUM_LOOP IF ((LAYER_THICKNESS/DDSUM < CELL_SIZE_FACTORSQRT(DIFFUSIVITY)) .OR. (N==N_LAYER_CELLS_MAX-1)) THEN N_CELLS = N DX_MIN = LAYER_THICKNESS/DDSUM EXIT SHRINK_LOOP ENDIF ENDDO SHRINK_LOOP

drjfloyd commented 2 weeks ago

this is in func.f90 GET_N_LAYER_CELLS

drjfloyd commented 2 weeks ago

If I do this:

IF (N_LAYER_CELLS_MAX==1) THEN N_CELLS = 1 DX_MIN = LAYER_THICKNESS RETURN ENDIF

SHRINK_LOOP: DO N=1,N_LAYER_CELLS_MAX-1 DDSUM = 0._EB SUM_LOOP: DO I=1,N DDSUM = DDSUM + STRETCH_FACTOR*(MIN(I-1,N-I)) ENDDO SUM_LOOP IF ((LAYER_THICKNESS/DDSUM < CELL_SIZE_FACTORSQRT(DIFFUSIVITY)) .OR. (N==N_LAYER_CELLS_MAX-1)) THEN N_CELLS = N DX_MIN = LAYER_THICKNESS/DDSUM EXIT SHRINK_LOOP ENDIF ENDDO SHRINK_LOOP

Then I get the results below compared to 6.8.0. The spike is Kevin upping the minimum layer thickness. If I set it back to the old value it matches 6.8.0

image

I'll push up the change.

ericvmueller commented 2 weeks ago

I landed at 72743bea3543c7b79f61089f124d399d4c205d8a ...but guess I was too slow :) Thanks, Jason!

drjfloyd commented 2 weeks ago

I guessed the error was in that function given the line of read.f90 that gave you the error. TBH not sure how that ever worked before.

rmcdermo commented 2 weeks ago

Jason, should we set MIN_LAYER_THICKNESS for these cases and push up new input files? Who wants the ball?