Due to a shift in policy, from 0900 GMT on Wednesday 14th July 2021, we will be disabling ssh access to the server for external users. External users who wish to continue to access code repositories on the server will need to switch to using https. This can be accomplished in the following way: 1) On the repo on gitlab, use the clone dialogue and select ‘Clone with HTTPS’ to get the address of the repo; 2) From within the checkout of your repo run: $ git remote set-url origin HTTPS_ADDRESS. Here, replace HTTPS_ADDRESS with the address you have just copied from GitLab. Pulls and pushes will now require you to enter a username and password rather than using a ssh key. If you would prefer not to enter a password each time, you might consider caching your login credentials.

Commit 27ad015f authored by Ricardo Torres's avatar Ricardo Torres 💬

added option to name the output file in write_admesh_mesh.m to replace the generic mesh.14 file.

parent 9c6b94d4
......@@ -10,6 +10,7 @@ function write_admesh_mesh(Mobj,varargin)
% Mobj = needs bathymetry, nodes and triangulation
% table. read_sms_mesh provides everything it needs.
% [optional] output_directory = directory to write mesh.14 file
% [optional] filename = filename to use instead of default mesh(.14). Don't provide extension
% [optional] native_coord = cartesian or spherical. Assumes cartesian if
% omitted.
%
......@@ -48,7 +49,7 @@ out_dir = pwd; % default is to write file to current directory
native_coord = 'cartesian';
have_xy = true;
have_lonlat = false;
filename = 'mesh'
for i = 1:2:length(varargin) - 1
keyword = lower(varargin{i});
......@@ -57,6 +58,8 @@ for i = 1:2:length(varargin) - 1
switch keyword
case 'output_directory'
out_dir = varargin{i + 1};
case 'filename'
filename = varargin{i + 1};
case 'native_coord'
coord = varargin{i + 1};
if strcmpi(coord, 'spherical')
......@@ -79,7 +82,7 @@ end
%--------------------------------------------------------------------------
% Open the output file
%--------------------------------------------------------------------------
gmsh_msh = fullfile(out_dir,'mesh.14');
gmsh_msh = fullfile(out_dir,[filename '.14']);
fid = fopen(gmsh_msh, 'wt');
assert(fid >= 0, sprintf('file: %s could not be created\n', gmsh_msh));
......
% Blend two sources of bathymetry
function [ new_bat ] = merge_bathymetry( dist_OB,coarse_bat,fine_bat,d0,d1 )
%
% [ new_bat ] = merge_bathymetry( dist_OB,coarse_bat,fine_bat,d0,d1 )
%
% DESCRIPTION:
% This script uses a blending function to combine two bathymetry sources
% over a common spatial extent (High-resolution, unstructured meshes for hydrodynamic models of the Great Barrier Reef, Australia,
% Estuarine Coastal and Shelf Science 68:36-46 · June 2006
% DOI: 10.1016/j.ecss.2005.08.017 )
% INPUT [keyword pairs]:
% dist_OB: a length metric used to combine the two sources
% coarse_bat: Bathymetry data to combine at lower distance
% fine_bat: Bathymetry data to combine at longer distances
% d0: is the plateau distance
% d1: is the end distance limiting factor
%
%
% the blending function is a piecewise polynomial function as
% f1d= 3.*( (dist_OB-d0)./(d1-d0) ).^2 - 2.*( (dist_OB-d0)./(d1-d0) ).^3;
% % restric closes points
% f1d(dist_OB<=d0)=0;
% f1d(dist_OB>=d1)=1;
% f1d=abs(f1d-1);
% % % Example
% d0=50;d1=2000;dist_OB = 0:100:12000;
% f1d= 3.*( (dist_OB-d0)./(d1-d0) ).^2 - 2.*( (dist_OB-d0)./(d1-d0) ).^3;
% % restric closes points
% f1d(dist_OB<=d0)=0;
% f1d(dist_OB>=d1)=1;
% plot(dist_OB,abs(f1d-1));
% EXAMPLE USAGE
% Mobj_all.sub.z_merged = merge_bathymetry( Distance_from_nodestring,Mobj_all.z,Mobj_all.z1,100,2000 );
%
% Author(s):
% Ricardo Torres (Plymouth Marine Laboratory)
%
% Revision history
%
%
%==============================================================================
f1d= 3.*( (dist_OB-d0)./(d1-d0) ).^2 - 2.*( (dist_OB-d0)./(d1-d0) ).^3;
% restric closes points
f1d(dist_OB<=d0)=0;
f1d(dist_OB>=d1)=1;
f1d=abs(f1d-1);
new_bat=f1d.*coarse_bat+((1-f1d).*fine_bat);
return
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment