GITMCode / GITM

The Global Ionosphere/Thermosphere Model
Apache License 2.0
9 stars 9 forks source link

[BUG]: GITM does not run with -debug flag #11

Closed abukowski21 closed 1 month ago

abukowski21 commented 2 months ago

Describe the bug GITM raises errors when compiled with -debug flag. This would be a fantastic option to aid in development.

To Reproduce Steps to reproduce the behavior:

  1. cd GITM
  2. Enable debug flags: ./Config.pl -install -earth -compiler=gfortran10 -debug
  3. Compile & enter default run/ directory: make && make rundir && cd run
  4. Run: mpirun -np 4 ./GITM.exe

Expected behavior Not crashing. When adding new features or fixing other problems, the stacktrace of errors would be useful. However, GITM cannot pass the first timestep.

Screenshots

 > Reading Inputs
 ----------------------------------------------
 GITM now allows you to use AE to set the HP
 just put a T after the two SME_INDICES files
 or put a F if you don't.
 ----------------------------------------------
 > init_grid
 > init_msis
 > init_iri
 > init_b0

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Backtrace for this error:

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Backtrace for this error:

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Backtrace for this error:

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Backtrace for this error:
#0  0x7f90c9e41960 in ???
#1  0x7f90c9e40ac5 in ???
#0  0x7f527e2bb960 in ???
#1  0x7f527e2baac5 in ???
#0  0x7fba79a9f960 in ???
#1  0x7fba79a9eac5 in ???
#0  0x7f5e3ea14960 in ???
#1  0x7f5e3ea13ac5 in ???
#2  0x7f5e3e60651f in ???
        at ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
#2  0x7fba7969151f in ???
        at ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
#3  0x55aebd4b4586 in calc_conduction_1d_
        at /home/aaron/Documents/GITM/src/calc_conduction.f90:187
#2  0x7f90c9a3351f in ???
        at ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
#3  0x56395d954586 in calc_conduction_1d_
        at /home/aaron/Documents/GITM/src/calc_conduction.f90:187
#3  0x55b4bc9cf586 in calc_conduction_1d_
        at /home/aaron/Documents/GITM/src/calc_conduction.f90:187
#4  0x55aebd563622 in calc_viscosity_
        at /home/aaron/Documents/GITM/src/calc_viscosity.f90:70
#5  0x55aebd5918eb in initialize_gitm_
        at /home/aaron/Documents/GITM/src/initialize.f90:450
#6  0x55aebd46a862 in gitm
        at /home/aaron/Documents/GITM/src/main.f90:44
#7  0x55aebd46a862 in main
        at /home/aaron/Documents/GITM/src/main.f90:17
#4  0x55b4bca7e622 in calc_viscosity_
        at /home/aaron/Documents/GITM/src/calc_viscosity.f90:70
#4  0x56395da03622 in calc_viscosity_
        at /home/aaron/Documents/GITM/src/calc_viscosity.f90:70
#5  0x56395da318eb in initialize_gitm_
        at /home/aaron/Documents/GITM/src/initialize.f90:450
#6  0x56395d90a862 in gitm
        at /home/aaron/Documents/GITM/src/main.f90:44
#7  0x56395d90a862 in main
        at /home/aaron/Documents/GITM/src/main.f90:17
#5  0x55b4bcaac8eb in initialize_gitm_
        at /home/aaron/Documents/GITM/src/initialize.f90:450
#6  0x55b4bc985862 in gitm
        at /home/aaron/Documents/GITM/src/main.f90:44
#7  0x55b4bc985862 in main
        at /home/aaron/Documents/GITM/src/main.f90:17
#2  0x7f527dead51f in ???
        at ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
#3  0x55bba3206586 in calc_conduction_1d_
        at /home/aaron/Documents/GITM/src/calc_conduction.f90:187
#4  0x55bba32b5622 in calc_viscosity_
        at /home/aaron/Documents/GITM/src/calc_viscosity.f90:70
#5  0x55bba32e38eb in initialize_gitm_
        at /home/aaron/Documents/GITM/src/initialize.f90:450
#6  0x55bba31bc862 in gitm
        at /home/aaron/Documents/GITM/src/main.f90:44
#7  0x55bba31bc862 in main
        at /home/aaron/Documents/GITM/src/main.f90:17

Desktop (please complete the following information):

abukowski21 commented 2 months ago

Might have been fixed with commit dc8ab1d

Need to test other compilers

abukowski21 commented 1 month ago

All tests pass with #16 . Closing issue. Have updated script we can use if we want to test with -debug in the future.

abukowski21 commented 1 month ago

Reopening. Found a new error in src/Aurora.Earth.f90 where, when avepower is zero, things break with -debug.

I'll fix this when the Aurora code is refactored...

Easy fix is adding if (avepower == 0) avepower = 1 before ratio=Hpi/avepower (line 187/188), but there probably needs to be an investigation on why there is no avepower when running within SWMF.

abukowski21 commented 1 month ago

Haven't been able to break this. closing.