|
pressure.m.html |
|
|
Source file: pressure.m
|
|
Directory: /Users/rjl/git/rjleveque/clawpack-4.6.3/matlab
|
|
Converted: Mon Jan 21 2013 at 20:16:02
using clawcode2html
|
|
This documentation file will
not reflect any later changes in the source file.
|
function pressure = pressure(data)
%
% Compute the pressure from Euler data in N dimensions
% assumes data contains density in first column, energy in last column,
% and components of momentum in between.
%
% Assumes a gamma-law ideal gas.
% gamma = 1.4 is hardwired here, but you can change this or modify
% to read in the proper value from setprob.data, for example.
%
% This routine can be modified for a different equation of state,
% or if the data doesn't have the required format.
gamma = 1.4;
rho = data(:,1);
energy = data(:,end);
mom = data(:,2:end-1);
mom2 = mom .* mom;
kinetic = 0.5 * sum(mom2,2) ./ rho;
pressure = (gamma-1) * (energy - kinetic);