@@ -0,0 +1,1480 @@
+%22%22%22%0A  ---------------------------------------------------------------------%0A  Copyright (C) 2003, 2004  Michael Zingale%0A%0A  This software is distributed under the terms of the GNU General%0A  Public License, version 2.  See COPYING for details.  It is covered%0A  by no warantee whatsoever, explicit or implied.%0A  ---------------------------------------------------------------------%0A%22%22%22%0A%0A%0Aimport sys%0Afrom util import runparams%0Aimport mesh.patch as patch%0Aimport numpy%0A%0Adef fillPatch(myPatch):%0A    %22%22%22 initialize the tophat advection problem %22%22%22%0A%0A    print %22initializing the tophat advection problem...%22%0A%0A    # make sure that we are passed a valid patch object%0A    if not isinstance(myPatch, patch.ccData2d):%0A        print %22ERROR: patch invalid in tophat.py%22%0A        print myPatch.__class__%0A        sys.exit()%0A%0A    dens = myPatch.getVarPtr(%22density%22)%0A%0A    xmin = runparams.getParam(%22mesh.xmin%22)%0A    xmax = runparams.getParam(%22mesh.xmax%22)%0A%0A    ymin = runparams.getParam(%22mesh.ymin%22)%0A    ymax = runparams.getParam(%22mesh.ymax%22)%0A%0A    xctr = 0.5*(xmin + xmax)%0A    yctr = 0.5*(ymin + ymax)%0A    %0A    dens%5B:,:%5D = 0.0%0A%0A    i = myPatch.grid.ilo%0A    while i %3C= myPatch.grid.ihi:%0A%0A        j = myPatch.grid.jlo%0A        while j %3C= myPatch.grid.jhi:%0A%0A            if (numpy.sqrt((myPatch.grid.x%5Bi%5D-xctr)**2 + %0A                           (myPatch.grid.y%5Bj%5D-yctr)**2) %3C 0.1):%0A                dens%5Bi,j%5D = 1.0%0A                    %0A            j += 1%0A        i += 1%0A    %0A%0A    %0A                             %0A

add tophat