CHLNDDEV / OceanMesh2D

A two-dimensional triangular mesh generator with pre- and post-processing utilities written in pure MATLAB (no toolboxes required) designed specifically to build models that solve shallow-water equations or wave equations in a coastal environment (ADCIRC, FVCOM, WaveWatch3, SWAN, SCHISM, Telemac, etc.).
https://github.com/sponsors/krober10nd
GNU General Public License v3.0
181 stars 65 forks source link

depth-based bounds enforcement #154

Closed krober10nd closed 3 years ago

krober10nd commented 3 years ago

max_el = [2e3 0, -inf,... 30, inf, 0]; % Maxmimum element size. for param = max_el' mx = param(1) dp1 = param(2) dp2 = param(3) end


prints only

mx =

    2000

dp1 =

 0

dp2 =

-Inf



and never enforces the secondary criteria however if the user puts a semi-colon at the end of the row for the definition of `max_el` it works and enforces the second criteria. 

This kind of thing is an easy mistake and we should probably make it harder to make it. It also happens silently and someone may think it's being enforced when it is not!
krober10nd commented 3 years ago

perhaps check if the length of max_el or the like is greater than 3 then a semi-colon should be present otherwise it throws a warning?

WPringle commented 3 years ago

In general the way we handle depth range input is very tricky to understand. I always need to go back and carefully interrogate the meaning of the signs and the order. May need modification of the kwarg to be more intuitive

WPringle commented 3 years ago

max_el{1} = {20e3, 'mindepth',0,'maxdepth',inf}; max_el{2} = {30,'mindepth',-inf,'maxdepth,0};

or can be just max_el = [20e3 30] with mindepth being -inf and maxdepth being inf by default.

So then we detect cells instead of size of array

krober10nd commented 3 years ago

I would prefer the former as its explicit what the values are to the user

WPringle commented 3 years ago

Ah yeah sorry I meant user can either choose to put max_ele = 20e3 (a scalar); or can use a cell in which each entry should be a cell as I wrote

krober10nd commented 3 years ago

Yes that’s what I understood too