OceanMesh2D icon indicating copy to clipboard operation
OceanMesh2D copied to clipboard

shoreline constraints

Open huyquangtranaus opened this issue 5 years ago • 13 comments

mesh_ Hi Keith, William,

I am making a mesh over the wharf like the land, but I want to keep its shape (e.g. straight line, not weirs) An example is attached. Is OceanMesh2D capable of doing that?

Thanks, mates Huy

huyquangtranaus avatar Aug 25 '20 19:08 huyquangtranaus

Hey Huy,

Yes, we have an example that shows how to do something like that here... https://github.com/CHLNDDEV/OceanMesh2D/blob/Projection/Examples/Example_6b_GBAY_w_floodplain.m

We first mesh to the datum in a water tight fashion, then we use extractFixedConstraints to get the vertices and edges along the mainland and island boundaries so that these points and edges will be constrained in the subsequent meshing step.

Then we define a new geodata using a contour of a higher height (e.g., 10-m) and call the mesh generator with the pfix and egfix. Note in this second call to meshgen we re-use the same sizing function. All sizing options can be specified by depth-ranges, which is shown in the example.

krober10nd avatar Aug 25 '20 19:08 krober10nd

GBBAY Cool, Keith,

Yes, I explored that example before. I see it could be one solution for me. However, when I zoom in, I don't see we have a straight (extract, sharp) line as a screenshot attached? In that case, I anticipate that there might be some bad elements along the line, but can we do that?

huyquangtranaus avatar Aug 25 '20 20:08 huyquangtranaus

I would suggest to plot the mesh plot(m,'bmesh',0) and then plot the edge constraints hold on; drawedge2(pfix,egfix) and then zoom in to make sure.

All edge constraints should be retained and your mshgen.build should have a different looking output showing the edge constraining algorithm is active.

krober10nd avatar Aug 25 '20 20:08 krober10nd

1 Oh yes, I see somewhere in the mesh (attached), can we also make two parallel straight lines along a shipping channel? That would be a powerful feature then.

huyquangtranaus avatar Aug 25 '20 21:08 huyquangtranaus

glad it's working, the translation in location is likely due to the projection you built the mesh in but that's just a guess.

And yes, that's already all in there. what you could is this:

  1. Build a sizing function
  2. Draw a line along your channel and increase point spacing to h0 using the function my_interpm
  3. Apply the decimation technique that we use for the initial point rejection to remove some points from the line. This is so the point spacing along the line agrees with the sizing function.
  4. Pass these points and edges to mshgen

krober10nd avatar Aug 25 '20 21:08 krober10nd

I could make a simple function to do the above but maybe you could first take a stab at it.

krober10nd avatar Aug 25 '20 21:08 krober10nd

@huyquangt can you post your code so I can see what's going on to create these images?

krober10nd avatar Aug 26 '20 01:08 krober10nd

hello @krober10nd, I used the example Example_6b_GBAY_w_floodplain.m to make these images.

huyquangtranaus avatar Aug 26 '20 02:08 huyquangtranaus

Ah ok then I would turn off cleanup in mshgen. And then do it after with the implicit smoother turned off. That can shift points unfortunately.

krober10nd avatar Aug 26 '20 03:08 krober10nd

do you have time to do it soon? then I can have a try

Thanks mate

huyquangtranaus avatar Aug 26 '20 03:08 huyquangtranaus

Hey Keith @krober10nd it seems to me that in the example /Example_6b_GBAY_w_floodplain.m, the constraints are applied to the entire (outer) edges for mapping the main land. Can we only apply part of it?

huymetocean avatar Aug 26 '20 04:08 huymetocean

I ran the Example_6b_GBAY_w_floodplain.m to completion and I only see the shoreline and islands being constrained (blue edges). Screen Shot 2020-08-26 at 12 34 37 PM

But yes, if you run meshgen with cleanup, 1 then this destroys both pfix and egfix because of the option ds. Something to look more into but the solution is to defer cleaning to after mesh generation is completed and run it with a custom option set that doesn't do direct_smooth (e.g., ds,0)

I don't think I have time to look into the channel constraints thing at least for the next few weeks.

krober10nd avatar Aug 26 '20 15:08 krober10nd

Screen Shot 2020-08-26 at 1 23 56 PM

krober10nd avatar Aug 26 '20 16:08 krober10nd

#264

CHLNDDEV avatar Feb 20 '24 00:02 CHLNDDEV