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
179 stars 65 forks source link

make_bc() errors out when selecting elevation boundary #209

Closed HamishB closed 3 years ago

HamishB commented 3 years ago

Hi,

when running m = make_bc(m, 'outer', 0) after typing in the vstart and vend values it asks if flux(1) or elevation(2) boundary. If you type '2' it exits with an error: Reference to non-existent field 'ibtype'.

extract_boundary (line 150)
  ibtype=opendat.ibtype;

msh/make_bc (line 1801)

thanks, Hamish

krober10nd commented 3 years ago

I think it would be helpful to share the mesh and show a MFE and including a mesh.

I just tried with example 1 using make_bc(m,'outer',0) for the flux boundary then make_bc(m,'outer',1) for the ocean boundary and it worked. So I was not able to replicate your issue.

HamishB commented 3 years ago

yeah ignore this one, my bad. I copied down the wrong number for vend:, but it was close enough that it didn't end up in an obvious beyond array bounds error.

HamishB commented 3 years ago

There is something here after all.

If you load in a fort.14 mesh with m=msh('fort.14') with existing island boundaries but an empty ocean boundary the m.op struct is created but is empty (nope=0; neta=0; nvdll=[0x1 double]; ibtypee=[0x1 double]; nbdv=[]). If I run m.op=[] first then it works. If I don't clear that first I get the error described above.

If the m.op is empty in a different way (nope=0; neta=0; nvdll=0; ibtype=0; nbdv=0), it works too.

Perhaps ibtypee vs ibtype variable name issue?

Also I'm still a bit confused by make_bc()'s 'outer' clockwise vs anti-clockwise control. Currently I run the same command twice for both mainland and open-ocean, where intuition would tell me that I'd want to reverse the 0/1 for one of them if I keep the vstart,vend ID order the same. Note I'm giving different but next door to each other vstart.vend numbers for the mainland & open ocean boundaries, to avoid a boundary node being doubly defined as both land and sea.

thanks, Hamish

krober10nd commented 3 years ago

Perhaps ibtypee vs ibtype variable name issue?

No, that's intentional.

Also I'm still a bit confused by make_bc()'s 'outer' clockwise vs anti-clockwise control. Currently I run the same command twice for both mainland and open-ocean, where intuition would tell me that I'd want to reverse the 0/1 for one of them if I keep the vstart,vend ID order the same. Note I'm giving different but next door to each other vstart.vend numbers for the mainland & open ocean boundaries, to avoid a boundary node being doubly defined as both land and sea.

We've discussed this prior. It just means go one direction and go the other.

krober10nd commented 3 years ago

I have a hard time following your description. If you could create a code that failed in a handful of lines, I'd be able to identify the so-called issue otherwise it's nebulous.