Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/elmerice/examples/Inverse_Methods/MassConservation/src/MakeMesh.sh
3206 views
1
#!/bin/bash
2
#########################################
3
# Bash script to generate the Elmer mesh
4
# from rectangle .geo
5
#
6
# INPUTS:
7
# - SRC_DIR: environment variable with the path to this directory
8
# - Arguments:
9
# - $1 : element size
10
# - $2 : output mesh name (.msh) (OPTIONAL)
11
#########################################
12
# check that there is one input argument
13
if [ -z "$1" ]
14
then
15
echo "No argument supplied"
16
echo "provide required mesh resolution as argument"
17
exit
18
fi
19
20
# argument is the required mesh resolution
21
res=$1
22
23
# if a second argument is present it is the gmsh mesh file
24
# default is rectangle.msh
25
if [ -z "$2" ]
26
then
27
output=rectangle.msh
28
else
29
output=$2
30
fi
31
32
# make gmsh mesh
33
gmsh -format msh2 -2 -setnumber lc $res $SRC_DIR/rectangle.geo -o $output
34
35
# convert to Elmer
36
ElmerGrid 14 2 $output -autoclean
37
38