Dear Jon, Thank you for your explanation about the residuals - it now makes sense to me that the residuals are larger when using larger coefficients.
My problem involves evaporation and condensation of ice - the source terms are constructed such that the amount of ice that evaporates turns into vapour, and the amount of vapour that condenses turns into ice - so indeed total mass should be conserved. Thanks for the help! Best, Djoeke On 29 Jan 2016, at 20:04, Guyer, Jonathan E. Dr. <[email protected]> wrote: > Djoeke - > > The residual returned by sweep is the L2 norm of (L x - b) (see > https://github.com/usnistgov/fipy/blob/develop/fipy/solvers/solver.py#L143). > In other words, it is the unscaled deviation from zero of the linear > discretization of your non-linear PDEs. Because we don't scale the residuals, > yes, you should expect larger absolute residuals for systems that have larger > values or larger coefficients. Normalizing the the RHS vector or by the > matrix diagonal is frequently done, but since there are variety of viable > normalizations, we opted to leave that in the user's hands. > > Typically, when I'm exploring a new problem, I plot the residual for very > large numbers of sweeps to see the trends of convergence. If the residual is > not steadily decreasing, there's no point in sweeping longer (with the caveat > that for some problems the residual increases before it decreases). Usually, > the residual will bottom out at something related to the solver tolerance. > Trading off time steps, residual cutoff and solver tolerance is pretty much > trial and error, as far as I can tell. > > Note: Unless your source is constructed in a conservative way (e.g., as the > divergence of a flux), then there's no reason to expect mass conservation. > > - Jon > > On Jan 29, 2016, at 10:41 AM, Djoeke Schoonenberg > <[email protected]> wrote: > >> Dear FiPy developers, >> >> I am using FiPy to solve a coupled system of two partial >> differential equations governing the >> evolution of two surface densities, including convection, >> diffusion and source terms. To check if >> everything was going well, I checked if mass >> was conserved in the system by checking if >> the inflowing mass equals the outflowing mass. >> This was only the case if I set the desired residual low enough in: >> >> res = 1e10 >> nres = 0 >> while res>1e-2: >> res = Eq.sweep(dt=timestepduration) >> nres += 1 >> >> But I have no clue how to determine the desired residual other than >> by just checking if mass is >> conserved in the solution. >> >> Could anybody explain to me what the residuals actually mean? >> If one is working with very large numbers in FiPy, can the desired >> residuals then also be larger >> than if one is working with small numbers, >> and get the same accuracy? >> >> Thanks a lot in advance! >> >> Best regards, >> >> Djoeke >> >> _______________________________________________ >> fipy mailing list >> [email protected] >> http://www.ctcms.nist.gov/fipy >> [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > > > _______________________________________________ > fipy mailing list > [email protected] > http://www.ctcms.nist.gov/fipy > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] _______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
