module NumRu::GPhys::EP_Flux in ep_flux.

Testprogram

Test script path is 'test/test_ep_flux.rb' in expand dir of gphys.tar.gz.

Index

module NumRu::GPhys::EP_Flux

Module functions of EP_Flux Operater for GPhys.

Functions:

ep_full_sphere(gp_u, gp_v, gp_w_or_omega, gp_temp_or_theta, flag_temp_or_theta, xyzdims=[0,1,2])

Calculate Eliassen-Palm Flux(EP-Flux) from full set equations on the spherical coordinate. this method calculates EP-Flux from 4 GPhys objects, zonal-wind velocity(U), merdional-wind velocity(V), vertical-wind velocity(W) or pressure velocity(Omega), and temperature(T) or potential(Theta) temperature. check the equations on documents.

Furthermore, Residual mean merdional circulation (0, v*, w*) can be calculated.

ARGUMENTS

RETURN VALUE

div_sphere(gp_y, gp_z)

Calculate divergence on the spherical coordinate. it is exclusive to in merdional cross section.

ARGUMENTS

RETURN VALUE

set_deriv_method( method_name )

Set derivative method. methods are defined in GPhys::derivative. Now cderiv and threepoint_O2nd_deriv supported

ARGUMENTS

RETURN VALUE

deriv( *args )

Call derivative method defined in GPhys::Derivative refer to @@deriv_method.

ARGUMENTS

RETURN VALUE

scale_height

return a value of the scale height on the log-pressure coordinate. default value is "7000 m".

RETURN VALUE
* scale height (UNumeric)
scale_height=(h)

set a value of the scale height on the log-pressure coordinate.

RETURN VALUE
* nil
radius

return a value of the radius of the planet. default value is "6.37E6 m".

RETURN VALUE
* radius (UNumeric)
radius=(a)

set a value of the radius of the planet.

RETURN VALUE
* nil
rot_period

return a value of the rotation period of the planet. default value is "8.64E4 s".

RETURN VALUE
* rotation period (UNumeric)
rot_period=(rp)

set a value of the rotation period of the planet.

RETURN VALUE
* nil
g_forces

return a value of the gravitational acceleration on the surface. default value is "9.81 m/s2".

RETURN VALUE
* rotation period (UNumeric)
g_forces=(g)

set a value of the gravitational acceleration on the surface.

RETURN VALUE
* nil
p00

return a value of the reference surface pressure. default value is "1.0E5 Pa".

RETURN VALUE
* reference surface pressure (UNumeric)
p00=(p00)

set a value of the reference surface pressure.

RETURN VALUE
* nil
cp

return a value of the specific heat at constant pressure of the atmosphere. default value is "1004.0[J.K-1.kg-1]"

RETURN VALUE
* reference surface pressure (UNumeric)
cp=(cp)

set a value of the specific heat at constant pressure of the atmosphere.

RETURN VALUE
* nil
gas_const

return a value of the gas constant divided by molecular mass. default value is "287.0[J.K-1.kg-1]".

RETURN VALUE
* reference surface pressure (UNumeric)
gas_const=(r)

set a value of the gas constant divided by molecular mass.

RETURN VALUE
* nil
get_constants

return values of the scale height, radius, rotation period, gravitational acceleration, reference surface pressure, specific heat, gas constant.

RETURN VALUE
* scale height (UNumeric)
* radius (UNumeric)
* rotation period (UNumeric)
* gravitational acceleration (UNumeric)
* reference surface pressure (UNumeric)
* specific heat at constant pressure of the atmosphere (UNumeric)
* gas constant divided by molecular mass (UNumeric)
set_constants(scale_height, radius, rot_period, g_forces, p00, cp, gas_const)

set values of the scale height, radius, rotation period, and gravitational acceleration.

ARGUMENTS
* scale height (UNumeric)
* radius (UNumeric)
* rotation period (UNumeric)
* gravitational acceleration (UNumeric)
* reference surface pressure (UNumeric)
* specific heat at constant pressure of the atmosphere (UNumeric)
* gas constant divided by molecular mass (UNumeric)

RETURN VALUE
* nil
make_gphys(*ax_ary)

