#!/bin/bash

# Make a connectivity directory
mkdir -p connectivity/

# Change to the connectivity directory
cd connectivity/

# Symbollically link required files
ln -sf ../meshes/grid.x
ln -sf ../meshes/grid.bc
ln -sf ../meshes/grid.b2b
ln -sf ../input/connectivity.yaml

# Set the number of OpenMP threads before running
OMP_NUM_THREADS_0=${OMP_NUM_THREADS}
export OMP_NUM_THREADS=8

# Run the connectivity executable by providing an 
# input file 'connectivity.yaml' and output
# the results to a file called connectivity.out
lavacurv.3D.NS1.AVX2 connectivity.yaml | tee connectivity.out

# Reset the number of OpenMP threads after running
export OMP_NUM_THREADS=${OMP_NUM_THREADS_0}

# Return to original directory
cd ../
