3
$\begingroup$

I'm using NDSolve with finite element to try to solve a heat transfer problem. The region I have is a rectangle where the four vertices are at (-0.5,0), (0.5,0), (0.5, 3), (-0.5,3). The rectangle is divided into two regions (different thermal conductivity) by a parametric curve y=1-0.1*Cos[2*pi*x], where -0.5<=x<=0.5. There is an example similar to this case in the official documentation using ToBoundaryMesh, but the region is divided by a straight line, not a curve. I also tried something like

ir = ParametricRegion[{t, 1 + \[Delta] Cos[2 \[Pi] t]}, {{t, -0.5, 0.5}}]
coords = DiscretizeRegion[ir]

But then I'm not sure how to supply the coordinates to ToBoundaryMesh or other functions.

How can I generate the mesh for use in NDSolve?

$\endgroup$
5
$\begingroup$

Maybe this will get you started:

(* If you do not have the FEMAddOns installed get then with: *)
(*  ResourceFunction["FEMAddOnsInstall"][] *)

Needs["FEMAddOns`"]
(* Create Regions *)
dom = Rectangle[{-0.5, 0}, {0.5, 3}];
bot = DiscretizeRegion@
   ImplicitRegion[(-0.5 <= x <= 0.5) && (0 <= y <= 
       1 + 0.1 Cos[2 \[Pi] x]), {x, y}];
bmesh1 = ToBoundaryMesh[dom];
bmesh2 = ToBoundaryMesh[bot];
bmesh = BoundaryElementMeshJoin[bmesh1, bmesh2]
bmesh["Wireframe"]

Curved Internal Boundary

| improve this answer | |
$\endgroup$
  • $\begingroup$ I think this is a good approach. $\endgroup$ – user21 Apr 8 at 8:15
  • $\begingroup$ If I want to apply periodic boundary condition to the left and right sides (x=-0.5 and x=0.5), do I need to specify anything in the mesh generation stage, or do I just specify that in side NDSolve? I'm not sure if the generated mesh on the two sides actually match. $\endgroup$ – Physicist Apr 8 at 18:11
  • $\begingroup$ @Physicist I don't think Mathematica requires a 1 to 1 nodal correspondence for PeriodicBCs as other codes do. $\endgroup$ – Tim Laska Apr 8 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.