Demo entry 5962002

code

   

Submitted by f on Sep 10, 2016 at 04:43
Language: Matlab. Code size: 1.8 kB.

function gamma_pi_tau = gamma_pi_tau_region1(p,T)
% Given pressure and temperature in region 1, this function calculates the
% second order hybrid partial derivative of gamma with respect to pi and
% tau. This function supports vectorized input/output.
%
% Input:
% p:     pressure in MPa
% T:     temperature in K
%
% Output:
% gamma_pi_tau:     the derivative
%
% Xu Junshen 2016/09

p_star=16.53;
T_star=1386;
pi = p./p_star;
tau = T_star./T;

DN1 = [0.14632971213167D0,  -0.84548187169114D0,  -0.37563603672040D1,...
    0.33855169168385D1,  -0.95791963387872D0,   0.15772038513228D0,...
    -0.16616417199501D-1,  0.81214629983568D-3,  0.28319080123804D-3,...
    -0.60706301565874D-3, -0.18990068218419D-1, -0.32529748770505D-1,...
    -0.21841717175414D-1, -0.52838357969930D-4, -0.47184321073267D-3,...
    -0.30001780793026D-3,  0.47661393906987D-4, -0.44141845330846D-5,...
    -0.72694996297594D-15,-0.31679644845054D-4, -0.28270797985312D-5,...
    -0.85205128120103D-9, -0.22425281908000D-5, -0.65171222895601D-6,...
    -0.14341729937924D-12,-0.40516996860117D-6, -0.12734301741641D-8,...
    -0.17424871230634D-9, -0.68762131295531D-18, 0.14478307828521D-19,...
    0.26335781662795D-22,-0.11947622640071D-22, 0.18228094581404D-23,...
    -0.93537087292458D-25];
I1 = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2,...
    2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 8, 8, 21, 23, 29, 30, 31, 32];
J1 = [-2, -1, 0, 1, 2, 3, 4, 5, -9, -7, -1, 0, 1, 3, -3,...
    0,1,3,17,-4,0,6,-5,-2,10,-8,-11,-6,-29,-31,-38,-39,-40,-41];

gamma_pi_tau = zeros(size(p));

len = length(DN1);

for ii = 1:len
    gamma_pi_tau = gamma_pi_tau - ...
        DN1(ii)*I1(ii)*J1(ii)*...
        (7.1-pi).^(I1(ii)-1).*(tau - 1.222).^(J1(ii)-1);
end

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).