Source code for pyro.burgers_viscous.problems.converge
"""Setup a smooth velocity field (each component is an exponential). This canbe used to test convergence of the solver."""importnumpyfrompyro.utilimportmsgDEFAULT_INPUTS="inputs.converge.64"
[docs]definit_data(my_data,rp):""" initialize the smooth burgers convergence problem """ifrp.get_param("driver.verbose"):msg.bold("initializing the smooth burgers convergence problem...")u=my_data.get_var("x-velocity")v=my_data.get_var("y-velocity")xmin=my_data.grid.xminxmax=my_data.grid.xmaxymin=my_data.grid.yminymax=my_data.grid.ymaxxctr=0.5*(xmin+xmax)yctr=0.5*(ymin+ymax)# A represents some magnitude that defines the initial u and v.A=0.05u[:,:]=A+A*numpy.exp(-50.0*((my_data.grid.x2d-xctr)**2+(my_data.grid.y2d-yctr)**2))v[:,:]=A+A*numpy.exp(-50.0*((my_data.grid.x2d-xctr)**2+(my_data.grid.y2d-yctr)**2))
[docs]deffinalize():""" print out any information to the user at the end of the run """