Hi Dan,

Thanks for your suggestion to use the ResidualTerm as per your gist posting 
https://gist.github.com/guyer/f29c759fd7f0f01363b8483c7bc644cb  of the Newton's 
method.

When I try to implement the Newton's method into my code, python interpreter 
gives the following error message

TypeError: __init__() got an unexpected keyword argument 'var' 
File " \fipy-3.1-py2.7.egg\fipy\terms\term.py", line 428, in __eq__
    return self - other
  File "\fipy-3.1-py2.7.egg\fipy\terms\term.py", line 422, in __sub__
    return self + (-other)
  File "\fipy-3.1-py2.7.egg\fipy\terms\abstractBinaryTerm.py", line 88, in 
__neg__
    return (-self.term) + (-self.other)
  File "\fipy-3.1-py2.7.egg\fipy\terms\nonDiffusionTerm.py", line 56, in __neg__
    return self.__class__(coeff=-self.coeff, var=self.var)
TypeError: __init__() got an unexpected keyword argument 'var'

I am following exactly the same steps given in the original gist posting. Any 
idea what might be wrong here ?


Krishna 



-----Original Message-----
From: fipy-boun...@nist.gov [mailto:fipy-boun...@nist.gov] On Behalf Of Daniel 
Wheeler
Sent: Tuesday, September 6, 2016 1:46 PM
To: Multiple recipients of list <fipy@nist.gov>
Subject: Re: Dynamic under-relaxation factors for FiPy sweep

On Tue, Sep 6, 2016 at 6:58 AM, Krishna <krishnaku...@imperial.ac.uk> wrote:
>
> Since python to be a very distributed ecosystem, this question for 
> some kind of a starter code,  may not fit well in  a 
> general/computational math stackexchange post , nor in this mailing 
> list. fipy's details are certainly required to implement an Aitken 
> type dynamic under relaxation. , I.e. one needs access to the internal 
> and residual matrices, in order to apply text book formulae, and then 
> split the relaxation vectors into individual scalars for use in the 
> 'underrelaxation' parameter for each sweep method. The first two 
> sweeps must be static/initial 'underrelaxation' so that we can apply the 
> formula.

I see. Here is an example of doing Newton iterations in FiPy

    https://gist.github.com/guyer/f29c759fd7f0f01363b8483c7bc644cb

It uses the ResidualTerm. If you look at that code, it uses the 
justResidualVector, which gives the residual vector. You can also get access to 
the matrix and b vector separately. For the under relaxation, I don't think 
it's possible to apply it as a vector that's different for each equation. There 
is probably some way to do it akin to what's happening in the ResidualTerm.



--
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 ]

Reply via email to