make GPhys objects from Axis or VArray. data components is VArray of Axis.pos.

ARGUMENTS

RETURN VALUE

to_w_if_omega(gp, z)

convert to velocity(W) if gp is pressure velocity(Omega). decide from units gp.data.units. if it compatible with "m/s" then deem it W, else if "Pa/s" then deem it Omega.

ARGUMENTS

RETURN VALUE

to_z_if_pressure(gp)

convert to altitude(z) if gp is pressure coordinate (p). decide from units gp.data.units. if it compatible with "Pa" then deem it (p).

ARGUMENTS

RETURN VALUE

to_p_if_altitude(gp)

convert to pressure(p) if gp is altitude(z). decide from units gp.data.units. if it compatible with "m" then deem it (z).

ARGUMENTS

RETURN VALUE

to_theta_if_temperature(gp_t, z, flag_temp_or_theta=true)

convert gp to potential temperature(\theta) if flag_temp_or_theta is true.

ARGUMENTS

RETURN VALUE

to_rad_if_deg(gp)

convert to radian if gp.data.units is degrees.

ARGUMENTS

RETURN VALUE

eddy_products(gp_u, gp_v, gp_w, gp_t, dimname)

calculate eddy products along "dimname" dimension. now in this documents, ' means eddy from zonal mean, and () means zonal mean.

ARGUMENTS

RETURN VALUE

remove_0_at_poles(cos_gp)

set value if the cos(latitude) is nearly equal to 0 (|x|< 1e-6) at poles. at North pole, new value is 2 and at South pole 2

ARGUMENTS
* cos_gp(GPhys): a GPhys which represents latitude.

RETURN VALUE
* new_cos_gp(GPhys): a GPhys which value at poles displaceed.
preparate_for_vector_on_merdional_section(xax, yax)

preparate for GGraph::vector_on_merdional_section in vector_on_merdional_section.

  1. check yax if it is proportional to p
  2. get axis ( a*phi, z )
ARGUMENTS
* xax(VArray): a VArray which represents x axis.
* yax(VArray): a VArray which represents y axis.

RETURN VALUE
* va_aphi(VArray): a VArray which represents x-coordinate(radius * phi).
* va_z(VArray): a VArray which represents z-coordinate.
* was_proportional_to_p(True or False): flag original axis proportional to 
                                        pressure or z.
preparate_for_divergence_on_merdional_section(xax, yax)

preparate for divergence_on_merdional_section.

  1. check yax if it is proportional to p
  2. get axis ( a*sin(phi), z , cos(phi))
ARGUMENTS
* xax(VArray): a VArray which represents x axis.
* yax(VArray): a VArray which represents y axis.

RETURN VALUE
* va_a_sin_phi(VArray): a VArray which represents x-coordinate(radius * sin(phi)).
* va_z(VArray): a VArray which represents z-coordinate.
* va_cos_phi(VArray): a VArray which represents x-coordinate(radius * cos(phi)).
* was_proportional_to_p(True or False): flag original axis proportional to 
                                        pressure or z.
strm_rmean(v_rmean, yzdims=[0,1])

!! CAUTION !! Now this method might show good precision, but we have not enough test and debuged yet. So, there is no gurantee. please use with your responsibility.

Calculate mass stream function for residual zonal mean circulation. Residual zonal mean circulation defined of this module is nondivergent if products a value like a reference density profile (sigma), thus one can define mass stream function Psi.

ARGUMENTS

RETURN VALUE

preparate_for_strm_rmean(gp_data, gp_p, z_dim)

preparate for strm_rmean. its works

  1. expand 2 grid in the top boundary of pressure coordinate.
  2. interpolation with linear extention.
  3. top boundary condition is "p = 0".
ARGUMENTS
* gp_data (GPhys): a GPhys which you wants to expand to.
* gp_p    (GPhys): a GPhys which represents axis you wants expand to.
* z_dim   (Numric): a Numeric which represents dimension of pressure.

RETURN VALUE
* ext_gp_data (GPhys): a GPhys which extend top boundary.

Constants:

Deriv_methods

derivative method name [ 'cderiv', 'threepoint_O2nd_deriv' ]