[Dart-dev] [4675] DART/trunk/models/wrf/matlab/compute_pressure.m: Corrected a bug in a WRF matlab support routine.
nancy at ucar.edu
nancy at ucar.edu
Wed Jan 26 14:29:30 MST 2011
Revision: 4675
Author: thoar
Date: 2011-01-26 14:29:30 -0700 (Wed, 26 Jan 2011)
Log Message:
-----------
Corrected a bug in a WRF matlab support routine.
The formula to compute the pressure was coded incorrectly.
If you are using DART/models/wrf/matlab/compute_pressure.m
you SHOULD update this routine.
Modified Paths:
--------------
DART/trunk/models/wrf/matlab/compute_pressure.m
-------------- next part --------------
Modified: DART/trunk/models/wrf/matlab/compute_pressure.m
===================================================================
--- DART/trunk/models/wrf/matlab/compute_pressure.m 2011-01-26 17:20:36 UTC (rev 4674)
+++ DART/trunk/models/wrf/matlab/compute_pressure.m 2011-01-26 21:29:30 UTC (rev 4675)
@@ -1,4 +1,4 @@
-function pres = compute_pressure( mu, dnw, phi, theta, qv, Rd,Rv,gamma,p0 )
+function pres = compute_pressure( mu, dnw, phi, theta, qv, Rd, Rv, gamma, p0 )
%% FUNCTION pres : Computes pressure from gas law as in WRF.
%
% CS version of Ryan's m-file.
@@ -11,8 +11,8 @@
% mu = (full) dry hydrostatic surf. press (2d)
% dnw = intervals between w levels, at mass pts
% phi = (full) geopotential, at w pts
-% theta = (full) potential temperature, at mass pts
-% qv = water-vapor mixing ratio, at mass pts
+% theta = (full) potential temperature, at mass pts
+% qv = water-vapor mixing ratio, at mass pts
% Rd,Rv,gamma,p0
% = dry and moist gas constants, c_p/c_v, reference pressure
% Output:
@@ -20,7 +20,7 @@
%
% See wrf subroutine calc_p_rho_phi.
-%% DART software - Copyright \xA9 2004 - 2010 UCAR. This open source software is
+%% DART software - Copyright � 2004 - 2010 UCAR. This open source software is
% provided by UCAR, "as is", without charge, subject to all terms of use at
% http://www.image.ucar.edu/DAReS/DART/DART_download
%
@@ -30,8 +30,8 @@
% $Revision$
% $Date$
-phi_eta = phi(2:end,:,:) - phi(1:end-1,:,:) ) ./ repmat( dnw(:), [1 size(mu)];
-alpha = -phi_eta ./ repmat( reshape( mu, [1 size(mu)] ), [ length(dnw) 1 1 ] );
+phi_eta = (phi(2:end,:,:) - phi(1:end-1,:,:)) ./ repmat(dnw(:), [1 size(mu)]);
+alpha = -phi_eta ./ repmat( reshape( mu, [1 size(mu)] ), [ length(dnw) 1 1 ] );
%% Gas law:
-pres = p0 * ( Rd * theta .* (1 + (Rd/Rv)*qv ) ./ ( p0 * alpha ) ).^gamma ;
+pres = p0 * ( Rd * theta .* (1 + (Rv/Rd)*qv ) ./ ( p0 * alpha ) ).^gamma ;
More information about the Dart-dev
mailing list