!EvalModel
parameters: [Omega, eCS, b_xx, b_yy, b_zz, b_xy, b_yz, b_xz]
model: !Switch
  [Omega]: !FunctionMap
    #Tappering of the deviatoric stress with depth
    map: 
      Omega: |
       zStressDecreaseStart = -11000.;
       zStressDecreaseStop = -15000.;
       zStressDecreaseWidth = zStressDecreaseStart - zStressDecreaseStop;

       if  (z>=zStressDecreaseStart) {
          return 1.0;
       } else {
          if (z>=zStressDecreaseStop) {
             a = 1.0-(z-zStressDecreaseStop)/zStressDecreaseWidth;
             Sx = (3.0*a*a-2.0*a*a*a);
             return 1.0-Sx;
          } else {
            return 0.001;
          }
       }
  [b_xx, b_yy, b_zz, b_xy, b_yz, b_xz]: !EvalModel
    parameters: [effectiveConfiningStress]
    model: !FunctionMap
      map:
        effectiveConfiningStress: |
          return 2670.0*0.21*9.8*min(-1500.0,z);
    components: !OptimalStress
      constants:
        mu_d:      0.1
        mu_s:      0.6
        strike:  -15.0
        dip:      90.0
        rake:      0.0
        cohesion:  0.0
        s2ratio:   0.7
        R:         0.7
  [eCS]: !FunctionMap
    map:
      #avoid positive stress above z=0
      eCS: |
        return 2670.0*0.21*9.8*min(-1500.0,z);
components: !FunctionMap
  map:
    s_xx:     return Omega*b_xx + (1.0-Omega)*eCS;
    s_yy:     return Omega*b_yy + (1.0-Omega)*eCS;
    s_zz:     return Omega*b_zz + (1.0-Omega)*eCS;
    s_xy:     return Omega*b_xy;
    s_yz:     return Omega*b_yz;
    s_xz:     return Omega*b_xz;
