Re: Applying Bounding Limits to PDE Solution Variables

2016-08-03 Thread Daniel Wheeler
On Tue, Aug 2, 2016 at 2:02 PM, Campbell, Ian
 wrote:
>
> I've tried the mean-square and RMS values, but they're both orders of 
> magnitude away from the residual returned by '.sweep'. As such, can you 
> please tell me the formula used by '.sweep' to compute the residual, so that 
> I may use the same one?

I think it's the L2 norm of "A * x - b" without any normalization,
where x is the variable value before the linear solve. See,

https://github.com/usnistgov/fipy/blob/develop/fipy/solvers/solver.py#L135

-- 
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: Applying Bounding Limits to PDE Solution Variables

2016-08-02 Thread Campbell, Ian
Hi Daniel,

Thank you very much for your prompt reply.

I'm manually trying to implement the bound-checking feature immediately 
following a sweep, as you've suggested. As an initial step towards this, I need 
to manually compute my own residual and compare to that computed via '.sweep' 
in FiPy.

I've tried the mean-square and RMS values, but they're both orders of magnitude 
away from the residual returned by '.sweep'. As such, can you please tell me 
the formula used by '.sweep' to compute the residual, so that I may use the 
same one?

With best regards,

 - Ian

-Original Message-
From: fipy-boun...@nist.gov [mailto:fipy-boun...@nist.gov] On Behalf Of Daniel 
Wheeler
Sent: 02 August 2016 15:57
To: Multiple recipients of list <fipy@nist.gov>
Subject: Re: Applying Bounding Limits to PDE Solution Variables

Hi Ian,

Sorry, there isn't any way to do this as an implicit command in FiPy, whether 
as a simple reset during sweeping or as a fully implicit constraint in the 
equations. Of course, you can always try these techniques explicitly in the 
Python code or in the design of the equations. I agree that It would be nice to 
have a one sided constraint syntactically in FiPy, but I'm not sure how best to 
make that work internally.

Cheers,

Daniel

On Tue, Aug 2, 2016 at 10:46 AM, Campbell, Ian <i.campbel...@imperial.ac.uk> 
wrote:
> Hi All,
>
>
>
> I would like to prevent the CellVariables I am solving for from ever 
> reaching physically-meaningless and incorrect values, such as 
> concentrations becoming negative. Is there a way to do this?
>
>
>
> The most natural place I could think of it  being is an argument in 
> CellVariable declaration, such as “phi = CellVariable(mesh = mesh2d, 
> value = phi_0, upperlimit = 10**7, lowerlimit = 0)”. However, I 
> haven’t found such an option there or in any of the FiPy documentation.
>
>
>
> With best regards,
>
>
>
> -  Ian
>
>
> ___
> 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 ]


Applying Bounding Limits to PDE Solution Variables

2016-08-02 Thread Campbell, Ian
Hi All,

I would like to prevent the CellVariables I am solving for from ever reaching 
physically-meaningless and incorrect values, such as concentrations becoming 
negative. Is there a way to do this?

The most natural place I could think of it  being is an argument in 
CellVariable declaration, such as "phi = CellVariable(mesh = mesh2d, value = 
phi_0, upperlimit = 10**7, lowerlimit = 0)". However, I haven't found such an 
option there or in any of the FiPy documentation.

With best regards,


-  Ian
___
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]