Segmentation fault using real.exe with MOZART chemistry.

464 views
Skip to first unread message

Mauro Morichetti

unread,
Oct 8, 2021, 4:18:40 AM10/8/21
to wrf-chem
Hi all,

I am facing a problem when I run real.exe using the chemistry (chem_opt= 112), the code stops after looking for "Subroutine input_chem_profile" with a segmentation fault, while if I do not use chemistry (chem_opt=0) or other chemistry (i.e. chem_opt =300) not related to MOZART gas phase, I have not problem. 

I have read something about, and it seems to be a memory limit problem, but I have already set "limit stacksize unlimited' on my enviroment and, I used the code successfully before (with the same namelist and domain), so I can't understand what is happening.

Someone adviced me to set "chem_in_opt =1", but the model stops since I do not have the "wrf_chem_input_d01" (actually I have nevere used before).

I used the backtrace error, the error seems to be in the "module_input_chem_data.f90", opening it, I I couldn't found a clue.

Attached the namelist and rsl with the backtrace error (rsl.error.0009.txt).

Thanks

Mauro
rsl.error.0000.MM.txt
rsl.error.0009.MM.txt
namelist.MM.txt
rsl.out.0000.MM.txt

Gabriele Pfister

unread,
Oct 8, 2021, 12:21:17 PM10/8/21
to Mauro Morichetti, wrf-chem
Hi Mauro 

I cannot tell you why you get the segmentation fault but took a brief look through your namelist and here are some suggestions: 

auxinput6_interval_h                = 24
You only want the wrfbio file read in at the initial time step. Set to a value that is larger than the length of your simulation period.

diff_6th_opt
Note that the WRF-Chem User Guide suggests this to be set to 0

Please switch to phot_opt=4

Gabi


--
================================
Gabriele Pfister, Deputy Director
Atmospheric Chemistry Observations & Modeling
National Center for Atmospheric Research (NCAR)
Email: pfi...@ucar.edu
Temporary Home Office Phone: +1 303 241 1329
Work Phone: +1 303 497 2915
Web: https://staff.ucar.edu/users/pfister

Mauro Morichetti

unread,
Oct 14, 2021, 10:56:24 AM10/14/21
to wrf-chem, Gabriele Pfister, wrf-chem
Hi all,

Thanks Gabi for your advices, unfortunately I did not resolve the segmentation fault.

Any ideas?

Thanks

Mauro

Rajesh Kumar

unread,
Oct 14, 2021, 11:02:33 AM10/14/21
to morichet...@gmail.com, wrf-chem, Gabriele Pfister
Hi Mauro,

I recommend compiling WRF-Chem in the traceback code. With that, the model generally tells you the line number in a code where the segmentation fault occurred. To do this, you need to activate the traceback option in the configure.wrf file after ./configure command. When you run ./configure, you should see 

FCDEBUG         =      #  -g $(FCNOOPT) -traceback


Just change it to 

FCDEBUG         =        -g $(FCNOOPT) -traceback

and then ./compile em_real. 

Rerun WRF and see if this helps you find the subroutine and line number in the code at which you are getting the error. 

Thanks,
Rajesh
--
Rajesh Kumar, Project Scientist III

Research Applications Laboratory 
National Center for Atmospheric Research 

Rajesh Kumar

unread,
Oct 14, 2021, 11:16:07 AM10/14/21
to Mauro Morichetti, wrf-chem
Hi Mauro,

That's great. It tells you that the error occurs at line 846 of module_input_chem_data.f90 and one of the indices for the "stor" array is 0 which is not allowed in Fortran. I recommend adding some diagnostic printing all the indices of the "stor" array to see which of the indices has a 0 value and then understanding why it is happening. When you add the diagnostic statements, make sure you add them to module_input_chem_data.F because module_input_chem_data.f90 is generated during the compile time and is deleted as soon as you do ./clean -a.

Hope that helps.
Rajesh

