Ejemplo n.º 1
0
    def test_vangenuchten_k(self):
        mesh = Mesh.TensorMesh([50])
        hav = Richards.Empirical._vangenuchten_k(mesh)
        m = np.random.randn(50)
        def wrapper(u):
            return hav.transform(u, m), hav.transformDerivU(u, m)
        passed = checkDerivative(wrapper, np.random.randn(50), plotIt=False)
        self.assertTrue(passed,True)

        hav = Richards.Empirical._vangenuchten_k(mesh)
        u = np.random.randn(50)
        def wrapper(m):
            return hav.transform(u, m), hav.transformDerivM(u, m)
        passed = checkDerivative(wrapper, np.random.randn(50), plotIt=False)
        self.assertTrue(passed,True)
Ejemplo n.º 2
0
 def test_Sensitivity_full(self):
     mTrue = self.Ks*np.ones(self.M.nC)
     J = self.prob.Jfull(mTrue)
     derChk = lambda m: [self.survey.dpred(m), J]
     print '2D: Testing Richards Derivative FULL'
     passed = checkDerivative(derChk, mTrue, num=4, plotIt=False)
     self.assertTrue(passed,True)
Ejemplo n.º 3
0
 def test_BaseHaverkamp_Theta(self):
     mesh = Mesh.TensorMesh([50])
     hav = Richards.Empirical._haverkamp_theta(mesh)
     m = np.random.randn(50)
     def wrapper(u):
         return hav.transform(u, m), hav.transformDerivU(u, m)
     passed = checkDerivative(wrapper, np.random.randn(50), plotIt=False)
     self.assertTrue(passed,True)
Ejemplo n.º 4
0
 def test_Sensitivity(self):
     mTrue = self.Ks*np.ones(self.M.nC)
     derChk = lambda m: [self.survey.dpred(m), lambda v: self.prob.Jvec(m, v)]
     print '3D: Testing Richards Derivative'
     passed = checkDerivative(derChk, mTrue, num=4, plotIt=False)
     self.assertTrue(passed,True)
Ejemplo n.º 5
0
 def test_Richards_getResidual_Picard(self):
     self.prob.doNewton = False
     m = self.Ks
     passed = checkDerivative(lambda hn1: self.prob.getResidual(m, self.h0, hn1, self.prob.timeSteps[0], self.prob.boundaryConditions), self.h0, plotIt=False, expectedOrder=1)
     self.assertTrue(passed,True)