ToElementMesh ignores Boundaries and MeshRefinemet

This is a partial answer: (The rest is in the update below)

Let's leave mesh refinement out for a second. Some of faces do not seem to be connected. (It seems you changed your logic a bit when constructed the boundary mesh.)

Needs["NDSolve`FEM`"]
bmesh = ToBoundaryMesh[Import["~/Downloads/boundary.off"]];
bmesh2 = ToBoundaryMesh["Coordinates" -> bmesh["Coordinates"], 
   "BoundaryElements" -> {QuadElement[
      bmesh["BoundaryElements"][[1, 1]][[{(*6,*)10, 14, 18, 22, 26, 
         27, 28, 40, 47}]]]}];
bmesh2["Wireframe"]

enter image description here

Faces 22 and 28 do not seem to be connected. At least I was not able to find the elements they should connect to.

It would be more useful to have the actual (raw) coordinates and boundary faces than having to extract them from the off file.

I'd try to get the boundary mesh figured out before I start the refinement.

Update

If you want boundaries to not be merged they'd need different boundary element markers. If they have the same marker there is not reason to not merge them; you'd apply the same boundary condition anyways.

To keep the boundaries distinct you could assign a different marker to each face like so:

Needs["NDSolve`FEM`"]
{easyPoints, easyFaces} = Import["~/Downloads/pointsNelementsEasy.mx"];
bmesh = ToBoundaryMesh["Coordinates" -> easyPoints, 
   "BoundaryElements" -> {QuadElement[easyFaces, 
      Range[Length[easyFaces]]]}];
(*bmesh["Wireframe"]*)

bmesh["Wireframe"["MeshElement" -> "BoundaryElements", 
  "MeshElementStyle" -> (FaceForm /@ 
     ColorData["SunsetColors"] /@ 
      Range[0, 1, 1/(Length[easyFaces] - 1)])]]

enter image description here

Each face now has it's own marker. The full mesh:

mesh = ToElementMesh[bmesh, "MaxCellMeasure" -> 100];
mesh["Wireframe"["MeshElement" -> "BoundaryElements", 
  "MeshElementStyle" -> (FaceForm /@ 
     ColorData["SunsetColors"] /@ 
      Range[0, 1, 1/(Length[easyFaces] - 1)])]]

enter image description here

Hope that helps. Two more points: if you want to use @ to ping me, you'd have to do that under my answer. I am curious to know what type of FEM analysis do you plan to do?


Okay, with a lot of help from user 21 this actually turned out to be a very neat example for 3d meshing. Here is the solution to my two problems: I started out with the following data: input data

{points, faces, markers, regionMarkerPoints} = 
  Import[NotebookDirectory[] <> "completeData.mx"];

As user21 pointed out, I needed to define boundary element markers if I wanted to avoid the merging of my boundary areas:

bmesh = ToBoundaryMesh[
  "Coordinates" -> points,
  "BoundaryElements" -> {QuadElement[faces, markers]}];
bmesh["Wireframe"["MeshElement" -> "BoundaryElements", 
  "MeshElementStyle" -> (FaceForm /@ 
     ColorData["Rainbow"] /@ Range[0, 1, 1/13])]]

boundary mesh with markers Each boundary with the same marker has the same color. The second problem was the meshing process, where I could't achieve satisfying results with a refinement function. Instead I chose a much more convenient approach now, by dividing my model into different volumes elements and assigning region markers. See the cross section of my model: cross section

There are basically three volumes in the model, now represented by the region marker points (green=ground, red= dam, blue= pit liner). I can put a volume contraint of 80 m³ on the ground region, 1 m³ on the dam and 0.1 m³ on the pit liner:

mesh = ToElementMesh[
   bmesh,
   "MeshOrder" -> 1,
   "RegionMarker" -> {{regionMarkerPoints[[1]], 1, 
      80}, {regionMarkerPoints[[2]], 2, 1}, {regionMarkerPoints[[3]], 
      3, 0.1}}
   ];
mesh["Wireframe"["MeshElement" -> "MashElements", 
  "MeshElementStyle" -> {Directive[FaceForm[Green]], 
    Directive[EdgeForm[], FaceForm[Red]], 
    Directive[EdgeForm[], FaceForm[Blue]]}]]

Final Mesh

I turned off the Edges of the very fine mesh in the center of the model, so one can see, that by picking a random point inside my 3 volumes I assigned RegionMarkers to them.

This is the final result after exporting the model to FEFLOW. It still needs further tuning, but fulfils my basic requirements:

enter image description here

Actually the process turned out to be quite simple and elegant, but in my oppinion Mathematica's documentation on 3D applications is often quite short compared to the extensive 2D cases.