# GMSH: How can I extrude a surface in a non-linear way?

I am developing a model to represent a dam, shown in the picture below. The geometry in the white circle is the curtain, which is required to be curved. I extruded this 2D face (including the indicated by the cut white line) at a distance $$z_0$$ to the back, resulting in the shape in the red circle.

Given some constraints of the solver, I need the curve in red to be flat. As I understand it, this would imply to extrude the curve surface following some sort of function that would allow it to be flat by the end of the translation. I browsed in the documentation to find something likewise but I could not find it.

The only solution I thought of was based on this video; I extruded back the four vertices of the curve and then closed by hand the square in the back. The problem with this is that the mesh from the front is not extruded to the back, hence lacking 3D elements as well. For the sake of simplicity, the geometry is different from the previous model.

Do you know if what I want to do is possible in the software, and how can I get it?

As a general suggestion: you can use CAD software (such as FreeCAD) when your geometry starts to get more complex. Gmsh has some CAD capabilities but its main purpose is to create meshes from CAD models.

Regarding your particular problem, two options come to my mind using only Gmsh:

1. Extrude your surface as in your first model and then do a boolean operation (cut) to remove the extra bulging part.

2. Construct your solid with 6 different surfaces, 5 flat and 1 curved.

Following, I present a .geo file for the second option.

SetFactory("OpenCASCADE");

side = 1.0;
height = 1.0;

//// Points ////
Point(1) = {0, 0, 0, 1.0};
Point(2) = {2*side, 0, 0, 1.0};
Point(3) = {2*side, side, 0, 1.0};
Point(4) = {0, side, 0, 1.0};
Point(5) = {2*side - rad1, side/2, 0, 1.0};

Point(6) = {0, 0, height, 1.0};
Point(7) = {2*side, 0, height, 1.0};
Point(8) = {2*side, side, height, 1.0};
Point(9) = {0, side, height, 1.0};
Point(10) = {2*side - rad2, side/2, height, 1.0};

//// Lines ////

// Top
Line(1) = {1, 2};
Spline(2) = {3, 5, 2};
Line(3) = {3, 4};
Line(4) = {4, 1};

// Bottom
Line(5) = {6, 7};
Spline(6) = {8, 10, 7};
Line(7) = {8, 9};
Line(8) = {9, 6};

// Vertical
Line(9) = {1, 6};
Line(10) = {2, 7};
Line(11) = {3, 8};
Line(12) = {4, 9};

//// Surfaces ////
Curve Loop(1) = {1, -2, 3, 4};
Plane Surface(1) = {1};
Curve Loop(2) = {7, 8, 5, -6};
Plane Surface(2) = {2};
Curve Loop(3) = {9, 5, -10, -1};
Plane Surface(3) = {3};
Curve Loop(4) = {4, 9, -8, -12};
Plane Surface(4) = {4};
Curve Loop(5) = {3, 12, -7, -11};
Plane Surface(5) = {5};
Curve Loop(6) = {10, -6, -11, 2};
Surface(6) = {6};

//// Volume ////
Surface Loop(1) = {5, 1, 3, 4, 2, 6};
Volume(1) = {1};


When you mesh this geometry with a 0.1 size factor, you get the following mesh.

• Thank you. I am eager to do it in a more efficient way, however the tools developed by the team so far are quite specific regarding the configuration on the model to mesh (otherwise I would go for an easier path). Still I'll try to take advantage of your proposal. Commented Nov 1, 2022 at 19:41