Git Product home page Git Product logo

Comments (14)

janmandel avatar janmandel commented on August 20, 2024

@tartanrunner25 Derek is using the interpolated wind to drive Massman parameterization #3. The interpolation height is above the canopy, different than the flame height fed into the ROS calculation.

from wrf-sfire.

janmandel avatar janmandel commented on August 20, 2024

From @tartanrunner25

Hi Jan,

Case study path:
Path: /uufs/chpc.utah.edu/common/home/u0703457/lin-group7/dvm/WRF_SFIRE_v34/wrfx-wrf-fire_Vmassman_np/wrf-fire/wrfv2_fire/test/em_rxcadre2

Some notes about the simulation, 3-4 vertical levels we replaced within the canopy (i.e under 22.5m AGL)

the canopy top or CAN_TOP = 22.5 mAGL. This is the level which the winds should be vertically interpolated too. If I recall correctly, 22.5 mAGL falls between WRF vertical levels 3 and 4, on average. The issue is that the interpolated wind at 22.5 mAGL is higher than the winds at vertical levels 3 and 4, despite falling in between them... This is odd since the value should fall somewhere between the wind values at levels 3 and 4.

This issue can been seen in the attached figure for a point within the L2F forest canopy plot (attached screen shot). The red line is the first level above 22.5 mAGL, while the blue line is the first level below 22.5. In a perfect world, the wind at 22.5 mAGL (black line) should fall between these values.
The green line represents the winds at lowest WRF vertical level.

If there is an issue with this code, it would likely be located in code "module_fr_sfire_atm.F" within subroutine: interpolate_wind2can_height

If there is a problem, I suspect the issue would be in lines 2459-2471:

    loop_k: do k=kds,kdmax         ! search for layer k such that ht(k-1)<=wh<ht(k), ht(0)=z0
      
        ! interpolate height from atmospheric cell midpoints
        ht=interpolate_h(its-1,ite+1,kds,kde,jts-1,jts+1,icm,k,jcm,wicm,wjcm,z)
        ! print *,'i=',i,' j=',j,'k=',k,' ht=',ht

        if(.not. ht < wh) exit loop_k ! found layer k this point is in
        ht_last = ht
      enddo loop_k
    
      if(k .gt. kdmax) then
        goto 91  ! run out of vertical levels, this must be wrong
      endif

      kmin=min(k,kmin)
      kmax=max(k,kmax)
      ! found layer k, ht_last < wh <= ht 
      logz0 = log(z0)
      logwh= log(wh)
      loght_last = log(ht_last)
      loght = log(ht)

I guess the first check would be that can_top really equals 22.5 when being fed into this routine.

Anyways, let me know if you have a any questions!

Thanks!

-Derek

image001

from wrf-sfire.

janmandel avatar janmandel commented on August 20, 2024

Reproducing with old wrf-fire
Test case uses 2d744a6
Data copied to /glade/p/univ/ucud0004/jmandel/em_rxcadre2
Build in /glade/work/jmandel/wrf-fire-mpi/wrfv2_fire
Build in /glade/work/jmandel/wrf-fire-serial/wrfv2_fire

from wrf-sfire.

janmandel avatar janmandel commented on August 20, 2024

To load relevant wrfout variables: wrf-fire-matlab/vis3d/wrfatm2struct.m

from wrf-sfire.

janmandel avatar janmandel commented on August 20, 2024

The issue is in Derek's copy of subroutine interpolate_wind2fire_height named interpolate_wind2can_height wrfv2_fire/phys/module_fr_sfire_atm.F#L2459.
Maybe clean up the code first and have one routime only so that the issue needs to be resolved only once.

from wrf-sfire.

