31
The rules for coding adjoint and the application of 3D variational method to radar data analysis Jidong Gao [email protected] November 2006 Center for Analysis and Prediction of Storms University of Oklahoma Lecture Two

The rules for coding adjoint and the application of 3D variational method to radar data analysis

Embed Size (px)

DESCRIPTION

Lecture Two. The rules for coding adjoint and the application of 3D variational method to radar data analysis. Jidong Gao [email protected] November 2006 Center for Analysis and Prediction of Storms University of Oklahoma. What is the adjoint? - PowerPoint PPT Presentation

Citation preview

Page 1: The rules for coding adjoint and the application of 3D variational method to radar data analysis

The rules for coding adjoint and the application of 3D variational method to

radar data analysis

Jidong [email protected]

November 2006

Center for Analysis and Prediction of Storms

University of Oklahoma

Lecture Two

Page 2: The rules for coding adjoint and the application of 3D variational method to radar data analysis

What is the adjoint?

• It’s only a mathematical tool to help you to get the gradient of the cost function.

• In Errico (1997) “What is an adjoint model?”, It is said “…the adjoint is used as a tool for efficiently determining the optimal solutions. Without this tool, the (4D) optimization problem (including minimization and maximization) could not be solved in a reasonable time for application to real-time forecasting”. This is a good statement. Then what does it mean exactly?

Page 3: The rules for coding adjoint and the application of 3D variational method to radar data analysis

The adjointThe adjoint• For a 3D cost function defined as

• It’s gradient w.r.t. x is

• It involves the HT operator and associated calculation. This HT is the ‘adjoint’ of H.

• For a problem of small size, one can explicitly express H in a matrix form and perform explicit transpose operation and associated caculations. For a large problem, this is unrealistic and the sparseness of H also makes it unnecessary.

• Here, the ‘adjoint’ coding technique comes to the rescue.

1 11 1( ) ( ) ( ( ) ) ( ( ) )

2 2b T b o T oJ x x B x x H x y R H x y

( ) [ ( ) ]b T obx J x x H x y H

Page 4: The rules for coding adjoint and the application of 3D variational method to radar data analysis

• Mathematical definition of adjoint:

For any linear forward operator: X=LY, the adjoint code will be: Yad=LTX

• A simple example for coding adjoint: forward code: do i = 1, N-1 x(i)=x(i)+a*y(i+1) end do input: xin, yin; output: xout

the adjoint code: do i = 1, N-1 ad_y(i+1)= a*ad_x(i) ad_x(i) = ad_x(i) end do input: ad_xin,; output: ad_xout, ad_yout

.

To verify the correctness of the adjoint code, you can calculate the following two terms:

xin * ad_xout + yin *ad_yout

xout *ad_xin They should be equal.

Page 5: The rules for coding adjoint and the application of 3D variational method to radar data analysis

N=12

1M=6

A problem: Suppose we have M irregular “observations” of a sinusoidal function in y, we’d like to determine values at regular grid points from 1 to N that best represent the function. First guess: pink curve.

1D variational interpolation scheme

x

y

Page 6: The rules for coding adjoint and the application of 3D variational method to radar data analysis

• We can define a cost function, 1 1

( ) ( ) ( ( ) ) ( ( ) )2 2

b T b o T oJ T T T T H T T H T T

Subroutine FCN(N, T, F) ! subroutine calculating the cost functionImplicit noneUse module_const ! Include observational number m=6 Use module_pass ! Use this to pass forcing term forc(m) to gradient sub.!!!! and observation value Tob(6), and its location y(6).integer::N, i, j; real::T(N), J, temp ! T is the state vector defined as location vector xJ = 0.0 do i=1,n J = J+0.5*(T(i)-Tb(i))**2enddodo j=1, m i = max(1, min(n, int (y(j)/dx)+1) ) temp=T(i)*(x(i+1)-y(j))/dx+T(i+1)*(y(j)-x(i))/dx forc(j)= temp-Tob(j) J = J+0.5*forc(j) **2end doreturn end

Page 7: The rules for coding adjoint and the application of 3D variational method to radar data analysis

Calculation of cost function Calculation of cost function gradidentgradident

• How to calculate the gradient? Its not straightforward, because of the reasons stated

