How can I calculate Dynamic height and Geostrophic Current?

25 Ansichten (letzte 30 Tage)
Jiuk Hwang
Jiuk Hwang am 27 Jun. 2023
Beantwortet: Ashutosh am 18 Aug. 2023
I want to calculate Dynamic height and Geostrophic Current, with Vertical Profile T, S data in 2 sites.
For example, if i get a Profile like this,
then I want to get the Geostrophic balance like this.
But when I try this things at first, it was so hard that calculate the velocity as each of depth.
So I tried just one Velocity value between two sites as whole scale of depth.
But I got a bad value, that is very low. 0.0076 m/s.
The location of sites are the Drake Passage in Antartica, so the average value is known as over the 1m/s.
But I can't find what's wrong in my code.
So Please help me, masters of MATLAB and Oceanography....
The Below code is my code...
%% Dynamic Height in Antarctic
% Calculate the Dynamic Height and Pressure Gradient with Using the T, S Profiles of 2 Sites
% Site : Antarctic, Drake Strait
%% Site A & Site B
clc; clear; close all;
temp = zeros(2,8);
sal = zeros(2,8);
% depth = zeros(1,8);
temp(1,:)=[ 7 4 3 2.4 2 1.7 1.4 1 ];
sal(1,:) = [ 34.1 34.2 34.4 34.6 34.68 34.72 34.72 34.72 ];
temp(2,:) = [ 6 3 2.6 2.25 1.8 1.4 1.25 0.9 ];
sal(2,:) = [ 34.05 34.2 34.5 34.63 34.7 34.72 34.72 34.717 ];
depth = [ 0 500 1000 1500 2000 2500 3000 3500 ];
% %% Contour Figure (just show, not Calculate)
% figure(1)
% temp2 = [temp(1,:)' temp(2,:)']; sal2 = [sal(1,:)' sal(2,:)'];
% c1 = subplot(121);
% contourf([1,2], depth, temp2, 8); axis ij;
% xticklabels({'A','','B'}); title('Temperature');
% colormap(c1,jet); colorbar;
% c2 = subplot(122);
% contourf([1,2], depth, sal2); axis ij;
% xticklabels({'A','','B'}); title('Salinity');
% load colormap_haline.mat; % loading external colormap.
% colrm = flipud(colrm); colormap(c2,colrm); colorbar;
% clear c1 c2 colrm temp2 sal2 ;
%% Pressure (Dynamic Height) (Calculate Part)
dens = sw_dens(sal, temp, depth); % Density Calculating
Unrecognized function or variable 'sw_dens'.
dens_imsi = zeros(2,length(dens)-1);
k=1;
for i=1:length(dens)-1
dens_imsi(:,k) = (dens(:,k+1)+dens(:,k))/2;
% reduce the size 1, because of Array Match below. (8->7)
k=k+1;
end
deltaP = (1./dens_imsi).*diff(depth); % (diff)
dyn = ((-1)/9.8)*sum(deltaP,2); % (sum)
rho = mean(dens,2);
pres = (-1)*9.8.*rho.*dyn;
disp(['Pressure of Site A : ', num2str(pres(1)), ' (dbar)']);
disp(['Pressure of Site B : ', num2str(pres(2)), ' (dbar)']);
%% Geostrophic Current (Calculate Part)
% Define the necessary constants
Degrees = -60;
theta = Degrees * pi / 180;
f = 2 * 7.2921*10^(-5) * sin(theta); % Coriolis parameter (rad/s)
% Convert pressure values from dbar to Pa
pres_pa = pres * 10000;
% Calculate the pressure gradient between the two sites
distance = 50; % unit : km
dp_dy = (pres_pa(1) - pres_pa(2)) / (distance*1000); % pressure gradient (Pa/m)
% Calculate the geostrophic current
u_geo = -(1/(mean(rho) * f)) * dp_dy; % geostrophic current in the x-direction (m/s)
disp(['velocity of Geostrophic current : ', num2str(u_geo), '(m/s)']);
The initial setting is like this.
temp(1,:)=[ 7 4 3 2.4 2 1.7 1.4 1 ];
sal(1,:) = [ 34.1 34.2 34.4 34.6 34.68 34.72 34.72 34.72 ];
temp(2,:) = [ 6 3 2.6 2.25 1.8 1.4 1.25 0.9 ];
sal(2,:) = [ 34.05 34.2 34.5 34.63 34.7 34.72 34.72 34.717 ];
depth = [ 0 500 1000 1500 2000 2500 3000 3500 ];
thanks.

Antworten (1)

Ashutosh
Ashutosh am 18 Aug. 2023
The error of unrecognized function or variable is seen on the function 'sw_dens which is not declared in the code provided. Try to declare the function within the script to remove this error.
One can take reference from the link to understand more about the error:

Kategorien

Mehr zu Oceanography and Hydrology finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by