docstr: Tests solving 2d diffusion equation.
docstr_tok: ["Tests","solving","2d","diffusion","equation","."]
code: def testAnisotropicDiffusion(self, boundary_condition):
      """Tests solving 2d diffusion equation."""
      # The equation is `u_{t} + Dx u_{xx} + Dy u_{yy} = 0`.
      # The final condition is a gaussian centered at (0, 0) with variance sigma.
      # The variance along each dimension should evolve as
      # `sigma + 2 Dx (t_final - t)` and `sigma + 2 Dy (t_final - t)`.
      grid = grids.uniform_grid(
          minimums=[-10, -20],
          maximums=[10, 20],
          sizes=[201, 301],
          dtype=tf.float32,
      )
      ys = self.evaluate(grid[0])
      xs = self.evaluate(grid[1])
  
      diff_coeff_x = 0.4  # Dx
      diff_coeff_y = 0.25  # Dy
      time_step = 0.1
      final_t = 1
      final_variance = 1
  
      def quadratic_coeff_fn(t, location_grid):
          del t, location_grid
          u_xx = diff_coeff_x
          u_yy = diff_coeff_y
          u_xy = None
          return [[u_yy, u_xy], [u_xy, u_xx]]
  
      final_values = tf.expand_dims(
          tf.constant(
              np.outer(
                  _gaussian(ys, final_variance),
                  _gaussian(xs, final_variance),
              ),
              dtype=tf.float32,
          ),
          axis=0,
      )
      if boundary_condition == "default":
          bound_cond = [(None, None), (None, None)]
      elif boundary_condition == "dirichlet":
          bound_cond = [
              (_zero_boundary, _zero_boundary),
              (_zero_boundary, _zero_boundary),
          ]
      else:
          bound_cond = [
              (_zero_boundary, None),
              (None, _zero_grad_boundary),
          ]
      step_fn = douglas_adi_step(theta=0.5)
      result = fd_solvers.solve_backward(
          start_time=final_t,
          end_time=0,
          coord_grid=grid,
          values_grid=final_values,
          time_step=time_step,
          one_step_fn=step_fn,
          boundary_conditions=bound_cond,
          second_order_coeff_fn=quadratic_coeff_fn,
          dtype=grid[0].dtype,
      )[0]
  
      variance_x = final_variance + 2 * diff_coeff_x * final_t
      variance_y = final_variance + 2 * diff_coeff_y * final_t
      expected = np.outer(
          _gaussian(ys, variance_y), _gaussian(xs, variance_x)
      )
  
      self._assertClose(expected, result)
  
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  import tf_quant_finance
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 1 for calling the MultidimParabolicEquationStepperTest obj's underlying member method code with example usage: obj.testAnisotropicDiffusion(boundary_condition) and returns: list