earlier, and because the cost function for obs. is the summation of innovation vector in obs. points, not in grid points. But when we do the minimization, it is the gradients of cost function with respect to the analysis variables at the grid points that are required. We can use the adjoint technique to solve this problem. The formulation for the gradient is,

The second term on rhs transfers the gradient of the cost function from the obs points to the grid points. It can be coded using the adjoint technique. “Recipes for Adjoint Construction” by Giering and Kaminski 1998) offers a good tutorial. Linked to at the class web site.

( ) [ ( ) ]b T obx J x x H x y H

Page 8: The rules for coding adjoint and the application of 3D variational method to radar data analysis

• Subroutine GRAD(N, t, G) Implicit none• Use module_const ! Include observational number m=6• Use module_pass ! Use this to pass forc(6) from sub FCN • !!!! and observation value Tob(6), and its location y(6).• integer::N, i, j; real::T(N), J, temp G(:) = 0.0• do j=1, m• i = max(1, min(n, int (y(j)/dx)+1) )• G(i) = G(i) + 0.5*forc(j)*(x(j+1)-y(j))/dx• G(i+1)=G(i+1)+0.5*forc(j)*(y(j)-x(j))/dx• end do

do i=1,N G(i)=G(i)+0.5*(T(i)-Tb(i)) end do

• return; end

Page 9: The rules for coding adjoint and the application of 3D variational method to radar data analysis

storm-scale phenomenonstorm-scale phenomenon

By storm-scale, we By storm-scale, we mean structures like mean structures like thesethese

We will need to predict We will need to predict the structure and the structure and evolution of individual evolution of individual cellscells

Spatial scale ~ few kmSpatial scale ~ few km

Time scale ~ tens of Time scale ~ tens of minsmins

For storms, radar is about the only obs platform!

Page 10: The rules for coding adjoint and the application of 3D variational method to radar data analysis

Radar Data AssimilationRadar Data Assimilation

Radial Vr

The Radar Problem:

Observe radial velocity and

reflectivity, other dual-polarization variables. But NWP model, needs V, T, P, qv, qr etc for IC.

v

u

Real wind

cos sinr

x y ux vyV u v u v

r r r

x

y r

Page 11: The rules for coding adjoint and the application of 3D variational method to radar data analysis

NEXRAD Radar provides high spatial and temporal resolution observations

Assimilation of these radar data into storm-resolving models is very important for the future of operational forecasting

Here, I will provide an example using the 3DVAR method to do single-Doppler velocity retrieval

Page 12: The rules for coding adjoint and the application of 3D variational method to radar data analysis

JE, observed tracer constraint (reflectivity),

Jo, radial wind constraint,

JD, 3-D anelastic mass continuity equation,

JB, background field constraint,

JS, smoothness constraints.

We are trying to retrieve 3-D wind vectors from single-Doppler observed reflectivity and radial velocity during a short time period. A cost-function is defined as follows:

J=JB + JO + JE+ JD + JS

Page 13: The rules for coding adjoint and the application of 3D variational method to radar data analysis

background can be obtained from other data source. A nearby sounding is used here.

1) Background field constraint

2 2( ) ( )B W WJ u u v vu vb bijk ijk

2) Jo, measures the difference between the analyzed radial velocity and the observed radial velocity:

1 2( ) ,2O Wr

nJ V Vr robn

Vr is obtained by interpolating retrieved variables u,, v,and w from the grid to observation points, then projecting the winds to the radial direction.

Page 14: The rules for coding adjoint and the application of 3D variational method to radar data analysis

defines relationship of retrieved variables u, v, w and observed tracer in the simplified equation,

3) Observed tracer constraint

1 2J = W (E) ,E E2ijkn

Here u, v, and w are velocities to be retrieved.

2 2 ,

ob ob ob ob

ob ob

E u v wt x y z

k k Fv mH Zh

Page 15: The rules for coding adjoint and the application of 3D variational method to radar data analysis

4) Anelastic mass continuity constraint

JD imposes a weak anelastic mass conservation on the analyzed winds.

2( )D DWu v wJ

x y zijk

5) Smoothness constraint

2 2 2 2 2 2( ) ( ) ( )s

J w u w v w ws u s v s wi j k i j k i j k

