Re: solving navier-stokes equation in semicircle
Tanya, For a lid driven cavity example, see https://gitorious.org/microchanit/microchanit/blobs/master/patch/patchfipyrev5303.diff and search for examples/flow/lidDrivenCavity.py On a rectangular mesh though. In current fipy is it slower than it was originally though, and result at end is somewhat off again. But it works :-) For a semicircle mesh, create your own mesh type in fipy, so create a patch as I did for this microchanit project, to add the mesh you want. Or create it in your project. Benny 2012/12/3 Tanya Gornak err...@gmail.com Hello, I want to solve lid driven cavity problem in a semicircle. My problem is that I need a Cartesian mesh, therefore I can not use GMSH to create my geometry. How can I create a Cartesian mesh for semicircle for FiPy? Thanks in advance. -- Best regards, Tatjana ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Will FiPy objects misbehave if not in the __main__ namespace?
Dear List, I have a FiPy model of the following form: from fipy import Grid1D, CellVariable from fipy import TransientTerm, DiffusionTerm from fipy.tools.numerix import linspace, zeros cs = ('a','b',) class Toy: def __init__(self): self.L = 1.0 self.nx = 10 self.dx = self.L/self.nx self.m = Grid1D(dx=self.dx,nx=self.nx) for v in cs: c = CellVariable(self.m, name=v, hasOld=1) setattr(self,v,c) def setInitial(self): self.a.setValue(linspace(1,7,self.nx)) self.b.setValue(1) def evaluate(self,o): self.setInitial() a = self.a b = self.b D = -0.4 * b v = o[0] * a/(1+a) w = o[1] * b/(1+b) e = TransientTerm() + DiffusionTerm(D) == v - w zs = 10 du = 0.1 err = 10**-6 res = zeros((zs,self.nx)) for z in range(zs): r = 10**3 res[z] = b.getValue() while r err: r = min(r, e.sweep(b,dt=du)) b.updateOld() return res if __name__ == __main__: t = Toy() o = [1.,1.] print t.evaluate(o) This is a stripped down version of the problem I'm solving. In reality I have twelve PDEs and some hairy non-linear source terms. I've had problems when I converted my script version, i.e. not classes of my own, to a version where my problem is neatly packaged into a class and all instances of CellVariables etc. are local to some method. My question is: will this confuse FiPy or not? What I mean is: will all variables be updated as they should be after each iteration of sweep updateOld? Thanks in advance, Lafras ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Re: solving navier-stokes equation in semicircle
On 4 December 2012 16:42, Jonathan Guyer gu...@nist.gov wrote: On Dec 3, 2012, at 12:23 PM, Tanya Gornak wrote: How can I create a Cartesian mesh for semicircle for FiPy? I'm not even sure what that means. You want square cells? Yes. What should the cells look like at the semicircle boundary? Semicircle boundary is build using approximation of curved boundary with square cell (see attached picture). Why do you need a Cartesian mesh? If you want to know the values on a Cartesian grid, you can solve on a triangular mesh and then use the var(points) syntax to interpolate the values. No, this would not work for me. I need Cartesian mesh, because I want to test new method for solving pressure correction equation, and it works only on Cartesian mesh. ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] -- Sincerely yours, Tatiana Gornak attachment: circle_cartesian.png___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Re: solving navier-stokes equation in semicircle
On Tue, Dec 4, 2012 at 12:38 PM, Tanya Gornak err...@gmail.com wrote: No, this would not work for me. I need Cartesian mesh, because I want to test new method for solving pressure correction equation, and it works only on Cartesian mesh. Tanya, It might be better to use one of the standard grid classes and then use source terms to blank out exterior cells. Seems much easier to me at least to get something working. Worry about optimizing it later. Cheers -- Daniel Wheeler ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]