コード例 #1
0
 void TestVaryingPde2D()
 {
     VaryingDiffusionAndSourceTermPde<2> pde;
     ChastePoint<2> evaluation_point(3,4);
     TS_ASSERT_EQUALS(pde.ComputeConstantInUSourceTerm(evaluation_point, NULL),125.0);
     c_matrix<double, 2, 2> diffusion_term = pde.ComputeDiffusionTerm(evaluation_point);
     TS_ASSERT_EQUALS(diffusion_term(0,0), 25.0);
     TS_ASSERT_EQUALS(diffusion_term(0,1), 0.0);
     TS_ASSERT_EQUALS(diffusion_term(1,0), 0.0);
     TS_ASSERT_EQUALS(diffusion_term(1,1), 25.0);
 }
コード例 #2
0
 void TestVaryingPde1D()
 {
     VaryingDiffusionAndSourceTermPde<1> pde;
     ChastePoint<1> evaluation_point(2);
     TS_ASSERT_EQUALS(pde.ComputeConstantInUSourceTerm(evaluation_point, NULL),8.0);
     c_matrix<double, 1, 1> diffusion_term = pde.ComputeDiffusionTerm(evaluation_point);
     TS_ASSERT_EQUALS(diffusion_term(0,0), 4);
 }
    void TestHeatEquationForCoupledOdeSystem()
    {
        // Create PDE system object
        HeatEquationForCoupledOdeSystem<1> pde;

        ChastePoint<1> x(1.0);

        TS_ASSERT_DELTA(pde.ComputeDuDtCoefficientFunction(x,0), 1.0, 1e-6);

        c_vector<double,1> pde_solution;
        pde_solution(0) = 4.0;

        std::vector<double> ode_solution(1);
        ode_solution[0] = 5.0;

        TS_ASSERT_DELTA(pde.ComputeSourceTerm(x, pde_solution, ode_solution, 0), 0.0, 1e-6);

        Node<1> node(0);
        TS_ASSERT_DELTA(pde.ComputeSourceTermAtNode(node, pde_solution, ode_solution, 0), 0.0, 1e-6);

        c_matrix<double,1,1> diffusion_term = pde.ComputeDiffusionTerm(x, 0);
        TS_ASSERT_DELTA(diffusion_term(0,0), 1.0, 1e-6);
    }