[docs]defdisplay_simulation_params(kgrid:kWaveGrid,medium:kWaveMedium,elastic_code:bool):dt=kgrid.dtt_array_end=kgrid.t_array[0][-1]Nt=int(kgrid.Nt)k_size=kgrid.size# display time step informationlogging.log(logging.INFO,f" dt: {scale_SI(dt)[0]} s, t_end: {scale_SI(t_array_end)[0]}s, time steps: {Nt}")c_min,c_min_comp,c_min_shear=get_min_sound_speed(medium,elastic_code)# get suitable scaling factor_,scale,_,_=scale_SI(np.min(k_size[k_size!=0]))print_grid_size(kgrid,scale)print_max_supported_freq(kgrid,c_min)
[docs]defget_min_sound_speed(medium,is_elastic_code):# if using the elastic code,# get the minimum sound speeds (not including zero if set for the shear speed)ifnotis_elastic_code:c_min=np.min(medium.sound_speed)returnc_min,None,Noneelse:# pragma: no coverc_min_comp=np.min(medium.sound_speed_compression)c_min_shear=np.min(medium.sound_speed_shear[medium.sound_speed_shear!=0])returnNone,c_min_comp,c_min_shear
[docs]defprint_grid_size(kgrid,scale):k_size=kgrid.sizegrid_size_pts=[int(kgrid.Nx)]ifkgrid.dim>=2:grid_size_pts.append(int(kgrid.Ny))ifkgrid.dim==3:grid_size_pts.append(int(kgrid.Nz))ifkgrid.dim==1:grid_size_scale=[scale_SI(k_size[0])[0]]elifkgrid.dim==2:grid_size_scale=[k_size[0]*scale,k_size[1]*scale]elifkgrid.dim==3:grid_size_scale=[round(k_size[0]*scale,4),round(k_size[1]*scale,4),round(k_size[2]*scale,4)]else:raiseNotImplementedErrorgrid_size_str=" by ".join(map(str,grid_size_pts))grid_scale_str=" by ".join(map(str,grid_size_scale))# display grid sizelogging.log(logging.INFO,f" input grid size: {grid_size_str} grid points ({grid_scale_str}m)")
[docs]defprint_max_supported_freq(kgrid,c_min):# display the grid size and maximum supported frequencyk_max,k_max_all=kgrid.k_max,kgrid.k_max_alldefmax_freq_str(kfreq):scaled_num_str,_,_,_=scale_SI(kfreq*c_min/(2*np.pi))returnscaled_num_strifkgrid.dim==1:# display maximum supported frequencylogging.log(logging.INFO,f" maximum supported frequency: {max_freq_str(k_max_all)}Hz")elifkgrid.dim==2:# display maximum supported frequencyifk_max.x==k_max.y:logging.log(logging.INFO,f" maximum supported frequency: {max_freq_str(k_max_all)}Hz")else:logging.log(logging.INFO,f" maximum supported frequency: {max_freq_str(k_max.x)}Hz by {max_freq_str(k_max.y)}Hz")elifkgrid.dim==3:# display maximum supported frequencyifk_max.x==k_max.zandk_max.x==k_max.y:logging.log(logging.INFO,f" maximum supported frequency: {max_freq_str(k_max_all)}Hz")else:logging.log(logging.INFO,f" maximum supported frequency: {max_freq_str(k_max.x)}Hz by {max_freq_str(k_max.y)}Hz by {max_freq_str(k_max.z)}Hz",)