Re: solvers for elliptic equations with dominant lower order terms
For anyone else who finds this thread with google. A couple of points that helped me get over the issues I was having: 1. Of the non-trilinos solvers, scipy was most robust in solving problems where the advective terms locally dominated over diffusive terms. (I could not get trilinos to run). 2. I found that decomposing the domains into squares was more robust than decomposing it into triangles. This may be because I was computing the coefficients of equations with the gradient and divergence operators in fipy. 3. However, *BY FAR *the most important thing I had to get right was making sure the spatial variation in the coefficients was well resolved by the grid/mesh. All of the things you learned when writing your own codes remains true when using someone else's black box solver If your problem is not well resolved, your solver will do something weird or fail. In my case I had issues with steep topography in some small parts of the in the realistic oceanographic problem I was solving; this will be familiar to ocean modelers. I blame the glaciers that carved the Laurentian Channel for my problems... To find problem areas, I found it useful to add a transient term to the equation (making, essentially, a heat equation) and solving it in time with a simplified boundary condition of 1 on the boundaries and starting with zero in the interior. As the solution evolved, it became easy to spot trouble areas, since the "true" solution should stay bounded between 0 and 1 and should approach a steady solution of 1 everywhere eventually (as long as diffusion exists everywhere; if this is not true your problem may be under-constrained and certainly will be hard to solve). Where the solution starts becoming >>1 or << 0 are good places to start thinking about... especially if those locations are right next to each other. It is also reassuring if the solution to the transient problem converges to the steady solution in time. Jamie (p.s. how to solve the above heat equation problem with a BC of eta=1 on all boundaries at the long time limit? Note that 1 is a solution of the original elliptic equation above (as is any constant), and that it meets the boundary condition. The elliptic equation is the steady state of the corresponding heat equation. Thus 1 is a solution to the problem at the limit of long time.) On Thu, Jun 1, 2017 at 8:34 PM, Guyer, Jonathan E. Dr. (Fed) < jonathan.gu...@nist.gov> wrote: > Unfortunately, James notified me offline of a breakage in PyTrilinos on > Macs. I need to find time to debug. > > - Jon > > > On Jun 1, 2017, at 11:37 AM, Daniel Wheeler > wrote: > > > > Hi James, > > > > I don't have any hints for preconditioners, but using Trilinos's GMRES > > and then systematically changing the GMRES parameters and > > preconditioners might help you find one that works. I have done this > > in the past, for example, > > > > https://urldefense.proofpoint.com/v2/url?u=https-3A__gist. > github.com_wd15_c28ab796cb3d9781482b01fb67a7ec2d-23file- > 2Dunsegregatedequation-2Dpy-2DL187&d=DwICAg&c=c6MrceVCY5m5A_KAUkrdoA&r= > 7HJI3EH6RqKWf16fbYIYKw&m=GzwUdgPQ01r5uE6757k5b_5G60EzT_ebxic5VzxCPLw&s= > ecDSV0HowRiX7RxqKQIM8k2pN6MWtkHeJVE0FsRUHKA&e= > > > > You can also get information about how well the solver is converging. > > > > Cheers, > > > > Daniel > > > > On Wed, May 31, 2017 at 3:31 PM, James Pringle wrote: > >> > >> Dear all -- > >> > >> I need to solve a second order PDE in 2D of the form > >> > >> A(x,y)*(eta_xx+eta_yy)+B(x,y)*eta_x+C(x,y)*eta_y = 0 > >> > >> This is an advective diffusive balance, with B and C representing the > >> advective velocities. > >> > >> > >> Over much of the domain the low order terms dominate. For some > geometries, > >> the default solver I am using (SciPy LinearLUSolver) is having trouble > find > >> an answer (especially when the characteristics defined by B and C form > >> loops. > >> > >> Does anyone have recommendations for how to choose a better solver? (I > have > >> blindly tried all the ones in SciPy, the ones besides LinearLUSolver do > >> worse). > >> > >> And are there any hints on how to use preconditioners? There is > discussion > >> of preconditioners and Trilinnos, but I can't find hints on how one > would > >> choose to use them and when they might help. > >> > >> Pointers to the broader literature are welcome! > >> > >> Thank you, > >> Jamie Pringle > >> > >> ___ > >> fipy mailing list > >> fipy@nist.gov > >> https://urldefense.proofpoint.com/v2/url?u=http-3A__www. > ctcms.nist.gov_fipy&d=DwICAg&c=c6MrceVCY5m5A_KAUkrdoA&r= > 7HJI3EH6RqKWf16fbYIYKw&m=GzwUdgPQ01r5uE6757k5b_5G60EzT_ > ebxic5VzxCPLw&s=FwlQdDjrMNL-fZozgCzuozW7l47NnT1W-2UfJvEgSsg&e= > >> [ NIST internal ONLY: https://urldefense.proofpoint. > com/v2/url?u=https-3A__email.nist.gov_mailman_listinfo_ > fipy&d=DwICAg&c=c6MrceVCY5m5A_KAUkrdoA&r=7HJI3EH6RqKWf16fbYIYKw&m= > GzwUdgPQ01r5uE6757k5b_5G60E
Re: solvers for elliptic equations with dominant lower order terms
Unfortunately, James notified me offline of a breakage in PyTrilinos on Macs. I need to find time to debug. - Jon > On Jun 1, 2017, at 11:37 AM, Daniel Wheeler wrote: > > Hi James, > > I don't have any hints for preconditioners, but using Trilinos's GMRES > and then systematically changing the GMRES parameters and > preconditioners might help you find one that works. I have done this > in the past, for example, > > > https://gist.github.com/wd15/c28ab796cb3d9781482b01fb67a7ec2d#file-unsegregatedequation-py-L187 > > You can also get information about how well the solver is converging. > > Cheers, > > Daniel > > On Wed, May 31, 2017 at 3:31 PM, James Pringle wrote: >> >> Dear all -- >> >> I need to solve a second order PDE in 2D of the form >> >> A(x,y)*(eta_xx+eta_yy)+B(x,y)*eta_x+C(x,y)*eta_y = 0 >> >> This is an advective diffusive balance, with B and C representing the >> advective velocities. >> >> >> Over much of the domain the low order terms dominate. For some geometries, >> the default solver I am using (SciPy LinearLUSolver) is having trouble find >> an answer (especially when the characteristics defined by B and C form >> loops. >> >> Does anyone have recommendations for how to choose a better solver? (I have >> blindly tried all the ones in SciPy, the ones besides LinearLUSolver do >> worse). >> >> And are there any hints on how to use preconditioners? There is discussion >> of preconditioners and Trilinnos, but I can't find hints on how one would >> choose to use them and when they might help. >> >> Pointers to the broader literature are welcome! >> >> Thank you, >> Jamie Pringle >> >> ___ >> 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: solvers for elliptic equations with dominant lower order terms
James, can you perhaps send the FipY code for one of these equations, or a similar variant of it? Thanks! Sergio Sergio Manzetti [ http://www.fjordforsk.no/logo_hr2.jpg ] [ http://www.fjordforsk.no/ | Fjordforsk AS ] [ http://www.fjordforsk.no/ | ] Midtun 6894 Vangsnes Norge Org.nr. 911 659 654 Tlf: +47 57695621 [ http://www.oekolab.com/ | Økolab ] | [ http://www.nanofact.no/ | Nanofactory ] | [ http://www.aq-lab.no/ | AQ-Lab ] | [ http://www.phap.no/ | FAP ] From: "James Pringle" To: "fipy" Sent: Wednesday, May 31, 2017 10:50:11 PM Subject: Re: solvers for elliptic equations with dominant lower order terms I may have been unclear. This is a single PDE in the variable eta. A(x,y), B(x,y) and C(x,y) are coefficients of the PDE. They are indeed separate, and fipy does a nice job of solving this sort of equation in many limits. I am having problems when the lower order parts of the equation ( B(x,y)* eta_x+C(x,y)*eta_y) dominate the solution and the characteristics defined by B and C form closed loops. To understand this better, imagine the equation as a steady state fluid flow problem, with the A(x,y)*(eta_xx+eta_yy) representing diffusion (and to be correct, it should be written "Del . (A(x,y) Grad eta)"), and the low order terms representing advection, with B and C being the velocities doing the advection. When the diffusion is negligible, eta should be constant along the flow lines (characteristics) defined by B and C. But if those flow line form a closed loop, the diffusive term must determine the overall solution inside the loop... Thanks, Jamie On Wed, May 31, 2017 at 3:32 PM, Sergio Manzetti < [ mailto:sergio.manze...@fjordforsk.no | sergio.manze...@fjordforsk.no ] > wrote: James, are A(x,y), B(x,y) and C(x,y) three different variable functions for the PDE? FIPY can solve at least when these three are equal. If it solves when they differ, I am not sure. Sergio Sergio Manzetti [ https://urldefense.proofpoint.com/v2/url?u=http-3A__www.fjordforsk.no_logo-5Fhr2.jpg&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=7HJI3EH6RqKWf16fbYIYKw&m=INzNz0EhAfOz2J4uGWxrKjo-qBQYnUHjXOF9rSxEXTQ&s=U0xwV0Da6Bipu3Yzfcw9cPhJIwPF4QPA_zdG-Gms5uc&e= ] [ https://urldefense.proofpoint.com/v2/url?u=http-3A__www.fjordforsk.no&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=7HJI3EH6RqKWf16fbYIYKw&m=INzNz0EhAfOz2J4uGWxrKjo-qBQYnUHjXOF9rSxEXTQ&s=U6qdDuDFx7m_FBcXq8wrKgktDC12I3ar-kaEGfdQ4kA&e= | Fjordforsk AS ] [ https://urldefense.proofpoint.com/v2/url?u=http-3A__www.fjordforsk.no&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=7HJI3EH6RqKWf16fbYIYKw&m=INzNz0EhAfOz2J4uGWxrKjo-qBQYnUHjXOF9rSxEXTQ&s=U6qdDuDFx7m_FBcXq8wrKgktDC12I3ar-kaEGfdQ4kA&e= | ] Midtun 6894 Vangsnes Norge Org.nr. 911 659 654 Tlf: [ tel:+47%2057%2069%2056%2021 | +47 57695621 ] [ https://urldefense.proofpoint.com/v2/url?u=http-3A__www.oekolab.com&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=7HJI3EH6RqKWf16fbYIYKw&m=INzNz0EhAfOz2J4uGWxrKjo-qBQYnUHjXOF9rSxEXTQ&s=K6jUoxb_DR3t0-8jNTHjwDpAu7N5bdMUKatMC-pun-U&e= | Økolab ] | [ https://urldefense.proofpoint.com/v2/url?u=http-3A__www.nanofact.no&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=7HJI3EH6RqKWf16fbYIYKw&m=INzNz0EhAfOz2J4uGWxrKjo-qBQYnUHjXOF9rSxEXTQ&s=i8VNBHNUWx6dxM6qgwo0hBV4EVmqK-NBY5bRDJBmfAM&e= | Nanofactory ] | [ https://urldefense.proofpoint.com/v2/url?u=http-3A__www.aq-2Dlab.no&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=7HJI3EH6RqKWf16fbYIYKw&m=INzNz0EhAfOz2J4uGWxrKjo-qBQYnUHjXOF9rSxEXTQ&s=i8G56fQKIsGv9dk8ev8ozkaCLIsd-LOEHrqpX9cY5yI&e= | AQ-Lab ] | [ https://urldefense.proofpoint.com/v2/url?u=http-3A__www.phap.no&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=7HJI3EH6RqKWf16fbYIYKw&m=INzNz0EhAfOz2J4uGWxrKjo-qBQYnUHjXOF9rSxEXTQ&s=m0sz0QVLjdTnHTiVYdJ0GZj1VHf1oMsqyQyjdWiq-_o&e= | FAP ] From: "James Pringle" < [ mailto:jprin...@unh.edu | jprin...@unh.edu ] > To: "fipy" < [ mailto:fipy@nist.gov | fipy@nist.gov ] > Sent: Wednesday, May 31, 2017 9:31:51 PM Subject: solvers for elliptic equations with dominant lower order terms Dear all -- I need to solve a second order PDE in 2D of the form BQ_BEGIN A(x,y)*(eta_xx+eta_yy)+B(x,y)*eta_x+C(x,y)*eta_y = 0 This is an advective diffusive balance, with B and C representing the advective velocities. BQ_BEGIN BQ_END Over much of the domain the low order terms dominate. For some geometries, the default solver I am using (SciPy LinearLUSolver) is having trouble find an answer (especially when the characteristics defined by B and C form loops . Does anyone have recommendations for how to choose a better solver? (I have blindly tried all the ones in SciPy, the ones besides LinearLUSolver do worse). And are there any hints on how to use preconditioners? There is discussion of preconditioner
Re: solvers for elliptic equations with dominant lower order terms
Hi James, I don't have any hints for preconditioners, but using Trilinos's GMRES and then systematically changing the GMRES parameters and preconditioners might help you find one that works. I have done this in the past, for example, https://gist.github.com/wd15/c28ab796cb3d9781482b01fb67a7ec2d#file-unsegregatedequation-py-L187 You can also get information about how well the solver is converging. Cheers, Daniel On Wed, May 31, 2017 at 3:31 PM, James Pringle wrote: > > Dear all -- > > I need to solve a second order PDE in 2D of the form > > A(x,y)*(eta_xx+eta_yy)+B(x,y)*eta_x+C(x,y)*eta_y = 0 > > This is an advective diffusive balance, with B and C representing the > advective velocities. > > > Over much of the domain the low order terms dominate. For some geometries, > the default solver I am using (SciPy LinearLUSolver) is having trouble find > an answer (especially when the characteristics defined by B and C form > loops. > > Does anyone have recommendations for how to choose a better solver? (I have > blindly tried all the ones in SciPy, the ones besides LinearLUSolver do > worse). > > And are there any hints on how to use preconditioners? There is discussion > of preconditioners and Trilinnos, but I can't find hints on how one would > choose to use them and when they might help. > > Pointers to the broader literature are welcome! > > Thank you, > Jamie Pringle > > ___ > 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 ]
Re: solvers for elliptic equations with dominant lower order terms
I may have been unclear. This is a single PDE in the variable eta. A(x,y), B(x,y) and C(x,y) are coefficients of the PDE. They are indeed separate, and fipy does a nice job of solving this sort of equation in many limits. I am having problems when the lower order parts of the equation (B(x,y)*eta_x+C(x,y)*eta_y) dominate the solution and the characteristics defined by B and C form closed loops. To understand this better, imagine the equation as a steady state fluid flow problem, with the A(x,y)*(eta_xx+eta_yy) representing diffusion (and to be correct, it should be written "Del . (A(x,y) Grad eta)"), and the low order terms representing advection, with B and C being the velocities doing the advection. When the diffusion is negligible, eta should be constant along the flow lines (characteristics) defined by B and C. But if those flow line form a closed loop, the diffusive term must determine the overall solution inside the loop... Thanks, Jamie On Wed, May 31, 2017 at 3:32 PM, Sergio Manzetti < sergio.manze...@fjordforsk.no> wrote: > James, are A(x,y), B(x,y) and C(x,y) three different variable functions > for the PDE? > > FIPY can solve at least when these three are equal. If it solves when they > differ, I am not sure. > > Sergio > > > Sergio Manzetti > > > <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.fjordforsk.no_logo-5Fhr2.jpg&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=7HJI3EH6RqKWf16fbYIYKw&m=INzNz0EhAfOz2J4uGWxrKjo-qBQYnUHjXOF9rSxEXTQ&s=U0xwV0Da6Bipu3Yzfcw9cPhJIwPF4QPA_zdG-Gms5uc&e=> > > Fjordforsk AS > <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.fjordforsk.no&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=7HJI3EH6RqKWf16fbYIYKw&m=INzNz0EhAfOz2J4uGWxrKjo-qBQYnUHjXOF9rSxEXTQ&s=U6qdDuDFx7m_FBcXq8wrKgktDC12I3ar-kaEGfdQ4kA&e=> > > <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.fjordforsk.no&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=7HJI3EH6RqKWf16fbYIYKw&m=INzNz0EhAfOz2J4uGWxrKjo-qBQYnUHjXOF9rSxEXTQ&s=U6qdDuDFx7m_FBcXq8wrKgktDC12I3ar-kaEGfdQ4kA&e=> > Midtun > 6894 Vangsnes > Norge > Org.nr. 911 659 654 > Tlf: +47 57695621 <+47%2057%2069%2056%2021> > Økolab > <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.oekolab.com&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=7HJI3EH6RqKWf16fbYIYKw&m=INzNz0EhAfOz2J4uGWxrKjo-qBQYnUHjXOF9rSxEXTQ&s=K6jUoxb_DR3t0-8jNTHjwDpAu7N5bdMUKatMC-pun-U&e=> > | Nanofactory > <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.nanofact.no&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=7HJI3EH6RqKWf16fbYIYKw&m=INzNz0EhAfOz2J4uGWxrKjo-qBQYnUHjXOF9rSxEXTQ&s=i8VNBHNUWx6dxM6qgwo0hBV4EVmqK-NBY5bRDJBmfAM&e=> > | AQ-Lab > <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.aq-2Dlab.no&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=7HJI3EH6RqKWf16fbYIYKw&m=INzNz0EhAfOz2J4uGWxrKjo-qBQYnUHjXOF9rSxEXTQ&s=i8G56fQKIsGv9dk8ev8ozkaCLIsd-LOEHrqpX9cY5yI&e=> > | FAP > <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.phap.no&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=7HJI3EH6RqKWf16fbYIYKw&m=INzNz0EhAfOz2J4uGWxrKjo-qBQYnUHjXOF9rSxEXTQ&s=m0sz0QVLjdTnHTiVYdJ0GZj1VHf1oMsqyQyjdWiq-_o&e=> > > > -- > *From: *"James Pringle" > *To: *"fipy" > *Sent: *Wednesday, May 31, 2017 9:31:51 PM > *Subject: *solvers for elliptic equations with dominant lower order terms > > > Dear all -- > > I need to solve a second order PDE in 2D of the form > > A(x,y)*(eta_xx+eta_yy)+B(x,y)*eta_x+C(x,y)*eta_y = 0 > > This is an advective diffusive balance, with B and C representing the > advective velocities. > > > Over much of the domain the low order terms dominate. For some geometries, > the default solver I am using (SciPy LinearLUSolver) is having trouble > find an answer (especially when the characteristics defined by B and C form > loops. > > Does anyone have recommendations for how to choose a better solver? (I > have blindly tried all the ones in SciPy, the ones besides LinearLUSolver > do worse). > > And are there any hints on how to use preconditioners? There is discussion > of preconditioners and Trilinnos, but I can't find hints on how one would > choose to use them and when they might help. > > Pointers to the broader literature are welcome! > > Thank you, > Jamie Pringle > > ___ > 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: solvers for elliptic equations with dominant lower order terms
James, are A(x,y), B(x,y) and C(x,y) three different variable functions for the PDE? FIPY can solve at least when these three are equal. If it solves when they differ, I am not sure. Sergio Sergio Manzetti [ http://www.fjordforsk.no/logo_hr2.jpg ] [ http://www.fjordforsk.no/ | Fjordforsk AS ] [ http://www.fjordforsk.no/ | ] Midtun 6894 Vangsnes Norge Org.nr. 911 659 654 Tlf: +47 57695621 [ http://www.oekolab.com/ | Økolab ] | [ http://www.nanofact.no/ | Nanofactory ] | [ http://www.aq-lab.no/ | AQ-Lab ] | [ http://www.phap.no/ | FAP ] From: "James Pringle" To: "fipy" Sent: Wednesday, May 31, 2017 9:31:51 PM Subject: solvers for elliptic equations with dominant lower order terms Dear all -- I need to solve a second order PDE in 2D of the form A(x,y)*(eta_xx+eta_yy)+B(x,y)*eta_x+C(x,y)*eta_y = 0 This is an advective diffusive balance, with B and C representing the advective velocities. BQ_BEGIN BQ_END Over much of the domain the low order terms dominate. For some geometries, the default solver I am using (SciPy LinearLUSolver) is having trouble find an answer (especially when the characteristics defined by B and C form loops . Does anyone have recommendations for how to choose a better solver? (I have blindly tried all the ones in SciPy, the ones besides LinearLUSolver do worse). And are there any hints on how to use preconditioners? There is discussion of preconditioners and Trilinnos, but I can't find hints on how one would choose to use them and when they might help. Pointers to the broader literature are welcome! Thank you, Jamie Pringle ___ 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 ]
solvers for elliptic equations with dominant lower order terms
Dear all -- I need to solve a second order PDE in 2D of the form A(x,y)*(eta_xx+eta_yy)+B(x,y)*eta_x+C(x,y)*eta_y = 0 This is an advective diffusive balance, with B and C representing the advective velocities. Over much of the domain the low order terms dominate. For some geometries, the default solver I am using (SciPy LinearLUSolver) is having trouble find an answer (especially when the characteristics defined by B and C form loops . Does anyone have recommendations for how to choose a better solver? (I have blindly tried all the ones in SciPy, the ones besides LinearLUSolver do worse). And are there any hints on how to use preconditioners? There is discussion of preconditioners and Trilinnos, but I can't find hints on how one would choose to use them and when they might help. Pointers to the broader literature are welcome! Thank you, Jamie Pringle ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]