The spatial smoothness term is used to remove small-scale noise and improve the quality of analysis.

Page 16: The rules for coding adjoint and the application of 3D variational method to radar data analysis

A single observation experiment, no other constraint

horizontal slice at z=9km

u-v vector, contour of u

Vertical slice at y=42km, w contour

Page 17: The rules for coding adjoint and the application of 3D variational method to radar data analysis

Same as above, adding JD, JE

Vertical slice at y=42km, w contour

horizontal slice at z=9km

u-v vector, contour of u

Page 18: The rules for coding adjoint and the application of 3D variational method to radar data analysis

Analysis of May 17, 1981 Arcadia Analysis of May 17, 1981 Arcadia Storm, with Cimarron RadarStorm, with Cimarron Radar

Z = 500 m

Z = 4.5 km

Z = 9 km

An analysis with the radial velocity obs. only, no bkgd or other constraints. We get the results as expected

Page 19: The rules for coding adjoint and the application of 3D variational method to radar data analysis

Real Radar Data Analysis Cimarron Real Radar Data Analysis Cimarron Radar, cont’dRadar, cont’d

with a with a vertical slice at j = 25

Page 20: The rules for coding adjoint and the application of 3D variational method to radar data analysis

Same as the above, but add JD, JE,

but without JS

Z = 4.5 km

Z = 9.0 kmZ = 500 m

Page 21: The rules for coding adjoint and the application of 3D variational method to radar data analysis

Same as above, but for vertical slice j = 25

Page 22: The rules for coding adjoint and the application of 3D variational method to radar data analysis

with bkgd, but without smoothness

Z = 500 m Z = 4.5 km

J = 25

Page 23: The rules for coding adjoint and the application of 3D variational method to radar data analysis

Wind vector at Z=500m. Shaded is observed reflectivity field.

SDVR-Retrieved

A

B

Norman,OK

Dual-Doppler

B

A

Norman, OK

Cima

OK

16:34 CST, May 17th, 1981, Arcadia, OK storm

Page 24: The rules for coding adjoint and the application of 3D variational method to radar data analysis

Vertical slice through line A-B in the horizontal slice.

SDVR-Retrieved Dual-Doppler

Page 25: The rules for coding adjoint and the application of 3D variational method to radar data analysis

CommentsComments

• Single obs. tests illustrates the behavior of 3DVAR for the analysis of radial wind.

• When applying 3dvar to radar data, smoothness constraints, or background error covariances, or filters must be used to properly spread the influence of data.

• With all constraints used, we can obtain pretty good analysis of storm structure, otherwise we obtain only the radial wind component plus a uniform background field.

Page 26: The rules for coding adjoint and the application of 3D variational method to radar data analysis

Possible future researchPossible future research

– radar data - essential for storm-scale NWP

– available radar data:– radial velocity – reflectivity– quantities from dual-polarization

measurements, such as, differential reflectivity, differential phase shift, etc

– vertical wind profiles– accumulated rainfall

Page 27: The rules for coding adjoint and the application of 3D variational method to radar data analysis

Possible future research (con’d)Possible future research (con’d)

thinning of too dense data consistently with the resolution of the analyses

study of space- and time structure of biases between simulated and observed data for bias correction

Page 28: The rules for coding adjoint and the application of 3D variational method to radar data analysis

Possible future research (con’d)Possible future research (con’d)

– reflectivity is sensitive to cloud properties simulation depends on clouds

representation in model Start from idealized study, to get

simulated reflectivity from model itself

study of existing radar simulation models

Page 29: The rules for coding adjoint and the application of 3D variational method to radar data analysis

Possible future research (con’d)Possible future research (con’d)

– code tangent linear and adjoint of observation operator functional 3DVar minimization check speed and quality

– simulate and assimilate single radar data check how 3DVar corrects atmospheric

fields

Page 30: The rules for coding adjoint and the application of 3D variational method to radar data analysis

Possible future research (con’d)Possible future research (con’d)

– study the impact of reflectivity assimilation to forecast for different situations (front, strong

convection...) for different resolutions (10 km, 2.5

km) check spin up

Page 31: The rules for coding adjoint and the application of 3D variational method to radar data analysis

Thank You for your attention!Thank You for your attention!

Questions? Send email to: [email protected]

or visit Rm 4110