On Thu, Oct 14, 2021 at 9:08 AM Mauro Morichetti <morichet...@gmail.com> wrote:
Hi Rajesh,

WRF is compiled with the traceback option.

if you open the rsl.error.0009 of the previous email you can see the backtrace:

STARTING WITH BACKGROUND CHEMISTRY
Subroutine input_chem_profile:
At line 846 of file module_input_chem_data.f90
Fortran runtime error: Index '0' of dimension 4 of array 'stor' below lower bound of 1

Error termination. Backtrace:
#0  0x14af89775131 in ???
#1  0x14af89775cd9 in ???
#2  0x14af897760bb in ???
#3  0x35b5ecb in __module_input_chem_data_MOD_make_chem_profile
	at /hpc/home/join22/WRF-4.1.3/chem/module_input_chem_data.f90:846
#4  0x35c5882 in __module_input_chem_data_MOD_input_chem_profile
	at /hpc/home/join22/WRF-4.1.3/chem/module_input_chem_data.f90:765
#5  0x406eba in med_sidata_input_
	at /hpc/home/join22/WRF-4.1.3/main/real_em.f90:520
#6  0x42bf54 in real_data
	at /hpc/home/join22/WRF-4.1.3/main/real_em.f90:144
#7  0x42c034 in main
	at /hpc/home/join22/WRF-4.1.3/main/real_em.f90:5

I opened the module_input_chem_data, but I cloudnt’t understand why the segmetation happens.

Thanks

———

Ing. Mauro Morichetti
MRCMRA84P20L366Y 
C/da Vanni n. 13 62010, Mogliano (MC) 
+39 388 4729670
morichet...@gmail.com






-- 
To unsubscribe from this topic, visit https://groups.google.com/a/ucar.edu/d/topic/wrf-chem/m9xmwfl_iwY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wrf-chem+u...@ucar.edu.

Mauro Morichetti

unread,
Oct 15, 2021, 12:05:56 PM10/15/21
to wrf-chem, rkumar, Mauro Morichetti
Hi Rajesh,

first thanks for your help.

The problem is that the "is" indice ha 0, as you said, since "iref" is 0.

in the  module_input_chem_data.F:

___________________________________________

 847 !UMM = Update Mauro Morichetti     

 848 !print*,'iref',iref

 849       DO  l=2, numgas

 850          is=iref(l-1)

 851          DO j=ny1,ny2

 852          DO k=nz1,nz2

 853          DO i=nx1,nx2

 854             chem(i,k,j,l)=fracref(l-1)*stor(i,k,j,is) * 1.E6

 855          ENDDO

 856          ENDDO

 857          ENDDO

 858       ENDDO

______________________________________________

I looked trough the code and I found that "ref" is defined and associated to a precise value, for different subroutines  (i.e., setup_gasprofile_map_saprcnov, setup_gasprofile_map_radm_racm...). For the "SUBROUTINE make_chem_profile" it is defined, but it has not a value associated. So I copied the lines 411 to 413 (the iref for SUBROUTINE setup_gasprofile_map_radm_racm)

from:
_________________________________________________

 411   iref(:)    = 7 !default value

 412   iref(1:41) = (/12,19,2,2,1,3,4,9,8,5,5,32,6,6,6,30,30,10,26,13,11,6,6, &

 413                  14,15,15,23,23,32,16,23,31,17,23,23,23,23,23,7,28,29/)

to:
_________________________________________________

 797 !UMM = Update Mauro Morichetti     

 798     iref(:)    = 7 !default value

 799     iref(1:41) = (/12,19,2,2,1,3,4,9,8,5,5,32,6,6,6,30,30,10,26,13,11,6,6, &

 800                  14,15,15,23,23,32,16,23,31,17,23,23,23,23,23,7,28,29/)

_________________________________________________

Now the real.exe (with chemistry) is running, but I would like to understand why it is happing, and if the "iref" value for RADM/RACM it is the same for MOZCART.

Thanks
Reply all
Reply to author
Forward
0 new messages