TP2 : Insensitivity of computing time to geometric complexity

This practical work 2 contains input data to show computation time
insensitivity to geometry refinement of the boundary. The boundary
conditions are defined by a supershape and not a cylinder anymore.

Content

Binary tree

One must used the binary tree created in TP1. If not created, do exercise 1 in TP1/run.sh.

Geometry

The geometry format are .obj files supershapes, all created with the library
star-3dut

In the following exercise we assume that radforce-combustion is properly
installed and registered on your current shell by running

source ../local/etc/profile

Part 1 : Introduction to complex geometries

The aim is to perform a calculation in complex geometry, where the photons
will be tracked using the Monte Carlo method. Users can familiarise
themselves with visualising the various supershapes. Run the following
command in Paraview to visualise them and see the effect of geometric
refinement:

paraview ./data/geometry/supershape*

Part 2 : First calculation with a complex geometry

In the following, the radiative quantity will be a flux density averaged over
the entire geometry of the supershape. To achieve this, the version of
radforce-combustion must be modified compared to TP1 calling
'fmc_compute_mean_flux_lw' instead of 'fmc_compute_radiance_lw':

cd ..
sed -i '213c\  integrator.integrand = &fmc_compute_mean_flux_lw;' \
    ./src/fmc.c

To estimate the average flux density over the geometry, position are sampled
uniformly on it and the photons are then tracked through the medium. We
propose to visualise these paths using the path.out file, which stores this
data. For this file to be written correctly, radforce_combustion must be run
on a single core:

sed -i '106c\  smc_args.nthreads_hint = 1;' \
    ./src/fmc.c
make
cd TP2

It is then possible to run the code to calculate the radiative flux density
averaged over the supershape consisting of 10,000 triangles. Only 200 Monte
Carlo simulations are carried out to display 200 paths within the geometry.

../fmc -n 200 -s lw=300,9999 \
       -m ../TP1/data/spectroscopic_data/2species_iso_0_10000.out \
       -C ../TP1/CO2_lorentz_0_10000_iso.sav \
       -H ../TP1/H2O_lorentz_0_10000_iso.sav \
       -g ./data/geometry/supershape_10000.obj \
       -vvv

The txt file containing the path data (path.out) is converted into an obj
file using the dat2obj script provided in order to be plotted with Paraview:

python3 data/script/dat2obj.py path.out

To display the paths in the supershape using Paraview, there are several
“reader” options. You need to select "Wavefront OBJ":

paraview path.out.obj data/geometry/supershape_10000.obj

Part 3 : Computation time insensitivity to the geometry refinement

The idea is to observe that, for an increasing number of triangles making up
the same complex geometry, the computation time remains constant (or nearly
constant) when performing a line-by-line calculation in 3D. To do this, the
radforce-combustion program is run for each of the supershapes defined in the
list:

files=( "data/geometry/supershape_1000.obj" \
        "data/geometry/supershape_10000.obj" \
        "data/geometry/supershape_100000.obj" \
        "data/geometry/supershape_1e6.obj")

Starting with the supershape with a number of triangles:

number_triangles=1000

radforce_combustion is executed for each supershape with a large number of
Monte Carlo realizations. Results are printed in
'monte_carlo_mean_fluxes.txt'.

for file in "${files[@]}"
do
  echo "Computing for $number_triangles triangles"
  ../fmc -n 40000 -s lw=300,9999 \
         -m ../TP1/data/spectroscopic_data/2species_iso_0_10000.out \
         -C ../TP1/CO2_lorentz_0_10000_iso.sav \
         -H ../TP1/H2O_lorentz_0_10000_iso.sav \
         -d $number_triangles  -g $file \
         >> monte_carlo_mean_fluxes.txt
  number_triangles=$((number_triangles * 10))
done

The file 'monte_carlo_mean_fluxes.txt' stores per lines the number of
triangles, the observable values and its uncertainty as well as the mean time
per path and its uncertainty. Based on these values, one can plot the time
required to estimate the mean flux density at a precision of 1%:

{
  echo "set grid"
  echo "set logscale x"
  echo "set key left top box"
  echo "set xrange[800:2e6]"
  echo "set yrange[0:0.4]"
  echo "set ylabel 'Computation time (s) for 1\% precision on the mean density flux'"
  echo "set xlabel 'Number of triangles'"
  echo "set key box opaque"
  echo "plot 'monte_carlo_mean_fluxes.txt' u \
  1:(\$4)*40000*(\$3/(\$2*0.01))*(\$3/(\$2*0.01)) \ 
  lt rgb 'blue' pt 7 ps 0.7 notitle "
  echo "pause -1"
} > plotting.gp
gnuplot plotting.gp