Add a Physics Scheme into WRF Model

Slides:



Advertisements
Similar presentations
Numeric Types & Ranges. ASCII Integral Type Numerical Inaccuracies Representational error – Round-off error – Caused by coding a real number as a finite.
Advertisements

Universität Hannover Institut für Meteorologie und Klimatologie Zingst PALM-Seminar July 2004 How to work with the user-interface-routine in PALM Contents:
WRF Model: Software Architecture
Tutorial Notes: WRF Software
CPSC 388 – Compiler Design and Construction
1) Scope a] Ada scope rules b] C scope rules 2) Parameter passing a] Ada parameter modes b) Parameter passing mechanisms COMP205 IMPERATIVE LANGUAGES 13.
Chapter 7 Introduction to Procedures. So far, all programs written in such way that all subtasks are integrated in one single large program. There is.
Some Coding Structure in WRF
Subprograms A subprogram allows process abstraction (as opposed to data abstraction). Characteristics –single entry point –caller suspended until control.
Chapter 5: Elementary Data Types Properties of types and objects –Data objects, variables and constants –Data types –Declarations –Type checking –Assignment.
ASC Language 1 Additional ASC Programming Comments NOTE: These are additional notes to be added to “ASC Programming” slides by Michael Scherger. Comparison.
©2004 Brooks/Cole Chapter 8 Arrays. Figures ©2004 Brooks/Cole CS 119: Intro to JavaFall 2005 Sometimes we have lists of data values that all need to be.
Fortran 9x HTML version. New F90 features Free source form Modules User-defined data types and operators Generic user-defined procedures Interface blocks.
27 March, 2000 CS1001 Lecture 16 FUNCTIONS SUBROUTINES SCOPE MODULES EXTERNAL SUBPROGRAMS.
Overview of WRF ARW Thermodynamic Equation
Honors Compilers An Introduction to Algol-68S Jan 24 th 2002.
FORTRAN.  Fortran or FORmula TRANslation was developed in the 1950's by IBM as an alternative to Assembly Language. First successfull high level language.
WRF Model: Software Architecture and Code Structure John Michalakes, NCAR NCAR: W. Skamarock, J. Dudhia, D. Gill, A. Bourgeois, W. Wang, C. Deluca, R.
Fortran: Specification Statements Session Six ICoCSIS.
Introduction to FORTRAN
Guidelines for the CMM coding project 5 October 2006 (or, “How to make your life easier in the long run”)
Mesoscale Modeling Review the tutorial at: –In class.
Summary of Boundary Layer, Microphysics and Cumulus Options Jimy Dudhia NCAR/MMM.
Some WRF Software Architecture and Coding Features to Share Shu-Hua Chen UC Davis WRF: Weather Research and Forecasting model
Initialization for Real Data Cases Dave Gill
Convective Parameterization Options
FORTRAN FORmula TRANslator -Anand Trivedi. HISTORY  Designed and written from scratch in by an IBM team lead by John W. Backus as the first.
Array Cs212: DataStructures Lab 2. Array Group of contiguous memory locations Each memory location has same name Each memory location has same type a.
Physics Implementation Three_level Structure What you might need to do
USE OF ESMF IN THE GEOS-5 MODELING AND ASSIMILATION SYSTEM GEOS-5 ESMF Design Overview THE GEOS-Generic Library 21 JULY 2005.
Defining and Converting Data Copyright Kip Irvine, 2003 Last Update: 11/4/2003.
Slide: 1 Copyright © AdaCore Subprograms Presented by Quentin Ochem university.adacore.com.
Introduction to VB.NET 2005 Dr. McDaniel IDS4704 Spring 2005.
Chapter 4: Subprograms Functions for Problem Solving Mr. Dave Clausen La Cañada High School.
Some Fortran programming tips ATM 562 Fall 2015 Fovell (see also PDF file on class page) 1.
Beginning Fortran Fortran (77) Advanced 29 October 2009 *Black text on white background provided for easy printing.
WRF Version 2: Physics Update Jimy Dudhia NCAR/MMM.
Changing the albedo in CSIM4 Julie Schramm CCSM Software Engineering Group
MCS Introduction Where? Observed reflectivity at 3km from
FORTRAN History. FORTRAN - Interesting Facts n FORTRAN is the oldest Language actively in use today. n FORTRAN is still used for new software development.
Deutscher Wetterdienst COSMO-ICON Physics Current Status and Plans Ulrich Schättler Source Code Administrator COSMO-Model.
Methods Awesomeness!!!. Methods Methods give a name to a section of code Methods give a name to a section of code Methods have a number of important uses.
CHAPTER 2:BASIC FORTRAN Data Types INTEGER REAL COMPLEX CHARACTER LOGICAL.
Update on the 2-moment stratiform cloud microphysics scheme in CAM Hugh Morrison and Andrew Gettelman National Center for Atmospheric Research CCSM Atmospheric.
Test Cases for the WRF Height Coordinate Model
Initialization for Idealized Cases
SEQUENTIAL AND OBJECT ORIENTED PROGRAMMING Arrays.
Test Cases for the WRF Mass Coordinate Model 2D flow over a bell-shaped mountain WRFV1/test/em_hill2d_x 2D squall line (x, z ; y, z) WRFV1/test/em_squall2d_x.
Building Programs from Existing Information Solutions for programs often can be developed from previously solved problems. Data requirements and solution.
Arrays An array is a sequence of objects all of which have the same type. The objects are called the elements of the array and are numbered consecutively.
Unit 2 Technology Systems
Information and Computer Sciences University of Hawaii, Manoa
Names and Attributes Names are a key programming language feature
MIPS Instruction Set Advantages
Virtual temperature AMS glossary: ( virtual temperature—(Also called density.
Status of the COSMO-Software and Documentation
Features in the Quad State Space Model
Chap. 6 Programming the Basic Computer
Bill Scheftic Atmo 558 May 6th 2008
Implementation of a general tracer treatment
Constant: value does not change
Stratiform vs Convective
Documentation and Style
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
mdul-cntns-sub-cmmnts2.f90
Functions continued.
Symbol Table 薛智文 (textbook ch#2.7 and 6.5) 薛智文 96 Spring.
FOR statement a compact notation for a WHILE e.g. sumgrades = 0;
RUN-TIME STORAGE Chuen-Liang Chen Department of Computer Science
Presentation transcript:

Add a Physics Scheme into WRF Model Shu-hua Chen UC Davis/AFWA Physics implementation features Adding a physics scheme

Three Sets of Dimensions Domain size: ids, ide, jds, jde, kds, kde Memory size: ims, ime, jms, jme, kms, kme Tile size: its, ite, jts, jte, kts, kte

Rules for WRF Physics Naming rules

Naming Rules ex, module_cu_kf.F cu is for cumulus module_yy_xxx.F (module) yy = ra is for radiation bl is for PBL cu is for cumulus mp is for microphysics. xxx = individual scheme ex, module_cu_kf.F

Naming Rules ex, RTHBLTEN cu is for cumulus RXXYYTEN (tendencies) XX = variable (th, u, v, qv, qc, … ) YY = ra is for radiation bl is for PBL cu is for cumulus ex, RTHBLTEN

Rules for WRF Physics Naming rules One scheme one module Coding rules (later)

WRF Physics Features • Unified global constatnts (module_model_constants.F) REAL , PARAMETER :: r_d = 287. REAL , PARAMETER :: r_v = 461.6 REAL , PARAMETER :: cp = 7.*r_d/2. REAL , PARAMETER :: cv = cp-r_d .

WRF Physics Features • Unified global constatnts (module_model_constants.F) • Unified common calculations (saturation mixing ratio) • Vertical index (kms is at the bottom)

WRF Language • 4D Moisture field, moist(i,k,j,?) ? = P_QV (water vapor) P_QC (cloud water) P_QI (cloud ice) P_QR (rain) P_QS (snow) P_QG (graupel) (module_state_description.F)

WRF Language • 4D Moisture field, moist(i,k,j,?) • PARAM_FIRST_SCALAR IF ( P_QI .ge. PARAM_FIRST_SCALAR ) (the memory of cloud ice is allocated) . . .

Implement a new physics scheme Prepare your code Create a new module Declare new variables and a new package in Registry Modify namelist Do initialization Modify solve_em.F (solve_eh.F) Modify phy_prep (module_em.F)

Implement a new physics scheme Modify cumulus_driver.F Modify physics_drive.int Modify calculate_phy_ten (module_em.F) Modify phy_cu_ten (module_physics_addtendc.F) Modify Makefile Compile and test

Prepare your code 1.F90 Replace continuation characters in the 6th column with f90 continuation `&‘ at end of previous line Subroutine kessler(QV, T, & its,ite,jts,jte,kts,kte, & ims,ime,jms,jme,kms,kme, & ids,ide,jds,jde,kds,kde) F77 Subroutine kessler(QV, T, . . . & its,ite,jts,jte,kts,kte,& ims,ime,jms,jme,kms,kme,& ids,ide,jds,jde,kds,kde ) F90

Prepare your code 1.F90 Replace continuation characters in the 6th column with f90 continuation `&‘ at end of previous line b)Replace the 1st column `C` for comment with `!` c This is a test F77 ! This is a test F90

Prepare your code 1.F90 2.No common block F77 common/var1/T,q,p, … F90 Subroutine sub(T,q,p, ….) real,intent(out), & dimension(ims:ime,kms:kme,jms:jme):: T,q,p F90

Prepare your code 1.F90 2.No common block 3.Use “ implicit none ” 4.Use “ intent ” Subroutine sub(T,q,p, ….) real,intent(out), & dimension(ims:ime,kms:kme,jms:jme):: T real,intent( in), & dimension(ims:ime,kms:kme,jms:jme):: q real,intent(inout), & dimension(ims:ime,kms:kme,jms:jme):: p

Prepare your code 1.F90 2.No common block 3.Use “ implicit none ” 4.Use “ intent ” 5.Variable dimensions Subroutine sub(glo,….) real,intent(out), & dimension(ims:ime,kms:kme,jms:jme):: glo real,dimension(its:ite,kts:kte,jts:jte):: loc

Prepare your code 1.F90 2.No common block 3.Use “ implicit none ” do j = jts, jte do k = kts, kte do i = its, ite ... enddo 3.Use “ implicit none ” 4.Use “ intent ” 5.Variable dimensions 6.Do loops

Implement a new physics scheme Create a new module ex, module_cu_chen.F (put all your codes in) Go Registry and declare a new package (and new variables) (WRFV1/Registry) package kfscheme cu_physics==1 - - package bmjscheme cu_physics==2 - - package chenscheme cu_physics==3 - -

Implement a new physics scheme Create a new module ex, module_cu_chen.F (put all your codes in) Go Registry and declare a new package (and new variables) (WRFV1/Registry) Cloud microphysics package kesslerscheme mp_physics==1 - moist:qv,qc,qr package linscheme mp_physics==2 - moist:qv,qc,qr,qi,qs,qg package ncepcloud3 mp_physics==3 - moist:qv,qc,qr package ncepcloud5 mp_physics==4 - moist:qv,qc,

Implement a new physics scheme Create a new module ex, module_cu_chen.F (put all your codes in) Go Registry and declare a new package (and new variables) (WRFV1/Registry) Modify namelist.input and assign cu_physics = 3

(module_physics_init.F) (dyn_em) (start_em.F) (phys) (module_physics_init.F) phy_init cu_init * start_domain_em INIT (dyn_em) WRF solve_em …….

phys/module_physics_init.F Pass new variables down to cu_init

(module_physics_init.F) (dyn_em) (start_em.F) (phys) (module_physics_init.F) phy_init cu_init * start_domain_em INIT (dyn_em) WRF solve_em …….

phys/module_physics_init.F Pass new variables down to cu_init Go subroutine cu_init Include the new module and create a new SELECT case

phys/module_physics_init.F Subroutine cu_init(…) . USE module_cu_kf USE module_cu_bmj USE module_cu_chen cps_select: SELECT CASE(config_flags%cu_physics) CASE (KFSCHEME) CALL kfinit(...) CASE (BMJSCHEME) CALL bmjinit(...) CASE DEFAULT END SELECT cps_select Match the package name in Registry CASE (CHENSCHEME) CALL cheninit(...) Put into module_cu_chen.F

. . phy_prep phy_init solve_em INIT DYNAMICS moist_physics_prep … WRF

phy_prep/moist_physics_prep • Calculate required variables • Convert variables from C grid to A grid

. . phy_prep phy_init radiation_driver pbl_driver cumulus_driver … radiation_driver INIT pbl_driver cumulus_driver chencps WRF solve_em . … DYNAMICS . moist_physics_prep microphysics_driver

Three-level structure solve_em Physics_driver SELECT CASE (CHOICE) CASE ( NOPHY ) CASE ( SCHEME1 ) CALL XXX CASE ( SCHEME2 ) CALL YYY . CASE DEFAULT END SELECT Individual physics scheme ( XXX )

cumulus_driver.F Go physics driver (cumulus_driver.F) Include the new module and create a new SELECT CASE in driver Check available variables in drivers (variables are explained inside drivers)

cumulus_driver.F . USE module_cu_kf USE module_bmj_kf Subroutine cumulus_driver . USE module_cu_kf USE module_bmj_kf USE module_cu_chen cps_select: SELECT CASE(config_flags%cu_physics) CASE (KFSCHEME) CALL KFCPS(...) CASE (BMJSCHEME) CALL BMJCPS(...) CASE DEFAULT END SELECT cps_select Match the package name in Registry CASE (CHENSCHEME) CALL CHENCPS(...) Put in module_cu_chen.F

Physics_drive.int SUBROUTINE cumulus_driver(arg1, arg2, … & newvar1, newvar2,… & its,ite,jts,jte,kts,kte, & ims,ime,jms,jme,kms,kme, & ids,ide,jds,jde,kds,kde ) INTEGER, INTENT(IN) :: its,ite,jts,jte,kts,kte, & ids,ide,jds,jde,kds,kde REAL, INTENT(IN) :: arg1, arg2 REAL, INTENT(OUT), DIMENSION(kms:kme) :: & newvar1,newvar2,….

. phy_prep chencps cumulus_driver solve_em calculate_phy_tend Might update_phy_ten phy_cu_ten Might need to call MPP DYNAMICS .

phys/module_physics_addtendc.F Subroutine phy_cu_ten (… ) . CASE(BMJSCHEME) CASE (CHENSCHEME) CALL add_a2a (rt_tendf, RTHCUTEN,… ) CALL add_a2c_u(ru_tendf,RUBLTEN,… ) CALL add_a2c_v(rv_tendf,RVBLTEN,… ) if (P_QS .ge. PARAM_FIRST_SCALAR) & CALL add_a2a(moist_tendf(ims,kms,jms,P_QS),RQSCUTEN, .. & ids,ide, jds, jde, kds, kde, & ims, ime, jms, jme, kms, kme, & its, ite, jts, jte, kts, kte )

module_cu_chen.F MODULE_CU_CHEN CONTRAINS !-------------------------------------------------------------------------- SUBROUTINE cheninit (arg1, arg2, … ) . ENDSUBROUTINE cheninit SUBROUTINE chencps (arg3, arg4, … ) END SUBROUTINE chencps END MODULE_CU_CHEN