Skip to content

Commit

Permalink
Update HA script for FES to handle the exception case where points are
Browse files Browse the repository at this point in the history
located very close to prime meridian
  • Loading branch information
josephzhang8 committed Jul 30, 2024
1 parent 31db6ce commit 4c6d3a3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/input-output/param.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ If `iprecip_off_bnd`/=0, preciptation will be turned off near land boundary. Thi

### stemp_stc (double), stemp_dz(1:2) (double)
Option to account for sediment-water heat exchange on bottom temperature.
`stemp_stc` is heat transfer coefficient W.m-2.K-1 (so `stemp_stc=0` would turn this option off).
`stemp_stc` is heat transfer coefficient $W/m^2/K$ (so `stemp_stc=0` would turn this option off).
stemp_dz(1) is the equivalent sediment buffer depth (m) for heat into sediment, and
stemp_dz(2) is the equivalent sediment buffer depth (m) for heat out of sediment.

Expand Down
26 changes: 19 additions & 7 deletions src/Utility/Tides/gen_harm_FES.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
%const={'s2','m2','n2','k2','k1','p1','o1','q1','m4'};

%List of open bnd seg's that contain lon/lat of open bnd nodes
open_ll={'fg.bp.1'}; %,'fg.bp.2','fg.bp.3'};
open_ll={'fg.bp.1','fg.bp.2'}; %,'fg.bp.3','fg.bp.4','fg.bp.5','fg.bp.6'};

for iseg=1:length(open_ll)
%-----------------------------------------------------------
Expand Down Expand Up @@ -72,15 +72,27 @@
for j=1:npt
lon2=open(j,2); if(lon2<0); lon2=lon2+360; end;
lat2=open(j,3);
I=find(lon>=lon2,1); %find 1st entry
J=find(lat>=lat2,1);
if(I<=1 || J<=1)
disp('Failed to find an interval'); [j lon2 lat2 I J]
error('Bomb out');
if(J<=1)
disp('Failed to find an interval for lat'); [j lon2 lat2 J]
error('Bomb out(1)');
end

ratx=(lon(I)-lon2)/(lon(I)-lon(I-1));
raty=(lat(J)-lat2)/(lat(J)-lat(J-1));

%Handle case with pt very close to prime meridian
if(lon2<min(lon) || lon2>max(lon))
disp(['Point ' num2str(j) ' very close to prime meridian']);
disp('Its lon:'); [lon2 min(lon) max(lon)]
I=length(lon);
ratx=0;
else
I=find(lon>=lon2,1); %find 1st entry
if(I<=1)
disp('Failed to find an interval for lon'); [j lon2 lat2 I J]
error('Bomb out');
end
ratx=(lon(I)-lon2)/(lon(I)-lon(I-1));
end
%Check junks
amp_max=max([amp0(I-1,J-1);amp0(I,J-1);amp0(I-1,J);amp0(I,J)]);
amp_min=min([amp0(I-1,J-1);amp0(I,J-1);amp0(I-1,J);amp0(I,J)]);
Expand Down

0 comments on commit 4c6d3a3

Please sign in to comment.