Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
clear all;close all;
%Requires fvcom-toolbox, can be downloaded from https://github.com/pwcazenave/fvcom-toolbox
addpath(genpath('/home/cliu/Documents/fvcom-toolbox'))
conf.casename = 'Marsh';
% open mesh files
Mobj = read_sms_mesh('2dm','marsh.2dm');
% plot mesh
triplot(Mobj.tri,Mobj.x, Mobj.y , 'linewidth',0.1, 'color','r')
axis('equal')
%% construct bathymetry field
h = Mobj.h;
% -- shore: 1.5 m to 0.5 m linearly
h(Mobj.x < 100) = -0.01 .* Mobj.x(Mobj.x < 100) + 1.5;
% -- highland: -3 m
h(Mobj.x >= 100) = -3.0;
% -- marsh: -0.5 m
h((Mobj.x >= 100 & Mobj.x <=370) & (Mobj.y>=30 & Mobj.y<=77)) = -0.5;
h((Mobj.x >= 100 & Mobj.x <=370) & (Mobj.y>=83 & Mobj.y<=130)) = -0.5;
% -- channel: 0.5 m below
h((Mobj.x >= 100 & Mobj.x <=370) & (Mobj.y>=77 & Mobj.y<=83)) = 0.5;
Mobj.h = h;
figure()
patch('Vertices',[Mobj.x, Mobj.y], 'Faces',Mobj.tri,'Cdata',Mobj.h,'edgecolor','interp','facecolor','interp');hold on
colorbar()
axis('equal')
Mobj.have_bath = true;
%% add constant Corilis
Mobj = add_coriolis(Mobj, 'constant', 41.34);
%% write files
if ~exist('input', 'dir')
mkdir('input')
end
write_FVCOM_grid(Mobj, fullfile('.', ...
['input/', conf.casename, '_grd.dat']));
% Bathymetry
write_FVCOM_bath(Mobj, fullfile('.', ...
['input/', conf.casename, '_dep.dat']));
% Coriolis
write_FVCOM_cor(Mobj, fullfile('.', ...
['input/', conf.casename, '_cor.dat']));
% Open boundaries
write_FVCOM_obc(Mobj, fullfile('.', ...
['input/', conf.casename, '_obc.dat']))