Package com.opengamma.analytics.financial.model.finitedifference

Examples of com.opengamma.analytics.financial.model.finitedifference.ConvectionDiffusionPDESolver


    final double fL = Math.log(ft / 30);
    final double fH = Math.log(30 * ft);

    // PDEUtilityTools.printSurface("lv", lvm.getSurface(), 0.0, 2e-9, 0.9999, 1.0001);

    final ConvectionDiffusionPDESolver solver = new ThetaMethodFiniteDifference(theta, false);

    final BoundaryCondition lower = new NeumannBoundaryCondition(1.0, fL, true);
    final BoundaryCondition upper = new NeumannBoundaryCondition(1.0, fH, false);
    //    BoundaryCondition lower = new FixedSecondDerivativeBoundaryCondition(0.0, xL, true);
    //    BoundaryCondition upper = new FixedSecondDerivativeBoundaryCondition(0.0, xH, false);

    // MeshingFunction timeMesh = new ExponentialMeshing(0.0, expiry, nTimeNodes, timeMeshLambda);
    final MeshingFunction timeMesh = new ExponentialMeshing(0, EXPIRY, 50, 0.0);
    //  final MeshingFunction spaceMesh = new ExponentialMeshing(fL, fH, 101, 0.0);
    final MeshingFunction spaceMesh = new HyperbolicMeshing(fL, fH, (fL + fH) / 2, 101, 0.4);

    // ZZConvectionDiffusionPDEDataBundle pde_data = PDE_DATA_PROVIDER.getBackwardsLocalVolLogPayoff(EXPIRY, lvm);
    final ConvectionDiffusionPDE1DStandardCoefficients pde = PDE_DATA_PROVIDER.getLogBackwardsLocalVol(EXPIRY, lvm);

    final PDEGrid1D grid = new PDEGrid1D(timeMesh, spaceMesh);
    final PDE1DDataBundle<ConvectionDiffusionPDE1DCoefficients> db = new PDE1DDataBundle<ConvectionDiffusionPDE1DCoefficients>(pde, INITIAL_COND, lower, upper, grid);
    final PDEResults1D res = solver.solve(db);

    final int n = res.getNumberSpaceNodes();
    final double[] values = new double[n];
    for (int i = 0; i < n; i++) {
      //      System.out.println(res.getSpaceValue(i) + "\t" + res.getFunctionValue(i));
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.model.finitedifference.ConvectionDiffusionPDESolver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.