NCAR / iCLM4_iHESP

Version of isotope-enabled CLM4 designed to match the iHESP code base.
Other
0 stars 5 forks source link

restart test issue #4

Closed jedwards4b closed 2 years ago

jedwards4b commented 2 years ago

Tests ERS_Ln9.ne120_ne120_mt12.F1850C5.cheyenne_intel.cam-outfrq9s and ERS_Ln9.f19_f19_mg16.F1850C5.cheyenne_intel.cam-outfrq9s are failing due to a difference in a single CLM field: FCANEQ

@erik, @billsacks, @olyson tests listed below, any ideas?

/glade/scratch/jedwards/ERS_Ln9.ne120_ne120_mt12.F1850C5.cheyenne_intel.cam-outfrq9s.20220915_112235_h0u79g
/glade/scratch/jedwards/ERS_Ln9.f19_f19_mg16.F1850C5.cheyenne_intel.cam-outfrq9s.20220915_105214_e1ou39
olyson commented 2 years ago

With regards to the first failed test, it looks like it is failing because of either a fill pattern difference or an RMS for these three fields: BUILDHEAT, HEAT_FROM_AC, WASTEHEAT. FCANEQ seems to be bfb in that test. This might be due to the issue described in the clm4_5_ChangeLog (tag clm4_5_40):

"fix small bug in which the history field output of some of the anthropogenic heat flux variables are not bfb on restart when finidat is blank. I found this when verifying bfb for the original bug fix. The cause of this is initialization which sets non-urban to special value, instead of zero, which is what is desired. On restart, this initialization is not done and the history file set_nourb=0 has precedent."

Changing the initial values of those variables in components/clm/src_clm40/biogeophys/UrbanInitMod.F90 from spval to 0._r8 might fix that. See these lines in /glade/work/oleson/release-cesm2.1.3/components/clm/src_clm40/biogeophys/UrbanInitMod.F90 for how that was fixed:

do c = begc, endc
   l = clandunit(c)
   if (ltype(l) == isturb) then
      eflx_building_heat(c) = 0._r8
      eflx_urban_ac(c) = 0._r8
      eflx_urban_heat(c) = 0._r8
      !
      ! Set hydrology variables for urban to spvalue -- as only valid for pervious road
      !
      if (ctype(c) /= icol_road_perv  )then
         fcov(c)    = spval
         fsat(c)    = spval
         qcharge(c) = spval
      end if
   else
      eflx_building_heat(c) = 0._r8
      eflx_urban_ac(c) = 0._r8
      eflx_urban_heat(c) = 0.0_r8
      t_grnd_u(c) = 0.0_r8
      qflx_runoff_u(c) = 0.0_r8
      eflx_snomelt_u(c) = 0.0_r8
   end if
end do

do p = begp, endp
   l = plandunit(p)
   if (ltype(l) /= isturb) then
      t_ref2m_u(p)     = 0.0_r8
      t_ref2m_min_u(p) = 0.0_r8
      t_ref2m_max_u(p) = 0.0_r8
      rh_ref2m_u(p)     = 0.0_r8
      eflx_wasteheat_pft(p) = 0.0_r8
      eflx_heat_from_ac_pft(p) = 0.0_r8
      eflx_traffic_pft(p) = 0.0_r8
      eflx_anthro(p)    = 0.0_r8
      fsa_u(p)            = 0.0_r8
      eflx_lwrad_net_u(p) = 0.0_r8
      eflx_lh_tot_u(p)    = 0.0_r8
      eflx_sh_tot_u(p)    = 0.0_r8
      eflx_soil_grnd_u(p) = 0.0_r8
   else
      eflx_wasteheat_pft(p)    = 0.0_r8
      eflx_heat_from_ac_pft(p) = 0.0_r8
      eflx_traffic_pft(p)      = 0.0_r8
   end if
end do

As for the second test, I'm not familiar with the isotope-enabled CLM4 unfortunately.

jedwards4b commented 2 years ago

@olyson thanks - I tried this change in /glade/scratch/jedwards/ERS_Ln9.f19_f19_mg16.F1850C5.cheyenne_intel.cam-outfrq9s.20220915_105214_e1ou39, it didn't work.

Also both tests above are failing in the same way and I'm not sure it's related to isotopes.

olyson commented 2 years ago

