Fix for ARWpost 3.0 segfault

Discussions related to the use of ARWPost

Fix for ARWpost 3.0 segfault

Postby prasht » Tue Feb 15, 2011 1:09 am

Hello,
ARWpost3.0 seems to have problem in reading wrfout files. I tried with CONUS wrfout file when it segfaults with below trace:

$ ./src/ARWpost-nofix.exe

!!!!!!!!!!!!!!!!
ARWpost v3.0
!!!!!!!!!!!!!!!!

FOUND the following input files:
wrfout_d01_2005-06-04_09_00_00

START PROCESSING DATA

Processing time --- 2005-06-04_09:00:00
Found the right date - continue
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
ARWpost-nofix.exe 0000000000430DB7 module_arrays_mp_ 151 module_arrays.f
ARWpost-nofix.exe 00000000004212D4 module_interp_mp_ 746 module_interp.f
ARWpost-nofix.exe 0000000000422B2F module_basic_arra 116 module_basic_arrays.f
ARWpost-nofix.exe 00000000004149EB process_domain_mo 279 process_domain_module.F90
ARWpost-nofix.exe 0000000000413A72 process_domain_mo 153 process_domain_module.F90
ARWpost-nofix.exe 0000000000404B08 MAIN__ 23 ARWpost.f
ARWpost-nofix.exe 000000000040393C Unknown Unknown Unknown
libc.so.6 00007FFFF742F586 Unknown Unknown Unknown
ARWpost-nofix.exe 0000000000403839 Unknown Unknown Unknown

On debugging, it turns out to be that some of WRF variables like P_TOP (for which the code is failing) are processed through “real_array”. Each variable and its memory allocation is mapped to this real_array before further processing [keep_arrays()].

The issue here is P_TOP is *not* an array (it’s a real value)and there was no code to map this onto real_array variable. Attached is the fix for ARWpost to map single dimensional (with any number of arguments) to do that.

Below is the fix for the above issue:

--- module_interp.f90.org 2011-01-20 09:49:38.923193554 +0100
+++ module_interp.f90 2011-01-21 10:45:43.527113900 +0100
@@ -697,6 +697,7 @@ MODULE module_interp
character (len=50) :: cval
integer :: iloc, itype, idm, natt, ii
integer, dimension(4) :: istart, iend
+ real, allocatable, dimension(:) :: tmp1D
real, allocatable, dimension(:,:) :: tmp2D
real, allocatable, dimension(:,:,:) :: tmp3D
integer :: local_time
@@ -735,6 +736,12 @@ MODULE module_interp
CALL NCVGT(ncid,iloc,istart,iend,tmp2D,istatus)
tmp3D(:,:,1) = tmp2D
DEALLOCATE(tmp2D)
+ ELSEIF ((idm == 2) .or. (idm == 1)) THEN
+ ALLOCATE(tmp3D(ncDims(ishape(1)),ncDims(ishape(2)),ncDims(ishape(3))))
+ ALLOCATE(tmp1D(ncDims(ishape(1))))
+ CALL NCVGT(ncid,iloc,istart,iend,tmp1D,istatus)
+ tmp3D(:,1,1) = tmp1D
+ DEALLOCATE(tmp1D)
END IF
IF (istatus /= 0) return


Please let me know if this is fine.

Prashanth
prasht
 
Posts: 1
Joined: Mon Feb 14, 2011 12:55 am

Re: Fix for ARWpost 3.0 segfault

Postby sunxm » Thu Mar 03, 2011 5:46 am

I commented line 152 of src/module_arrays.f90, recompile and everything seems all right:
!! PTOP = real_array(1,1,1)
sunxm
 
Posts: 1
Joined: Thu Mar 03, 2011 5:38 am

Re: Fix for ARWpost 3.0 segfault

Postby gadheebakaran » Thu Apr 19, 2018 11:56 pm

If I commented line 151 (not 152) ARWpost.exe is not created
gadheebakaran
 
Posts: 3
Joined: Wed Aug 03, 2016 2:38 am

Re: Fix for ARWpost 3.0 segfault

Postby gadheebakaran » Fri Apr 27, 2018 8:51 am

Sir
this is not working for me
gadheebakaran
 
Posts: 3
Joined: Wed Aug 03, 2016 2:38 am


Return to ARWPost

Who is online

Users browsing this forum: No registered users and 4 guests