Login  Register

Re: fd questions ctd...

Posted by Klaus Spanderen-2 on Apr 23, 2012; 11:08am
URL: http://quantlib.414.s1.nabble.com/fd-questions-ctd-tp12480p12481.html

Hi Peter

1. Thanks for your changes, I've added the new class to the SVN trunk.

2. At the time being I think the answer is no. We'll have to extend
 ql/methods/finitedifferences/FiniteDifferenceModel::rollbackImpl
by the capability to deal with non uniform time grids.

3. I've used FiniteDifferenceModel::rollback to solve the Fokker-Planck
equation. Even though the name of the method is "rollback", if "from is
smaller than to" the methods rolls forward. You'll have to remove line 95 and
96

            QL_REQUIRE(from >= to,
                       "trying to roll back from " << from << " to " << to);

from finitedifferencemodel.hpp to get it working.

4. The multidim frameworks supports "free boundary condition" (default if no
BC is given) and Dirichlet BC. Your are right, the Neumann condition was
never implemented. The boundary conditions are hardcoded in some classes
because otherwise users might supply the one dimensional classes NeumannBC or
DirichletBC, which don't work in the multidimensional case. If you have a
multidimensional version of NeumannBC running we can change the interfaces.

regards
 Klaus

On Sunday 22 April 2012 19:27:12 Peter Caspers wrote:

> Hi,
>
> may I ask one more question please:
>
> 4. it seems there is only a Dirichlet boundary condition implemented in
> the multi dimensional context. I want a Neumann condition and I think I
> managed to implement a version, but the boundary conditions are
> hardcoded as FdmDirichletBoundary in many classes, even the typedef for
> the FdmBoundaryConditionSet is vector<shared_ptr<FdmDirichletBoundary>>.
> Am I missing something here? How else would I be supposed to add new
> boundary conditions?
>
> As for 1. below I extended the concentrating mesher by a flag that
> allows the central point to be forced into the mesh (using a piecewise
> linear transformation of the generating uniform grid, see e.g. Iain
> Clarke, FX Option Pricing, ch. ...). To set up non uniform grids with
> more than one concentrating point I added the glued1dmesher. If you
> consider these contributions useful, please add them to the library.
>
> 2 and 3 have obvious workarounds (rewriting the pde as backward and
> doing the time steps manually one by one). Still the implementation of
> forward operators becomes less readable by this implicit (yet trivial)
> transformation and possibly it may be useful in general to have a non
> uniform time grid in the solvers, e.g. via a transformation [0,1] ->
> [0,1], u -> pow(u,alpha), alpha > 0 and a linear one [0,1] -> [0,T] (cf.
> same reference as above). If considered useful, I'd be happy to do these
> extensions to the FdmBackwardSolver class.
>
> Regards
> Peter
>
> -------- Original-Nachricht --------
> Betreff: [Quantlib-users] fd questions
> Datum: Thu, 12 Apr 2012 13:37:25 +0200
> Von: Peter Caspers <[hidden email]>
> An: [hidden email]
>
>
>
> Hi,
>
> I just started to use the ql 1.1 / finitedifferences framework and have
> a couple of (probably very basic) questions:
>
> 1. Is there a way to specify a or even several mandatory point(s) in the
> meshers?
> 2. Can I use a non uniform time grid in the solver?
> 3. Is there a forward solver ?
>
> Thank you
> Peter
>
>
>
>
> ---------------------------------------------------------------------------
>--- For Developers, A Lot Can Happen In A Second.
> Boundary is the first to Know...and Tell You.
> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> http://p.sf.net/sfu/Boundary-d2dvs2
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users



------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev