← Back to team overview

dolfin team mailing list archive

Re: [Question #157961]: Multiplication by a small parameter yields zeros.

 

Question #157961 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/157961

    Status: Open => Answered

Anders Logg proposed the following answer:
On Tue, May 17, 2011 at 10:30:59PM -0000, Douglas Brinkerhoff wrote:
> New question #157961 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/157961
>
> Hello,
>
> I'm trying to multiply a field (called H in this instance, which represents the thickness of a thin film, which has an average value of 1000 or so), by a small parameter, called A, which has a value of around 1e-25.  Instead of yielding values around 1e-22 as one might expect, I get all zeros.  If I do the multiplication in several steps, (e.g. H*(A*1e15)/1e15), I can coerce the correct result.  Any ideas on how to remedy this problem?

You need to rescale your problem. If you work with numbers that small,
you will run into all kinds of problems with round-off errors, both
when assembling and solving the linear system. In particular, the form
compiler will round all small numbers down to 0.0.

--
Anders

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.