Commit 182f7aab authored by Pierre Cazenave's avatar Pierre Cazenave
Browse files

Add support for a range of additional variables to be written to the sediment...

Add support for a range of additional variables to be written to the sediment file. This may be useful if we ever get around to adding support for spatially varying initial conditions to the sediment transport module in FVCOM.
parent 93d3a8b3
......@@ -8,10 +8,14 @@ function write_FVCOM_sediment(sediment, filename)
% for FVCOM
%
% INPUT
% sediment = struct with nodal data in the following fields:
% sediment = struct with nodal data in the following mandatory fields:
% - tau_ce
% - tau_cd
% - tau_cd (this appears to be unused but required at launch)
% - erate
% and the following optional field(s):
% - <sediment_class>_bedfrac
% If the optional field(s) is included, the namelist option
% SEDIMENT_PARAMETER_TYPE = "non-uniform" can be used.
% filename = filename to which to write the outputs.
%
% OUTPUT:
......@@ -75,6 +79,18 @@ tau_cd_varid = netcdf.defVar(nc, 'tau_cd', 'NC_DOUBLE', node_dimid);
netcdf.putAtt(nc, tau_cd_varid, 'long_name', 'critical shear stress for deposition');
netcdf.putAtt(nc, tau_cd_varid, 'units', 'N/m^2');
extra_fields = setdiff(fieldnames(sediment), {'tau_ce', 'tau_cd', 'erate'});
for f = 1:length(extra_fields)
sediment_name = strrep(extra_fields{f}, '_bedfrac', '');
if ftbverbose
fprintf('Adding extra variable: %s\n', sediment_name)
end
eval(sprintf('%s_varid = netcdf.defVar(nc, ''%s'', ''NC_DOUBLE'', node_dimid);\n', sediment_name, sediment_name))
eval(sprintf('netcdf.putAtt(nc, %s_varid, ''long_name'', ''Fraction of %s in surface layer'');\n', sediment_name, sediment_name))
eval(sprintf('netcdf.putAtt(nc, %s_varid, ''units'', ''-'')\n', sediment_name))
eval(sprintf('netcdf.putAtt(nc, %s_varid, ''grid'', ''fvcom_grid'')\n', sediment_name))
end
% end definitions
netcdf.endDef(nc);
......
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