Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE.txt
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
WRF was developed at the National Center for Atmospheric Research (NCAR) which is operated by the University Corporation for Atmospheric Research (UCAR). NCAR and UCAR make no proprietary claims, either statutory or otherwise, to this version and release of WRF and consider WRF to be in the public domain for use by any person or entity for any purpose without any fee or charge. UCAR requests that any WRF user include this notice on any partial or full copies of WRF. WRF is provided on an "AS IS" basis and any warranties, either express or implied, including but not limited to implied warranties of non-infringement, originality, merchantability and fitness for a particular purpose, are disclaimed. In no event shall UCAR be liable for any damages, whatsoever, whether direct, indirect, consequential or special, that arise out of or in connection with the access, use or performance of WRF, including infringement actions.

WRF® is a registered trademark of the University Corporation for Atmospheric Research (UCAR).
WRF® is a registered trademark of the University Corporation for Atmospheric Research (UCAR).
9 changes: 7 additions & 2 deletions Registry/Registry.EM_COMMON
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,9 @@ state real bldtacttime - - - - r "bld
state real cudtacttime - - - - r "cudtacttime" "CUDTACTTIME" "CPS ACTIVATION TIME in s"
state real ltngacttime - - - - r "ltngacttime" "LTNGACTTIME" "LTNG ACTIVATION TIME in s"
state real power ij misc 1 - irh "Power" "Power production" "W"

# THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
state real thrust ij misc 1 - irh "thrust" "Thrust force" "N"
# END LICENSE

# State for derived time quantities.
state integer itimestep - - - - rh "itimestep" "" ""
Expand Down Expand Up @@ -3003,6 +3005,9 @@ state integer nodyn_dummy - dyn_nodyn - - - "" "" ""
rconfig integer windfarm_opt namelist,physics max_domains 0 rh "windfarm_opt" "" ""
rconfig integer windfarm_ij namelist,physics 1 0 rh "windfarm_ij" "" ""
rconfig real windfarm_tke_factor namelist,physics 1 0.25 rh "windfarm_tke_factor" "" ""
# THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
rconfig integer windfarm_induction namelist,physics 1 1 rh "Fitch axial induction correction" "" ""
# END LICENSE
#
# Ideal case selection
rconfig integer ideal_case namelist,ideal 1 0 rh "ideal_case" "" ""
Expand Down Expand Up @@ -3389,7 +3394,7 @@ package wrfhydro wrf_hydro==1 - state:SOLDRAIN

#WRF Windfarm
package no_windfarm windfarm_opt==0 - -
package fitchscheme windfarm_opt==1 - state:power
package fitchscheme windfarm_opt==1 - state:power,thrust
# Yulong add for WLM
package mavscheme windfarm_opt==2 - state:power

Expand Down
21 changes: 21 additions & 0 deletions doc/licenses/fraunhofer_license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 FraunhoferIWES

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions dyn_em/module_first_rk_step_part1.F
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,9 @@ SUBROUTINE first_rk_step_part1 ( grid , config_flags &
& AKHS=grid%akhs ,AKMS=grid%akms &
& ,BL_PBL_PHYSICS=config_flags%bl_pbl_physics &
& ,WINDFARM_OPT=config_flags%windfarm_opt,power=grid%power &
! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
& ,thrust=grid%thrust &
! END LICENSE
& ,windfarm_wake_model=config_flags%windfarm_wake_model & ! Yulong add for WLM
& ,windfarm_overlap_method=config_flags%windfarm_overlap_method & ! Yulong add for WLM
& ,BLDT=grid%bldt, CURR_SECS=curr_secs, ADAPT_STEP_FLAG=adapt_step_flag &
Expand Down
9 changes: 9 additions & 0 deletions phys/module_pbl_driver.F
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ SUBROUTINE pbl_driver( &
,kpbl,mixht,ct,lh,snow,xice &
,znu, znw, mut, p_top &
,ctopo,ctopo2,windfarm_opt,power &
! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
,thrust &
! END LICENSE
,windfarm_wake_model, windfarm_overlap_method &
,ysu_topdown_pblmix &
,shinhong_tke_diag &
Expand Down Expand Up @@ -542,6 +545,9 @@ SUBROUTINE pbl_driver( &
VOCE, &
T2, &
POWER, &
! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
THRUST, &
! END LICENSE
WSPD
REAL, DIMENSION( ims:ime, jms:jme ) , &
INTENT(INOUT) :: HPBL_HOLD
Expand Down Expand Up @@ -2057,6 +2063,9 @@ SUBROUTINE pbl_driver( &
&,QKE=qke &
&,DU=rublten,DV=rvblten &
&,WINDFARM_OPT=windfarm_opt,POWER=power &
! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
&,THRUST=thrust &
! END LICENSE
&,IDS=ids,IDE=ide,JDS=jds,JDE=jde,KDS=kds,KDE=kde &
&,IMS=ims,IME=ime,JMS=jms,JME=jme,KMS=kms,KME=kme &
&,ITS=its,ITE=ite,JTS=jts,JTE=jte,KTS=kts,KTE=kte &
Expand Down
131 changes: 123 additions & 8 deletions phys/module_wind_fitch.F
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ MODULE module_wind_fitch
!
REAL :: turbws(maxvals,maxvals2),turbtc(maxvals,maxvals2),turbpw(maxvals,maxvals2)
REAL :: correction_factor
! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
INTEGER :: induction_correction
! END LICENSE
!
CONTAINS

Expand All @@ -70,6 +73,9 @@ SUBROUTINE dragforce( &
&,dx,dz,dt,qke &
&,du,dv &
&,windfarm_opt,power &
! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
&,thrust &
! END LICENSE
&,ids,ide,jds,jde,kds,kde &
&,ims,ime,jms,jme,kms,kme &
&,its,ite,jts,jte,kts,kte &
Expand All @@ -85,6 +91,9 @@ SUBROUTINE dragforce( &
REAL, DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(IN) :: dz,u,v,z_at_w
REAL, DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: du,dv,qke
REAL, DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: power
! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
REAL, DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: thrust
! END LICENSE
!
! Local
!
Expand All @@ -101,13 +110,23 @@ SUBROUTINE dragforce( &
REAL :: speedhub,speed1,speed2
real :: power1,power2,area,ec
INTEGER :: kbot,ktop,kt

! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
REAL :: a_ind ! axial induction factor
REAL :: thrust1
INTEGER :: ii ! running index
INTEGER, DIMENSION(:), ALLOCATABLE :: idx ! temporary array of indices
INTEGER :: nturb ! number of turbines in grid cell
! END LICENSE

itf=MIN0(ite,ide-1)
jtf=MIN0(jte,jde-1)
ktf=MIN0(kte,kde-1)

wfdensity = 1.0/(dx*dx) ! per turbine, so numerator is 1
power=0.
! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
thrust=0.
! END LICENSE

DO kt = 1,nt
IF ( windfarm_opt .eq. 1 ) THEN
Expand All @@ -118,6 +137,15 @@ SUBROUTINE dragforce( &
k_turbine_top=-1 !top level
i = ival(kt,id)
j = jval(kt,id)

! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
if (induction_correction == 1) then
! BAMS: Number of turbines in current grid cell
idx = PACK([(ii, ii=1,nt)], ival(:,id) == i) ! indices of values equal to i in ival
idx = PACK([(ii, ii=1,SIZE(jval(idx,id)))], jval(idx,id) == j) ! indices of values equal j in jval(idx)
nturb = SIZE(idx) ! number of turbines in grid cell (i,j)
endif
! END LICENSE
!
if (i.ne.-9999.and.j.ne.-9999) then
IF (( its .LE. i .AND. i .LE. itf ) .AND. &
Expand Down Expand Up @@ -168,28 +196,85 @@ SUBROUTINE dragforce( &
zheightl = z2 + 0.5*dz(i,k,j)
ENDIF
ENDDO
!
area = piconst/4.*diameter(kt)**2. ! area swept by turbine blades

! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
IF (induction_correction == 0) THEN ! original Fitch scheme
! END LICENSE
speed1=0.
speed2=0.
a_ind=0.01
if (ktop.eq.1) then
speedhub=sqrt(u(i,1,j)**2.+v(i,1,j)**2.)*hubheight(kt)/z1
speedhub=speedhub/((1-a_ind)**nturb) ! BAMS
else
speed1=sqrt(u(i,kbot,j)**2.+v(i,kbot,j)**2.)
speed2=sqrt(u(i,ktop,j)**2.+v(i,ktop,j)**2.)
speedhub=speed1+((speed2-speed1)/(z2-z1))*(hubheight(kt)-z1)
speedhub=speedhub/((1-a_ind)**nturb) ! BAMS
endif
!
! ... calculate TKE, power and thrust coeffs
!
CALL dragcof(tkecof,powcof,thrcof, &
speedhub,cutin(kt),cutout(kt), &
npower(kt),diameter(kt),stc(kt),stc2(kt),nkind(kt))
npower(kt),diameter(kt),stc(kt),stc2(kt),nkind(kt))


! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
ELSEIF (induction_correction == 1) THEN ! Fitch scheme with induction correction
! ... BAMS: first iteration with induction first estimate
speed1=0.
speed2=0.
a_ind=0.01
if (ktop.eq.1) then
speedhub=sqrt(u(i,1,j)**2.+v(i,1,j)**2.)*hubheight(kt)/z1
speedhub=speedhub/((1-a_ind)**nturb)
else
speed1=sqrt(u(i,kbot,j)**2.+v(i,kbot,j)**2.)
speed2=sqrt(u(i,ktop,j)**2.+v(i,ktop,j)**2.)
speedhub=speed1+((speed2-speed1)/(z2-z1))*(hubheight(kt)-z1)
speedhub=speedhub/((1-a_ind)**nturb)
endif
!
! ... calculate TKE, power and thrust coeffs
!
CALL dragcof(tkecof,powcof,thrcof, &
speedhub,cutin(kt),cutout(kt), &
npower(kt),diameter(kt),stc(kt),stc2(kt),nkind(kt))

! ... BAMS: second iteration
a_ind = 0.5 * (1 - sqrt(1 - thrcof))
a_ind = a_ind * area / ( diameter(kt) * dx * &
MIN(ABS(1/COS(ATAN( ((v(i,ktop,j) + v(i,kbot,j))/2) / ((u(i,ktop,j) + u(i,kbot,j))/2) ))), &
ABS(1/SIN(ATAN( ((v(i,ktop,j) + v(i,kbot,j))/2) / ((u(i,ktop,j) + u(i,kbot,j))/2) )))) ) ! Corrected induction factor

speed1=0.
speed2=0.
if (ktop.eq.1) then
speedhub=sqrt(u(i,1,j)**2.+v(i,1,j)**2.)*hubheight(kt)/z1
speedhub=speedhub/((1-a_ind)**nturb)
else
speed1=sqrt(u(i,kbot,j)**2.+v(i,kbot,j)**2.)
speed2=sqrt(u(i,ktop,j)**2.+v(i,ktop,j)**2.)
speedhub=speed1+((speed2-speed1)/(z2-z1))*(hubheight(kt)-z1)
speedhub=speedhub/((1-a_ind)**nturb)
endif

CALL dragcof(tkecof,powcof,thrcof, &
speedhub,cutin(kt),cutout(kt), &
npower(kt),diameter(kt),stc(kt),stc2(kt),nkind(kt))
ENDIF
! END LICENSE
!
! ... PAJ: Computation of power generated by the wind turbine ...
!
area=piconst/4.*diameter(kt)**2. ! area swept by turbine blades
power1=0.5*1.23*speedhub**3.*area*powcof
power(i,j)=power1+power(i,j)
! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
thrust1=0.5*1.23*speedhub**2.*area*thrcof
thrust(i,j)=thrust1+thrust(i,j)
! END LICENSE
power2=0.
!
DO k=k_turbine_bot,k_turbine_top ! loop over turbine blade levels
Expand All @@ -200,6 +285,11 @@ SUBROUTINE dragforce( &
CALL turbine_area(z1,z2,diameter(kt),wfdensity,tarea)
!
speed=sqrt(u(i,k,j)**2.+v(i,k,j)**2.)
! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
IF (induction_correction == 1) THEN ! original Fitch scheme
speed= speed / ((1-a_ind)**nturb)
ENDIF
! END LICENSE
power2=power2+0.5*powcof*1.23*(speed**3.)*tarea/wfdensity
ENDDO
!
Expand All @@ -214,6 +304,11 @@ SUBROUTINE dragforce( &
CALL turbine_area(z1,z2,diameter(kt),wfdensity,tarea)
!
speed=sqrt(u(i,k,j)**2.+v(i,k,j)**2.)
! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
IF (induction_correction == 1) THEN ! original Fitch scheme
speed= speed / ((1-a_ind)**nturb)
ENDIF
! END LICENSE
!`
! ... PAJ: normalization introduced to conserve energy ...
!
Expand All @@ -225,10 +320,22 @@ SUBROUTINE dragforce( &
!
! output TKE
qke(i,k,j) = qke(i,k,j)+speed**3.*tarea*tkecof*dt/dz(i,k,j)*ec
! output u tendency
du(i,k,j) = du(i,k,j)-.5*u(i,k,j)*thrcof*speed*tarea/dz(i,k,j)*ec
! output v tendency
dv(i,k,j) = dv(i,k,j)-.5*v(i,k,j)*thrcof*speed*tarea/dz(i,k,j)*ec
! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
IF (induction_correction == 0) THEN
! END LICENSE
! output u tendency
du(i,k,j) = du(i,k,j)-.5*u(i,k,j)*thrcof*speed*tarea/dz(i,k,j)*ec
! output v tendency
dv(i,k,j) = dv(i,k,j)-.5*v(i,k,j)*thrcof*speed*tarea/dz(i,k,j)*ec

! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
ELSEIF (induction_correction == 1) THEN
! output u tendency
du(i,k,j) = du(i,k,j)-.5*(u(i,k,j)/((1-a_ind)**nturb))*thrcof*speed*tarea/dz(i,k,j)*ec
! output v tendency
dv(i,k,j) = dv(i,k,j)-.5*(v(i,k,j)/((1-a_ind)**nturb))*thrcof*speed*tarea/dz(i,k,j)*ec
ENDIF
! END LICENSE
ENDDO
ENDIF
ENDIF
Expand Down Expand Up @@ -310,6 +417,11 @@ SUBROUTINE dragcof(tkecof,powcof,thrcof,speed,cispeed,cospeed, &
thrcof = turbtc(nkind,nb)+(turbtc(nkind,nu)-turbtc(nkind,nb))/(turbws(nkind,nu)-turbws(nkind,nb))*(speed-turbws(nkind,nb))
ENDIF
ENDIF
! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
IF (induction_correction == 1) THEN
thrcof = MAX(MIN(thrcof,0.9999),0.0001) ! BAMS
ENDIF
! END LICENSE
!
! ... power coeficient ...
!
Expand Down Expand Up @@ -354,6 +466,9 @@ SUBROUTINE init_module_wind_fitch(id,config_flags,xlong,xlat,windfarm_initialize
!

correction_factor = config_flags%windfarm_tke_factor
! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
induction_correction = config_flags%windfarm_induction
! END LICENSE
IF ( wrf_dm_on_monitor() ) THEN
!
! ... PAJ: Opens the file with the location of the wind turbines ...
Expand Down
3 changes: 3 additions & 0 deletions run/README.namelist
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,9 @@ Options for wind turbine drag parameterization:
! 1 = The coordinate of the turbines are defined in terms of grid points
! 2 = Valid only with windfarm_opt=2. The coordinate of the turbines are defined
in terms of lat-lon with the filename of 'windturbines-ll.txt'
! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
windfarm_induction = 1 ! Use the axial induction correction as described by Vollmer et al (2024). Valid only with 'windfarm_opt=1'. 0: Off, 1: On (default)
! END LICENSE
windfarm_wake_model = 2 ! Subgrid-scale wind turbine wake model, valid only with windfarm_opt=2, default is 2
! 1 = The Jensen model
! 2 = The XA model
Expand Down