Opened 18 months ago

Closed 4 months ago

#1905 closed help (answered)

Segmentation fault when adding emissions to vn8.4 release job

Reported by: s1374103 Owned by: um_support
Priority: normal Component: UM Model
Keywords: Cc:
Platform: MONSooN UM Version: 8.4

Description

Hi,

I'm having a problem with UKCA in release job vn8.4 RJ4.0 CheST+GLOMAP-mode (xlsjc). The only differnce between my changes and the release job are to switch to a 365 day calendar and apply nudging.

My goal is to add two new tracers, and two new emissions.

I've added the two tracers and the model runs. I add the first emission and the model runs. I add the second emission and the model compiles but fails to run with a segmentation fault poitning to asad_chem_flux_diags.F90 (the bottom of the routine where it attempts to deallocate).

What I find very strange is that to add my second emission the code changes are identical. Also, the NetCDF file which I am using to create my new emissions are identical.

I wandered if a parameter in UKCA perhaps wasn't being updated, or if there is a maximum value set somewhere so I tried a couple of things.

  1. In ukca_setd1defs, n_use_emissions is defined;

n_use_emissions = n_chem_emissions + n_3d_emissions + ..

I have manually updated n_chem_emissions, so I know this is the right value, however, I changed it to…

n_use_emissions = n_chem_emissions + n_3d_emissions + .. +1

Surprisingly, this allowed the model to run, even though n_use_emissions was the value it should be (with out the '+1'). n_use_emissions is then used in a number of other routines so I then tried…

  1. I went back to using the origincal caluclation of n_use_emissions in ukca_setd1defs.F90..

n_use_emissions = n_chem_emissions + n_3d_emissions + ..

but in each routine which uses n_use_emissions, I redefined it as

n_use_emissions = n_use_emissions + 1

The model failed with the same error message in all but one, ukca_emissions_ctl.F90.

  1. I then used 'n_use_emissions + 1' around each equation/subroutine in ukca_emission_ctl that usees n_use_emissions (one at a time)and found out that in the calculation of molmass (a list of relative molecular mass of emitted species) is the only place that it is needed.
  1. I then looked at where molmass is used, and it is used in asad_chem_flux_diags.F90 (the routine which fails with segmentation fault when this '+1' is not present). SO I thought I was close to the solution. However, molmass is only used in a routine which is not being called.

This confuses me as I'm under the impression that the solution to my problem is to increase the size of molmass, however, it is only in a routine which is not being called.

Job ID: xmtzy

Any help would br greatly appreciated.

Regards,

Jamie

Change History (5)

comment:1 Changed 17 months ago by grenville

Jamie

Is this the same problem you had in ticket 1807?

Grenville

comment:2 Changed 17 months ago by mdalvi

Hi Jamie,

The value of n_3d_emissions in UKCA_SETD1DEFS is actually incorrect - it should be 4 (Vol_SO2, Airc_NOx, OC_biom and BC_biom) instead of 2, so this may be affecting n_use_emissions in addition to your new species. As you have found, n_use_emissions is rarely used while UKCA_EMISSION_CTL and others specifically use n_chem_emissions and n_3d_emissions separately where required.
The above fix was added at vn10.0, but probably omitted from being back-ported to vn8.4 as the Release job was already 'released' by then and the value of n_3d_emissions does not seem to matter (other than above case).

If that does not work, since your branch already contains a lot of changes to the ASAD structure, it might be helpful try just adding the tracer and emissions to a base vn8.4 branch (although the job will also need to be degraded).


Mohit

comment:3 Changed 17 months ago by s1374103

Hi Mohit,

I have changed the value of n_3d_emissions…

          ELSE IF (L_ukca_strattrop .AND. L_ukca_achem) THEN
             n_chem_emissions = 23      ! em_chem_spec below
             n_3d_emissions   = 4       ! volc SO2 & aircraft NOX
             ALLOCATE(em_chem_spec(n_chem_emissions+n_3d_emissions))
             em_chem_spec =                                             &
                 (/'NO        ','CH4       ','CO        ','HCHO      ', &
                   'C2H6      ','C3H8      ','Me2CO     ','MeCHO     ', &
                   'C5H8      ','BC_fossil ','BC_biofuel','OC_fossil ', &
                   'OC_biofuel','Monoterp  ','NVOC      ','tracer_A  ', &
                   'tracer_B  ','SO2_low   ', &
                   'SO2_high  ','DMS       ','NH3       ','SO2_nat   ', &
                   'BC_biomass','OC_biomass','NO_aircrft'/)
             n_aero_tracers = 12
             n_chem_tracers = 73         ! No. chem tracers
             IF (L_ukca_trophet) THEN
               nr_therm     = 241        ! thermal reactions
             ELSE
               nr_therm     = 239        ! thermal reactions
             ENDIF
             nr_phot        = 59         ! photolytic (ATA)

However, I now get an erorr message with regards to D1.

????????????????????????????????????????????????????????????????????????????????
???!!!???!!!???!!!???!!!???!!!???!!! ERROR ???!!!???!!!???!!!???!!!???!!!???!!!?
? Error in routine: UKCA_MAIN
? Error Code:     2
? Error Message: Some item addresses not found in D1 array
? Error generated from processor:     0
? This run generated   7 warnings
????????????????????????????????????????????????????????????????????????????????

I know that this routine has something to do with defining fields for D1, but I'm unsure as to at what point the model is failing. Should I have redefined n_3d_emisisons as 4 somewhere else?

Thanks so much for taking a look into this, I really appreciate it.

Regards,

Jamie

comment:4 Changed 17 months ago by s1374103

Is n_chem_emissions, the number of surface emissions and n_3d_the number of 3D emissions. So in the above exmaple,

n_chem_emissions = 21 (NO to NH3)
n_3d_emissions = 4 (SO2_nat to NO_aircrft)

I tried this and again I got the same error message as above.

Last edited 17 months ago by s1374103 (previous) (diff)

comment:5 Changed 4 months ago by willie

  • Resolution set to answered
  • Status changed from new to closed

Closed due to lack of activity.

Note: See TracTickets for help on using tickets.