I was looking at the base.cprnc.out in the first test you listed (the ne120 one): /glade/scratch/jedwards/ERS_Ln9.ne120_ne120_mt12.F1850C5.cheyenne_intel.cam-outfrq9s.20220915_112235_h0u79g/ERS_Ln9.ne120_ne120_mt12.F1850C5.cheyenne_intel.cam-outfrq9s.20220915_112235_h0u79g.clm2.h0.0001-01-01-05400.nc.base.cprnc.out

and it was showing, e.g.,

WARNING: Fill patterns differ between files FILLDIFF BUILDHEAT 61102 777602 (249774, 1) (303161, 1) (308541, 1) (193981, 1) 61102 2.301911182828279E+02 -4.698838766495949E+02 2.3E+02 -4.664530471717032E+02 3.5E+00 -1.754669600936582E-01 238188 1.308348632392083E+02 -3.736798357098070E+02 -2.368839371610408E+02 1.753187741227721E-01 777602 (249774, 1) (297184, 1) avg abs field values: 2.543838032266833E+01 rms diff: 2.3E+01 avg rel diff(npos): 3.5E+00 3.439716294756419E+00 avg decimal digits(ndif): 0.2 worst: -0.3 RMS BUILDHEAT 2.3406E+01 NORMALIZED 1.6210E+00

So, not the right file? I didn't expect it to fix the FCANEQ problem in the second test. FCANEQ was bfb in the first test right?

jedwards4b commented 2 years ago

oh - I'm sorry - I thought both failed with the same error, now I see that was incorrect. Let me try the change in UrbanInitMod.F90 in the ne120 case.

olyson commented 2 years ago

I see that the code changes fixed the problems with those three variables (BUILDHEAT, HEAT_FROM_AC, WASTEHEAT) in your test case, but now eight other urban-only variables were not bfb. Looking at the code, it looks like there are some subtleties in implementing the fix I suggested in your older code. I made some changes to that file accordingly and that test now passes in my clone of your case:

/glade/scratch/oleson/ERS_Ln9.ne120_ne120_mt12.F1850C5.cheyenne_intel.cam-outfrq9s.20220915_112235_h0u79g

The modified code is:

/glade/scratch/oleson/ERS_Ln9.ne120_ne120_mt12.F1850C5.cheyenne_intel.cam-outfrq9s.20220915_112235_h0u79g/SourceMods/src.clm/UrbanInitMod.F90

Maybe you can also verify that it works in your own case.

I also cloned your f19 test case and still get the one RMS associated with FCANEQ. I don't have any ideas at the moment as to why that one difference is occurring.

nusbaume commented 2 years ago

I sadly don't see anything obvious either with regards to FCANEQ, but I can say that I am not aware of any published studies that have used that variable (equilibration fraction in the canopy) in their research. Do you know of any @jiang-zhu?

Basically I would argue that if it's clear this difference in FCANEQ isn't being propagated to other quantities, then I would probably be ok with just excluding it from the regression test and/or just turning it off as a (default) model output.

jiang-zhu commented 2 years ago

@nusbaume I agree. People probably will not look at the FCANEQ. We could turn it off if it makes things easier.

jedwards4b commented 2 years ago

@ekluzek what is the best way to remove this from the default clm history output?

jedwards4b commented 2 years ago

Looking in histFldsMod.F90 I see:

    ! Quantities that only matter for isotopes                                                                                                                                                                          
    if (hydro_isotope) then                                                                                                                                                                                             

      call hist_addfld1d (fname='FCANEQ', units='fraction',  &                                                                                                                                                          
           avgflag='A', long_name='fraction equilibration in canopy', &                                                                                                                                                 
         ptr_pft=pps%fcaneq, set_lake=spval)                                                                                                                                                                            

      call hist_addfld1d (fname='FSOIEQ', units='fraction',  &                                                                                                                                                          
           avgflag='A', long_name='fraction equilibration in top soil layer', &                                                                                                                                         
           ptr_pft=pps%fsoieq, set_lake=spval)                                                                                                                                                                          

    end if                                                                                                                                                                                                              

which gives me some concern that this important for isotopes?

jiang-zhu commented 2 years ago

@jedwards4b Personally, I have never looked at these variables. I know people have looked at soil water isotopes (e.g., SOIL* & H2OSOI*)

ekluzek commented 2 years ago

@jedwards add a default="inactive" argument to the hist_addfld call.