"""Generate the pyro logo! The word "pyro" is written in the centerof the domain and perturbations are placed in the 4 corners to driveconverging shocks inward to scramble the logo."""importmatplotlib.pyplotaspltimportnumpyasnpfrompyro.utilimportmsgDEFAULT_INPUTS="inputs.logo"PROBLEM_PARAMS={}
[docs]definit_data(my_data,rp):""" initialize the logo problem """ifrp.get_param("driver.verbose"):msg.bold("initializing the logo problem...")# create the logomyg=my_data.gridfig=plt.figure(2,(0.64,0.64),dpi=100*myg.nx/64)fig.add_subplot(111)fig.text(0.5,0.5,"pyro",transform=fig.transFigure,fontsize="16",horizontalalignment="center",verticalalignment="center")plt.axis("off")fig.canvas.draw()data=np.fromstring(fig.canvas.tostring_rgb(),dtype=np.uint8,sep='')data=data.reshape(fig.canvas.get_width_height()[::-1]+(3,))logo=np.rot90(np.rot90(np.rot90((256-data[:,:,1])/255.0)))# get the density, momenta, and energy as separate variablesdens=my_data.get_var("density")xmom=my_data.get_var("x-momentum")ymom=my_data.get_var("y-momentum")ener=my_data.get_var("energy")myg=my_data.grid# initialize the components, remember, that ener here is rho*eint# + 0.5*rho*v**2, where eint is the specific internal energy# (erg/g)dens[:,:]=1.0xmom[:,:]=0.0ymom[:,:]=0.0# set the density in the logo zones to be really largelogo_dens=50.0dens.v()[:,:]=logo[:,:]*logo_dens# pressure equilibriumgamma=rp.get_param("eos.gamma")p_ambient=1.e-5ener[:,:]=p_ambient/(gamma-1.0)# explosionener[myg.ilo,myg.jlo]=1.0ener[myg.ilo,myg.jhi]=1.0ener[myg.ihi,myg.jlo]=1.0ener[myg.ihi,myg.jhi]=1.0
[docs]deffinalize():""" print out any information to the user at the end of the run """print(""" The script analysis/sedov_compare.py can be used to analyze these results. That will perform an average at constant radius and compare the radial profiles to the exact solution. Sample exact data is provided as analysis/cylindrical-sedov.out """)