# Tag Info

9

The OP has asked a number of related questions involving the same FEM operators 226503, 226486, 222834. As I showed in my answer 222834 to an earlier question from the OP, this system would benefit from dimensional analysis and that an anisotropic structured quad mesh is probably the most robust solution to the problem. Dimensional analysis would aid in ...

7

The linked example was for a much smaller domain and hence too small of a mesh size specification. The following code should accomplish what you need. (* Uncomment if not installed *) (*ResourceFunction["FEMAddOnsInstall"][]*) Needs["FEMAddOns"] bathx = 30; bathy = 30; bounds = 1.1*{{0, bathx}, {0, bathy}}; plastic = Rectangle[{10, 10}, ...

6

One idea is to convert the MeshRegion to a BoundaryMeshRegion, and then to extract the bounding polygon. Your MeshRegion: reg = MeshRegion[ { {1.,0.},{2.,0.},{3.,0.},{4.,0.},{5.,0.},{4.5,2.5},{0.5,2.5},{2.5,0.5}, {2.5,4.5},{5.,1.},{5.,2.},{5.,3.},{5.,4.},{5.,5.},{4.,5.},{3.,5.}, {2.,5.},{1.,5.},{0.,5.},{0.,4.},{0.,3.},{0.,2.},{0.,1.},{0.,0.}, ...

6

Tim's answer is spot on. Here is a slightly different approach that uses a trick. The idea is to use the waterbath as the region and tell ToElementMesh to also mesh the interior region (the plastic). If this approach is applicable in your case then you can reduce the amount of code somewhat. Needs["NDSolveFEM"] bathx = 30; bathy = 30; plastic = ...

5

The gap in the edge can be eliminated in the plot with the method option ”BoundaryOffset”: test = DiscretizeGraphics[ ParametricPlot3D[{Cos[u], Sin[u], v}, {u, 0, 2 \[Pi]}, {v, 0, 1}, PlotPoints -> {155, 20}, MaxRecursion -> 0, Mesh -> None, MeshStyle -> None, Method -> “BoundaryOffset” -> False]] test // FindMeshDefects

4

It seems something with the automatic MaxCellMeasure computation is not quite right. Here is a workaround with a manually specified MaxCellMeasure mr = DiscretizeGraphics[gr]; (*ToElementMesh[mr]*) ToElementMesh[mr, MaxCellMeasure -> .1] Update: This is a bug in TetGen, the mesh generator used. (bmesh = ToBoundaryMesh[mr]); pts = bmesh["Coordinates&...

4

VoronoiMesh[X, MeshCellStyle -> {{1, "Interior"} -> {Thick, Red}, {1, "Frontier"} -> {Thick, Red}}] Alternatively, VoronoiMesh[X, MeshCellStyle -> {{1, "Boundary"} -> Opacity, {1, All} -> Directive[Thick, Red]}] same picture

4

mesh = DiscretizeGraphics[ ParametricPlot3D[{Cos[u], Sin[u], v}, {u, 0, 2 \[Pi]}, {v, 0, 1}, PlotPoints -> {155, 20}, MaxRecursion -> 0, Mesh -> None, MeshStyle -> None]]; Get a mesh connectivity graph and find candidate edges (or points): g = MeshConnectivityGraph[mesh, {1, 1}, 2]; bcells = Pick[VertexList[g], VertexDegree[g], 2]; ...

4

We can workaround this issue with DelaunayMesh: BoundaryMesh[DelaunayMesh[pts10]]

3

First, let's write the data like this: coords = {{1., 0.}, {2., 0.}, {3., 0.}, {4., 0.}, {5., 0.}, {4.5, 2.5}, {0.5, 2.5}, {2.5, 0.5}, {2.5, 4.5}, {5., 1.}, {5., 2.}, {5., 3.}, {5., 4.}, {5., 5.}, {4., 5.}, {3., 5.}, {2., 5.}, {1., 5.}, {0., 5.}, {0., 4.}, {0., 3.}, {0., 2.}, {0., 1.}, {0., ...

3

Here is a slightly different approach also using OpenCascadeLink Needs["NDSolveFEM"] bmesh = ToBoundaryMesh[ohp, "BoundaryMeshGenerator" -> "OpenCasdade"] MeshRegion[bmesh] Note, however, there is a slight difference in the result compared to Tim's answer. In this case the union is created. I.e. no subdivision between the ...

3

Here is an option using OpenCascadeLink. OpenCascade is an open source 3D CAD package that often does a better job retaining sharp features with boolean operations and seems to be fairly robust. Needs["OpenCascadeLink"] Needs["NDSolveFEM"] {length, beam, draft} = {50, 3, 4}; pmin = {0, 0, 0}; pmax = {length, beam, draft}; hull = ...

3

Instead of f = 1. + .5 Sin[4 Pi #] &; ParametricPlot3D[{f[v] Cos[u], f[v] Sin[u], v}, {u, 0, 2 \[Pi]}, {v, 0, 1}, PlotPoints -> {155, 20}, MaxRecursion -> 0, Mesh -> None, MeshStyle -> None] you can just do f = 1. + .5 Sin[4 Pi #] &; n = 155; {x, y} = Transpose@Cases[ Plot[f[v], {v, 0, 1}, PlotPoints -> 20], _Line, ...

3

Following the discussion in the comment section with @TumbiSapichu, I've found a possible solution to this problem. As mentioned, instead of translating the seeds, we could simply add more points, enough so that, upon drawing a rectangle centred in this new mesh, you simply pick the first n cells which seeds intersect the rectangle, with increasing size, ...

3

Try to use the options MeshFunctions and Mesh For example image = Import["ExampleData/ocelot.jpg"] currentImData = ImageData[ImageResize[image, 30]]; mesh = ListPlot3D[currentImData, InterpolationOrder -> 2,AspectRatio -> 1, PlotRange -> {{0, Dimensions[currentImData][]}, {0,Dimensions[currentImData][]}, {0, 1 }}, Filling -> ...

2

I am not sure, if this fully answers your question, but you should be able to work from here. I tried to explain my code with the comments above each for-loop and I maintained your overall structure. (*Generate Grid Mesh of dimensions axb with nx divisions in x and ny \ divisions in y*) GenerateGridMesh[aa_, bb_, nx_, ny_, p_] := Block[{x = 0., y = 0., dx,...

2

Both DiscretizeGraphics and DiscretizeRegion return a MeshRegion. DiscretizeRegion is more precise. A mesh level of "2" does not appear to work because the thickness of the lines are too faint. One can use HighlightMesh to see the discretization more clearly. HighlightMesh[ DiscretizeRegion[Cuboid[{0, 0, 0}, {50, 3, 4}], MaxCellMeasure -&...

1

We can solve this problem using ClearAll["Global*"] Needs["NDSolveFEM"] (*1) Define Constants*) e = 1.60217662*10^-19; F = 96485; kb = 1.381*10^-23; sigi = 18; sigini = 0; sigeni = 2*10^6; T = 1000; n = -0.02; c = 1; pH2 = 0.2; pH2O = 1 - pH2; pO2 = 1.52*^-19; l = 10*10^-6; a = 100*10^-7; b = 50*10^-7; d = 300*10^-7; y1 = 0.01; y2 = 0....

1

I'm really happy with the solutions provided and they seem to do the trick. Nonetheless, I'm sharing my solution with you. I managed to solve the ordering problem by tracking the generating seeds instead and defining a function per that translates the permutations occurring in the mesh cells every time there is an update of the seeds positions and number (...

1

You can make use of the FEMAddOns to do this now: ResourceFunction["FEMAddOnsInstall"][] Needs["FEMAddOns`"] r = 1.12; R2d1 = RegionUnion[Disk[{1 + r, 0}, r], Disk[{-1 - r, 0}, r], Disk[{0, -1 - r}, r], Disk[{0, 1 + r}, r]]; R2d = RegionDifference[Disk[{0, 0}, 4], R2d1]; M2d = ToElementMesh[R2d, "MeshOrder" -> 1(*, ...

Only top voted, non community-wiki answers of a minimum length are eligible