Re: Solving convection only problem
Thanks for the reply. I searched more and just realized this question has been answered before. I then switched to VanLeerConvectionTerm, It turns out this method is able to keep the shock pretty well which has been mentioned in the previous posts. I might try CLAWPACK in the future, but I think the VanLeer terms is good for my project for now. Thanks again. Best, Zhekai On Thu, Oct 20, 2016 at 9:05 AM, Daniel Wheeler wrote: > Hi Zhekai, > > There is generally a lot of numerical diffusion when solving > convection problems with first order schemes and even some numerical > diffusion when using higher order schemes. There are many different > schemes and a mass of literature on how to preserve square waves, > shocks and hyperbolic equations, but FiPy doesn't have any of those > schemes implemented (e.g. TVD schemes come to mind). There is also a > secondary issue when coupling hyperbolic equations to do with how the > flux is calculated that FiPy doesn't address (the Riemann problem, roe > solvers etc). However, for many convection-diffusion problems the time > scale of the shocks is not worth resolving or is impossible to resolve > while also resolving much longer time scales. When resolving at the > convection time scale there is often no benefit from the implicit > schemes that FiPy uses. Basically, FiPy is not a great tool for shock > problems. CLAWPACK may be something that you could look at for this. I > think it's fully explicit and it's focus is on hyperbolic coupled > equations. > > I hope that helps. > > Cheers, > > Daniel > > On Thu, Oct 20, 2016 at 12:58 AM, Zhekai Deng > wrote: > > Hi all, > > > > I am trying to use Fipy to solve convection only problem for the > > concentration moved only by solid body rotation in a "circular" shape > > geometry. > > > > By looking at the examples online, I found out that > > > > http://www.ctcms.nist.gov/fipy/examples/convection/ > generated/examples.convection.source.html#module-examples. > convection.source > > > > and some of the level set example appears to allow me do it. > > > > I implemented the approach from convection example. However, the solution > > still looks has diffusion ( or maybe artificial smoothness ) as the > > concentration move with velocity field. I have attached my example code, > > that concentration enter from the top right side of the geometry, and > > undergo solid body rotation eventually to the left side, and flow out of > the > > domain. So my question is that is there any way to further reduce the > > diffusion? Also, does anyone know where this "diffusion" is coming from ? > > > > The approach that I have tried but did not work are following: > > 1. Solve the equation with very small diffusion coefficient (1e-8) > > 2. Reduce the timestep or refine the mesh size does not seem to help very > > much > > > > I have attached my example code in this email. Thank you very much. > > > > Best, > > > > Zhekai > > > > > > ___ > > fipy mailing list > > fipy@nist.gov > > http://www.ctcms.nist.gov/fipy > > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > > > > > > -- > Daniel Wheeler > ___ > 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 ]
RE: Question on time-marching scheme in Fipy
Hi Daniel, With regards to your answer: "It's fully implicit unless the user sets it up in a different way" Just to confirm what I understand from this and from your 2009 paper, alpha in FiPy is 1.0 by default, and so the fully implicit time-stepping scheme that's used is backward-Euler, correct? With best regards, - Ian -Original Message- From: fipy-boun...@nist.gov [mailto:fipy-boun...@nist.gov] On Behalf Of Daniel Wheeler Sent: 19 October 2016 16:26 To: Multiple recipients of list Subject: Re: Question on time-marching scheme in Fipy Sorry for the slow response, see answers below. On Mon, Oct 10, 2016 at 6:08 PM, Gopalakrishnan, Krishnakumar wrote: > > However, my questions are more general, to be executed when updateOld() is > called. > > · What’s the default implicit scheme in fipy? It's fully implicit unless the user sets it up in a different way. > · How does one go about implementing a specific 2nd order > time-stepping scheme such as (Adams-Bashforth, BDF etc.) We don't have any easy way to do higher order time stepping right now and I'm not aware of any attempts to do so. > · Is there any way to use the FVM only for the spatial > discretisation, i.e. use a method of lines approach for the time-stepping ? It might be possible with source terms, but I haven't tried. > I apologise if the questions sound too basic here. I am just curious about > understanding fipy’s default scheme and implementing an own time-stepper. It's a very good question, but I don't have any helpful answers. -- Daniel Wheeler ___ 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 ]
Re: Solving convection only problem
Hi Zhekai, There is generally a lot of numerical diffusion when solving convection problems with first order schemes and even some numerical diffusion when using higher order schemes. There are many different schemes and a mass of literature on how to preserve square waves, shocks and hyperbolic equations, but FiPy doesn't have any of those schemes implemented (e.g. TVD schemes come to mind). There is also a secondary issue when coupling hyperbolic equations to do with how the flux is calculated that FiPy doesn't address (the Riemann problem, roe solvers etc). However, for many convection-diffusion problems the time scale of the shocks is not worth resolving or is impossible to resolve while also resolving much longer time scales. When resolving at the convection time scale there is often no benefit from the implicit schemes that FiPy uses. Basically, FiPy is not a great tool for shock problems. CLAWPACK may be something that you could look at for this. I think it's fully explicit and it's focus is on hyperbolic coupled equations. I hope that helps. Cheers, Daniel On Thu, Oct 20, 2016 at 12:58 AM, Zhekai Deng wrote: > Hi all, > > I am trying to use Fipy to solve convection only problem for the > concentration moved only by solid body rotation in a "circular" shape > geometry. > > By looking at the examples online, I found out that > > http://www.ctcms.nist.gov/fipy/examples/convection/generated/examples.convection.source.html#module-examples.convection.source > > and some of the level set example appears to allow me do it. > > I implemented the approach from convection example. However, the solution > still looks has diffusion ( or maybe artificial smoothness ) as the > concentration move with velocity field. I have attached my example code, > that concentration enter from the top right side of the geometry, and > undergo solid body rotation eventually to the left side, and flow out of the > domain. So my question is that is there any way to further reduce the > diffusion? Also, does anyone know where this "diffusion" is coming from ? > > The approach that I have tried but did not work are following: > 1. Solve the equation with very small diffusion coefficient (1e-8) > 2. Reduce the timestep or refine the mesh size does not seem to help very > much > > I have attached my example code in this email. Thank you very much. > > Best, > > Zhekai > > > ___ > fipy mailing list > fipy@nist.gov > http://www.ctcms.nist.gov/fipy > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > -- Daniel Wheeler ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
sweep with more than one variable
Hello, Is it possible to express in a simple way the sweep method for more than one variable? More concretely, in a similar problem to the Stokes Cavity example I got an equation with DiffusionTerm both for the X velocity and the Y velocity (in the same equation, due to tensorial viscosity). However, following the SIMPLE algorithm procedure in the example, the sweep method is used, and this only seems to accept one variable per equation, How could I solve the Stokes Cavity an equation (actually, two) of this form?: mux = numerix.array( ((2.0, 0.), (0.0, 1.0)) ) ; muy = numerix.array( ((1.0, 0.), (0.0, 2.0)) ) ; muyx = numerix.array( ((0., 0.), (1.0, 0.)) ) ; muxy = numerix.array( ((0., 1.), (0., 0.)) ) ; eqn_ux = DiffusionTerm(coeff=mux,var=ux) + DiffusionTerm(coeff=muyx , var =uy) - p.grad.dot([1.,0.]) eqn_uy = DiffusionTerm(coeff=muy, var=uy) + DiffusionTerm(coeff=muxy , var =ux) - p.grad.dot([0.,1.]) thanks a lot Francisco Vega ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]