**Name of the source code file:**`ExtrudeMesh.c`

- This page is about extrusion external to Elmer. For internal extrusion, see the Structured Mesh page

Extrusion and optionally interpolation using a DEM (Digital Elevation Model) of a 2-dimensional footprint mesh into a 3-dimensional. The numbering of boundaries is according to the footprint with an offset introduced by all new boundaries on the bedrock (lowest numbers) and the free surface. If interpolation using DEM's is applied, the resulting interpolated free surface should have an unique projection to the interpolation surface of the bedrock. This is equal to the condition that angles of slopes with respect to the X-Y plane have to be below 90 degrees, else negative volumes will result from an extrusion.

Usually cc stands for the system C-compiler. If not so, please, replace with the corresponding command of your system.

cc ExtrudeMesh.c -o ExtrudeMesh -lm

Some C-compilers have the math library included automatically, some (gcc, for instance) needs it to have explicitly linked using `-lm`

.

ExtrudeMesh

displays information on options if no arguments are given.

ExtrudeMesh inputdir outputdir levels extrudedepth N baseline Gl percentage ratio

`inputdir` | path of 2D ElmerSolver mesh directory that shall be extruded |

`outputdir` | path of 3D ElmerSolver mesh directory that shall be created. If the directory does not exist, it will be created. If it exists, files will be overwritten |

`levels` | number of vertical levels for extrusion |

`extrudedepth` | in case of no DEM given, it is the constant depth of extrusion (added to the z-coordinate of the input surface mesh. If a DEM is given, it is the lowest extrusion depth (i.e., coordinates at the free surface with a difference between the free surface and the bedrock of less than this value will be corrected to comply with this threshold |

`N` | number of partitions (1 for a serial mesh) in the input mesh (and consequently also in the output mesh). If no input mesh with `N` partitions is found, the program stops execution. WARNING: the algorithm for extrusion of partitioned meshes is largely untested. Preferably, stick to serial extrusion (`N=1` ) and do a partitioning using ElmerGrid thereafter |

`baseline` | 1 if the existing side boundary for footprint (point/line in 2d/3d) shall be included (by default not) |

`GL` | number of layers inside boundary layer has to be smaller than `levels` ; give 0, if no boundary layer wanted |

`percentage` | percentage height of boundary layer with respect to the local height (as 0..1) if positive BL at bottom, if negative at the surface |

`ratio` | ratio between two adjacent layers in boundary layer(>1) has to be >1, if it's 0 automatical calculation, but does not work always |

ExtrudeMesh inputdir outputdir levels extrudedepth N GL percentage ratio DEM cutoff wexp noval

`DEM` | path of the DEM directory, which should contain two files, surf.xyz and bed.xyz The contents of both files are an arbitrary amount of rows, each row containing the X, Y and Z coordinate (separated by at least one space) of the interpolation point. The points do not have to coincide between the surface and the bedrock DEM and they can be randomly scattered. It is important that the whole area of the footprint mesh in `inputdir` is covered by interpolation points, as else the terrain will be extrapolated, which can lead to errors |

`cutoff` | the interpolation uses a `1/r^m` weighting method (with r denoting the distance of the mesh point to the interpolation point in the X-Y plane). The value `cutoff` denotes the maximal value of `r` to be taken into account (i.e., points further away will not be considered for interpolation). |

`wexp` | is the exponent `m` in the weighting factor `1/r^m` |

`noval` | is the value representing invalid data entries in the DEM's (lines will be omitted) |