janmandel avatar janmandel commented on August 20, 2024
$ diff -wBb  interpolate_wind2fire_height interpolate_wind2can_height
1c1
< subroutine interpolate_wind2fire_height(id,       & ! to identify debugging prints and files if needed
---
> subroutine interpolate_wind2can_height(id,      & ! to identify debugging prints and files if needed
13,14c13,14
<     fz0,fwh,                                      & ! input fire arrays
<     uf,vf)                                          ! output fire arrays
---
>     wz0,can_top,                                  & ! input fire arrays
>     cuf,cvf)                                          ! output fire arrays
33,34c37,39
<     fz0,                                          & ! roughness height
<     fwh                                             ! height to read the wind from
---
>     wz0,                                          & ! WRF roughness height
>     can_top                                         ! height to read the wind from
> 
36,37c41,42
<     uf,                                           & ! atm wind at fire_wind_height, diagnostics
<     vf                                              ! 
---
>     cuf,                                           & ! atm wind at canopy top height, diagnostics
>     cvf                                              ! 
46a52,57
> 
>     !This script is nearly identical to the subroutine 'interpolate_wind2fire_height', except 
>     !that it has been repurposed to interpolate winds at the canopy top. A seperate script was
>     !necessary to prevent key variables from being overwritten since this is needed 
>     !for the massman parameterization. DVM 6/26/2019
> 
49c60
<   if(.not. have_wind_log_interpolation) call crash('interpolate_wind2fire_height: wind_log_interpolation must be set up first')
---
>     if(.not. have_wind_log_interpolation) call crash('interpolate_wind2can_height: wind_log_interpolation must be set up first')
97,98c106,107
<        uf(i,j)=0.
<        vf(i,j)=0.
---
>         cuf(i,j)=0.
>         cvf(i,j)=0.
113,115c122,123
<       z0 = fz0(i,j)                    ! roughness length 
<       wh = fwh(i,j)                    ! wind height
< 
---
>         z0 = wz0(i,j)                    ! roughness length 
>         wh = can_top(i,j)                ! wind height
168a179,188
>           !If wind height = 0, we are not dealing with a fuel type with trees
>           !so just set the canopy height winds cuf and cvf as 0.
> 
>           if(wh == 0) then 
>             cuf(i,j) = 0.
>             cvf(i,j) = 0.
>             cycle
>           end if 
>         
> 
170,171c190,191
<       uf(i,j)= uk1 + (uk - uk1) * ( logwh - loght_last) / (loght - loght_last)
<       vf(i,j)= vk1 + (vk - vk1) * ( logwh - loght_last) / (loght - loght_last)
---
>           cuf(i,j)= uk1 + (uk - uk1) * ( logwh - loght_last) / (loght - loght_last)
>           cvf(i,j)= vk1 + (vk - vk1) * ( logwh - loght_last) / (loght - loght_last)
177,179c197,198
<       uf(i,j) = 0.
<       vf(i,j) = 0.
< 
---
>           cuf(i,j) = 0.
>           cvf(i,j) = 0.
185c204
<   ! print *,'interpolate_wind2fire_height complete, id=',id
---
>     ! print *,'interpolate_wind2can_height complete, id=',id
194c213
<   91 call crash('interpolate_wind2fire_height: fire wind height too large, increase kdmax or atm height')
---
>     91 call crash('interpolate_wind2can_height: canopy wind height too large, increase kdmax or atm height')
197c216
<   write(msg,*)'fz0(',i,j,')=',fz0(i,j),'fwh(',i,j,')=',fwh(i,j)
---
>     write(msg,*)'wz0(',i,j,')=',wz0(i,j),'can_top(',i,j,')=',can_top(i,j)
200c219
<   call crash('interpolate_wind2fire_height: must have fire wind height > roughness height > 0')
---
>     call crash('interpolate_wind2can_height: must have canopy wind height > roughness height > 0')
260c279
< end subroutine interpolate_wind2fire_height
---
> end subroutine interpolate_wind2can_height
$

from wrf-sfire.

janmandel avatar janmandel commented on August 20, 2024

