1

I am trying to build a quite simple mesh. I have a box:

box_size = 50;
lb = 10.;
Point(1) = {-box_size/2, -box_size/2, -box_size/2, lb};
Point(2) = {box_size/2, -box_size/2, -box_size/2, lb};
Point(3) = {box_size/2, box_size/2, -box_size/2, lb};
Point(4) = {-box_size/2, box_size/2, -box_size/2, lb};
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};
Line Loop(5) = {1, 2, 3, 4};
Plane Surface(6) = {5};
Extrude {0, 0, box_size} {
  Surface{6};
}

This works quite well and gmsh is happy to (3D) mesh it. The problem is that I would to ensure that certain points inside the box are node points. So my question is, how do I ensure that points, like these

lc = 10;
Point(5) = {7.150548, 1.000000,  -6.990684, lc};
Point(6) = {-4.438894, 1.000000,  -8.960816, lc};
Point(7) = {-9.893936, 1.000000,  1.452595, lc};
Point(8) = {-1.675894, 1.000000,  9.858569, lc};
Point(9) = {8.858176, 1.000000,  4.640336, lc};
Point(10) = {1.675894, 4.750000,  -9.858569, lc};
Point(11) = {-8.858176, 4.750000,  -4.640336, lc};
Point(12) = {-7.150548, 4.750000,  6.990684, lc};
Point(13) = {4.438894, 4.750000,  8.960816, lc};
Point(14) = {9.893936, 4.750000,  -1.452595, lc};
Point(15) = {7.150548, 8.500000,  -6.990684, lc};

are part of the mesh?

The reason I need this is that I need to impose boundary conditions at these specific points.

If this is easier in another software, I am also happy to change. I hope someone can help.

Thank you in advance.

Bort
  • 2,423
  • 14
  • 22
Julius
  • 735
  • 2
  • 6
  • 17

3 Answers3

4

Quite a late answer but it might help anyway. If the index of the Point is p and the one of the volume or surface is q, then :

Point{p} In Volume {q};

Or if it is on a Surface :

Point{p} In Surface {q};
bertbk
  • 105
  • 7
0

bertbk nicely answers the question using gmsh's own syntax of the geo interface. Since there is also a python interface, let me show, how embedding, is done there.

import gmsh
import numpy as np
# in this example I demonstrate how to 
# embed points in a line

gmsh.initialize()
gmsh.model.add('embedded_points_in_interval')

# I do this in 1D, it works in 2D, 3D in the same way

# some points you want in the mesh
N=10
x_internal = np.linspace(0,1,N) 

# let's make local mesh size at each point so large that the 
# final mesh only contains the line, start point, end point
# and embedded points
lc = 10

internal_tags = []
for x in x_internal:
    # adds each point to the model
    tag = gmsh.model.geo.add_point(x, 0, 0, lc)
    # collect their tags, we need them for embedding them 
    # later in the line
    internal_tags.append(tag)

# add starting and endpoint of line
p_start = gmsh.model.geo.add_point(-1, 0, 0, lc)
p_end = gmsh.model.geo.add_point(2, 0, 0, lc)

# make line from point tags p_start and p_end
line_tag = gmsh.model.geo.add_line(p_start,p_end) 
# call synchronization to make CAD kernel aware of everything
gmsh.model.geo.synchronize()

# embed all internal points
# dim = 0 since we embed points
# inDim = 1 since target is a line
#
# from gmsh.py, calling signature:
# def embed(dim, tags, inDim, inTag): 
gmsh.model.mesh.embed(0, internal_tags,1, line_tag) 

# generate 1d mesh
# since lc is so large, it will only contain 
# start point end point, line and the embedded points
gmsh.model.mesh.generate(1)

gmsh.write("embedded_points_in_interval.msh")
gmsh.finalize()
Bort
  • 2,423
  • 14
  • 22
-1

I believe the only option is to divide the structure such that they feature your points and mesh the structure after that. Now you can apply your loads and conditions on the Physical Points or Physical Lines.

Example: if you have a cube you want to mesh. And boundary condition is on the plane in the centre, then divide the cube at that plane. Make the plane a Physical entity, I.e., Physical Surface(14) = {midplane number}.mesh it all and you are good to go!

agent18
  • 2,109
  • 4
  • 20
  • 34
  • Hi, I am not qualified to write a comment. I don't have enough points.The answer doesn't need a sample code... the idea stand by itself. To make a sample code would be too costly, especially based on his code example. I beleive the answer informs him sufficiently what to do! – agent18 Jul 07 '16 at 22:26