docstr: Tests solving 2d diffusion equation with Robin boundary conditions.
docstr_tok: ["Tests","solving","2d","diffusion","equation","with","Robin","boundary","conditions","."]
code: def testAnisotropicDiffusion_WithRobinBoundaries(self):
      """Tests solving 2d diffusion equation with Robin boundary conditions."""
      time_step = 0.01
      final_t = 1
      x_min = -20
      x_max = 20
      y_min = -10
      y_max = 10
  
      grid = grids.uniform_grid(
          minimums=[y_min, x_min],
          maximums=[y_max, x_max],
          sizes=[201, 301],
          dtype=tf.float32,
      )
      ys = self.evaluate(grid[0])
      xs = self.evaluate(grid[1])
  
      def second_order_coeff_fn(t, location_grid):
          del t, location_grid
          return [[2, None], [None, 1]]
  
      def lower_bound_x(t, location_grid):
          del location_grid
          f = (
              tf.exp(t)
              * tf.sin(ys / 2)
              * (
                  np.sin(x_min / _SQRT2)
                  - np.cos(x_min / _SQRT2) / _SQRT2
              )
          )
          return 1, 1, f
  
      def upper_bound_x(t, location_grid):
          del location_grid
          f = (
              tf.exp(t)
              * tf.sin(ys / 2)
              * (
                  np.sin(x_max / _SQRT2)
                  + 2 * np.cos(x_max / _SQRT2) / _SQRT2
              )
          )
          return 1, 2, f
  
      def lower_bound_y(t, location_grid):
          del location_grid
          f = (
              tf.exp(t)
              * tf.sin(xs / _SQRT2)
              * (np.sin(y_min / 2) - 3 * np.cos(y_min / 2) / 2)
          )
          return 1, 3, f
  
      def upper_bound_y(t, location_grid):
          del location_grid
          f = (
              tf.exp(t)
              * tf.sin(xs / _SQRT2)
              * (2 * np.sin(y_max / 2) + 3 * np.cos(y_max / 2) / 2)
          )
          return 2, 3, f
  
      expected = np.outer(np.sin(ys / 2), np.sin(xs / _SQRT2))
  
      final_values = tf.expand_dims(
          tf.constant(
              np.outer(np.sin(ys / 2), np.sin(xs / _SQRT2))
              * np.exp(final_t),
              dtype=tf.float32,
          ),
          axis=0,
      )
      bound_cond = [
          (lower_bound_y, upper_bound_y),
          (lower_bound_x, upper_bound_x),
      ]
      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=second_order_coeff_fn,
          dtype=grid[0].dtype,
      )
  
      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 15 for calling the MultidimParabolicEquationStepperTest obj's underlying member method code with example usage: obj.testAnisotropicDiffusion_WithRobinBoundaries() and returns: list, int,  int,  f, int,  int,  f, int,  int,  f, int,  int,  f