#!/bin/sh

# create input file from 1D computation for funkySetFields
mkdir 1d_profil
python3 -c "import fluidfoam; fluidfoam.create1dprofil('1D', '.', '300', 'Y', ['Ua', 'Ub', 'alpha_a', 'k', 'p_rbgh', 'omega'])"

# create the mesh
blockMesh

# create the intial time folder
cp -r 0_org 0

# Initialize the alpha field
funkySetFields -time 0

# Write the mesh in folder 0/
postProcess -func writeCellCentres -time 0
ln -s Cx 0/ccx
ln -s Cy 0/ccy
ln -s Cz 0/ccz

# Decompose the case in order to run in parallel (on 4 cores)
decomposePar

# Run sedFoam in parallel
mpirun -np 4 sedFoam_rbgh -parallel > log&