The only change of substance from interpolate_wind2fire_height to interpolate_wind2can_height is [the code(https://github.com/openwfm/wrf-fire/blame/2d744a6021ca799d812c9df1ac46c34ed46fbeea/wrfv2_fire/phys/module_fr_sfire_atm.F#L2510)

+           if(wh == 0) then 
+             cuf(i,j) = 0.
+             cvf(i,j) = 0.
+             cycle
+           end if 

the rest is just renaming variables, prints, and white space. The added code has no effect because it is inside if( wh > z0 .and. z0 > 0)then so always wh > 0.

from wrf-sfire.

janmandel avatar janmandel commented on August 20, 2024

85247c7 calling interpolate_wind2fire_height instead of interpolate_wind2can_height, verified no difference in UF VF. In /glade/u/home/jmandel/p:

p0=nc2struct('em_rxcadre2_orig/wrfout_d05_2012-11-11_12:00:00',{'UF','VF','U','V'},{}) 
p2=nc2struct('em_rxcadre2_devel/wrfout_d05_2012-11-11_12:00:00',{'UF','VF','U','V'},{})
t=1:139; big(p0.uf(:,:,t)-p2.uf(:,:,t))
t=1:139; big(p0.vf(:,:,t)-p2.vf(:,:,t))
!strings em_rxcadre2_orig/wrf.exe | grep commit
commit 2d744a6021ca799d812c9df1ac46c34ed46fbeea
!strings em_rxcadre2_devel/wrf.exe | grep commit
commit 85247c7f42f325e9cecd515bf23a1e57c7ea2960

747dbfd rm subroutine interpolate_wind2can_height

from wrf-sfire.

janmandel avatar janmandel commented on August 20, 2024

Reproduced the problem by wrf-fire-matlab/debug/goprof.m
interpolating WRF wind averaged to cell centers, and the fire mesh wind produced by interpolate_wind2fire_height , to the same longitude/latitude:

long =
  -86.7300
lat =
   30.5300
names =
  1×6 cell array
    {'layer1'}    {'layer2'}    {'layer3'}    {'layer4'}    {'can_top'}    {'fwh'}
h =
    2.6581    7.9751   15.9533   26.5871   22.5000    0.6070
u =
   -3.2616   -4.2591   -5.0076   -5.5361   -3.9965   -0.5363
v =
   -0.0288   -0.0118    0.0246    0.0922   -0.0101   -0.0014

Wind at 22.5m should be between the values at 15.9533 and 26.5871 but it is not.

from wrf-sfire.

janmandel avatar janmandel commented on August 20, 2024

Setting in namelist.input fire_wind_log_interp = 4 and in namelist.fire fire_wind_height = 22.5, windrf = 13*1.0, 1e-7, which selects subroutine interpolate_atm2fire instead of subroutine interpolate_wind2fire_height gives the expected

long =
  -86.7300
lat =
   30.5300
names =
  1x7 cell array
    {'layer1'}    {'layer2'}    {'layer3'}    {'layer4'}    {'can_top'}    {'uf/vf'}    {'uah/vah'}
h =
    2.6644    7.9955   16.0002   26.6716         0         0
u =
   -2.7812   -3.5387   -4.0993   -4.4913         0   -4.3654   -4.3611
v =
    0.5209    0.6878    0.8315    0.9593         0    0.9152    0.9153

using goprof.m from openwfm/wrf-fire-matlab@73ea706

from wrf-sfire.

janmandel avatar janmandel commented on August 20, 2024

Fixed a bug in computing the height above ground of higher WRF layers for wind log interpolation 98b5f6e.

Now:

names =
  1x7 cell array
    {'layer1'}    {'layer2'}    {'layer3'}    {'layer4'}    {'can_top'}    {'uf/vf'}    {'uah/vah'}
h =
    2.6670    8.0030   16.0129   26.6889   22.5000    0.6070
u =
   -2.8603   -3.4974   -3.9268   -4.2753   -4.1607   -0.5583         0
v =
    0.6379    0.7948    0.9083    1.0015    0.9734    0.1306         0

using wrf-fire-matlab/debug/goprof.m

from wrf-sfire.

janmandel avatar janmandel commented on August 20, 2024

Cherry-pick merged as 0678af2

from wrf-sfire.

janmandel avatar janmandel commented on August 20, 2024

fixed indexing typo in phys/module_fr_sfire_atm.F/interpolate_wind2fire_height/interpolate_h
b91f4a5

from wrf-sfire.

janmandel avatar janmandel commented on August 20, 2024

Check if the increased halos from a70bf7c are really needed and reduce them if not. Closing and moving to new issue #25.

from wrf-sfire.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.