Skip to content

Commit

Permalink
fixed the batch processing for angle-frequency scan
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipDominec committed Oct 11, 2017
1 parent cdf0a04 commit 0b74380
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 6 additions & 2 deletions example_angle_frequency_scan/angle-frequency-scan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,26 @@ if [ -z $ext ] ; then ext=png ; fi # number of processors
if [ -z "$model" ] ; then model=HalfSpace ; fi

## TODO why this is not used in simulation?
staticpar=(model=$model simtime=50f resolution=25n padding=2.5u) ## default for the flat air-metal interfaces
staticpar=(model=$model simtime=25f resolution=150n padding=2.5u resolution=150n) ## default for the flat air-metal interfaces


if [ -z "$skipsimulation" ]; then
## For normal optical simulations
#for K in 0.1 0.3 ; do #`seq 0 2 9` `seq 12 6 60`; do ## transverse wavenumber in 1/um
for K in 0.1 0.3 `seq 0 2 9` `seq 12 6 60`; do ## transverse wavenumber in 1/um
#mpirun -np $NP ../../scatter.py "${@}" $Kcomponent=${K}e6
mpirun -np $NP ../../scatter.py "${staticpar}" $Kcomponent=${K}e6
#echo "${staticpar[@]}"
mpirun -np $NP ../../scatter.py "${staticpar[@]}" $Kcomponent=${K}e6
done
## For deep-UV gratings
#for K in 0.1 0.3 `seq 0 2 9` `seq 12 6 60`; do ## transverse wavenumber in 1/um
#mpirun -np $NP ../../scatter.py "${@}" $Kcomponent=${K}e7
#done
fi

exit
exit()

## Resolve the angle of incidence from the magnitude of the wavevector and its transverse component and plot
rm last_simulation_name.dat
plotoptions=(*.dat --xlabel 'Frequency' \
Expand Down
7 changes: 4 additions & 3 deletions meep_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,11 +860,12 @@ def diagnostic_plot(x, values_and_labels=(), plotmodulus=False, ylog=True, title
plotmin = None
for value, label in values_and_labels:
plt.plot(x, np.abs(value) if plotmodulus else value, label=label)
if plotmin==None or plotmin > np.min(value):
plotmin = max(np.min(np.abs(value)), np.max(np.abs(value))/1e10)
if len(value)>0:
if plotmin==None or plotmin > np.min(value):
plotmin = max(np.min(np.abs(value)), np.max(np.abs(value))/1e10)
plt.legend(prop={'size':10}, loc='lower left')
plt.xlabel(xlabel); plt.ylabel(ylabel); plt.title(title)
if ylog and len(values_and_labels)>0:
if ylog and plotmin is not None:
plt.yscale("log")
plt.ylim(bottom=plotmin) ## ensure reasonable extent of values of 10 orders of magnitude
plt.savefig("%s.png" % title, bbox_inches='tight')
Expand Down

0 comments on commit 0b74380

Please sign in to comment.