Skip to content
Snippets Groups Projects
grating3D_parallel_Mmatrix.sh 2.09 KiB
Newer Older
#!/bin/bash
export OPENBLAS_NUM_THREADS=1
export OMP_NUM_THREADS=1
Guillaume Demesy's avatar
Guillaume Demesy committed
export NPROC=96
Guillaume Demesy's avatar
Guillaume Demesy committed
# export nb_lam=1
# export nb_phi=1
export nb_lam=100
export nb_phi=59
Guillaume Demesy's avatar
up  
Guillaume Demesy committed
export lambda_min=400
export lambda_max=1600
Guillaume Demesy's avatar
Guillaume Demesy committed
export FLAG_TOTAL=0
Guillaume Demesy's avatar
Guillaume Demesy committed
export GRATING_CASE="half_ellipsoid"
Guillaume Demesy's avatar
Guillaume Demesy committed
export myDir="res_Matrix_nb_lam"$nb_lam"_nb_phi"$nb_phi"_total"$FLAG_TOTAL
Guillaume Demesy's avatar
Guillaume Demesy committed
gmsh grating3D.geo -setstring test_case $GRATING_CASE -3 -o grating3D.msh
Guillaume Demesy's avatar
Guillaume Demesy committed
    local mysubDir=$myDir/run_lam$1_phi$2_psi$3
Guillaume Demesy's avatar
Guillaume Demesy committed
    cp grating3D.msh grating3D.pro grating3D_data_$GRATING_CASE.geo grating3D_data.geo grating3D_materials.pro $mysubDir
Guillaume Demesy's avatar
Guillaume Demesy committed
    local lam=$(echo "scale=10;400+400/($nb_lam-1)*$1" | bc )
    local phi=$(echo "scale=10;360/($nb_phi)*$2" | bc )
    local psi=$(echo "scale=10;90*$3" | bc )
Guillaume Demesy's avatar
up  
Guillaume Demesy committed
    getdp grating3D.pro -pre helmholtz_vector -msh grating3D.msh -cal -pos postop_helmholtz_vector -petsc_prealloc 200 -setstring test_case $GRATING_CASE -setnumber lambda0 $lam -setnumber thetadeg 50 -setnumber phideg $phi -setnumber psideg $psi -setnumber FLAG_TOTAL $FLAG_TOTAL
Guillaume Demesy's avatar
Guillaume Demesy committed
    if [ $3 -eq 0 ]; then cp res3D/rs.txt ../r_pin_sout_lam$1_phi$2.out ; fi
    if [ $3 -eq 0 ]; then cp res3D/rp.txt ../r_pin_pout_lam$1_phi$2.out ; fi
    if [ $3 -eq 1 ]; then cp res3D/rs.txt ../r_sin_sout_lam$1_phi$2.out ; fi
    if [ $3 -eq 1 ]; then cp res3D/rp.txt ../r_sin_pout_lam$1_phi$2.out ; fi
Guillaume Demesy's avatar
up  
Guillaume Demesy committed
    if [ $3 -eq 0 ]; then cp res3D/ts.txt ../t_pin_sout_lam$1_phi$2.out ; fi
    if [ $3 -eq 0 ]; then cp res3D/tp.txt ../t_pin_pout_lam$1_phi$2.out ; fi
    if [ $3 -eq 1 ]; then cp res3D/ts.txt ../t_sin_sout_lam$1_phi$2.out ; fi
    if [ $3 -eq 1 ]; then cp res3D/tp.txt ../t_sin_pout_lam$1_phi$2.out ; fi
Guillaume Demesy's avatar
Guillaume Demesy committed
    cp res3D/eff_t1.txt ../eff_t1_lam$1_phi$2_psi$3.out
    cp res3D/eff_r1.txt ../eff_r1_lam$1_phi$2_psi$3.out
    cp res3D/eff_t2.txt ../eff_t2_lam$1_phi$2_psi$3.out
    cp res3D/eff_r2.txt ../eff_r2_lam$1_phi$2_psi$3.out
    cp res3D/temp-Q_scat.txt ../Q_scat_lam$1_phi$2_psi$3.out
Guillaume Demesy's avatar
Guillaume Demesy committed
    rm -r $mysubDir
Guillaume Demesy's avatar
Guillaume Demesy committed
parallel -j $NPROC myfunc ::: $(seq 0 $(($nb_lam-1))) ::: $(seq 0 $(($nb_phi-1))) ::: 0 1