Source code for pyro.advection_nonuniform.problems.slotted
"""A circular profile with a rectangular slot cut out of it. This ismeant to be run with the velocity field that causes it to rotate aboutthe center, to understand how well we preserve symmetry."""importnumpyasnpfrompyro.utilimportmsgDEFAULT_INPUTS="inputs.slotted"PROBLEM_PARAMS={"slotted.omega":0.5,# angular velocity"slotted.offset":0.25}# offset of the slot center from domain center
[docs]definit_data(my_data,rp):""" initialize the slotted advection problem """ifrp.get_param("driver.verbose"):msg.bold("initializing the slotted advection problem...")offset=rp.get_param("slotted.offset")omega=rp.get_param("slotted.omega")myg=my_data.gridxctr_dens=0.5*(myg.xmin+myg.xmax)yctr_dens=0.5*(myg.ymin+myg.ymax)+offset# setting initial condition for densitydens=my_data.get_var("density")dens[:,:]=0.0R=0.15slot_width=0.05inside=(myg.x2d-xctr_dens)**2+(myg.y2d-yctr_dens)**2<R**2slot_x=np.logical_and(myg.x2d>(xctr_dens-slot_width*0.5),myg.x2d<(xctr_dens+slot_width*0.5))slot_y=np.logical_and(myg.y2d>(yctr_dens-R),myg.y2d<(yctr_dens))slot=np.logical_and(slot_x,slot_y)dens[inside]=1.0dens[slot]=0.0# setting initial condition for velocityu=my_data.get_var("x-velocity")v=my_data.get_var("y-velocity")u[:,:]=omega*(myg.y2d-xctr_dens)v[:,:]=-omega*(myg.x2d-(yctr_dens-offset))print("extrema: ",np.amax(u),np.amin(u))
[docs]deffinalize():""" print out any information to the user at the end of the run """