Date: 2022-03-31T04:49:07+00:00

Actual source code: lcl.h

      1: #ifndef __TAO_LCL_H

      4: #include <petsc/private/taoimpl.h>
      5: #include <petscis.h>
      6: #define LCL_FORWARD1        0
      7: #define LCL_ADJOINT1        1
      8: #define LCL_FORWARD2        2
      9: #define LCL_ADJOINT2        3

     11: typedef struct {
     12:   Mat M;    /* Quasi-newton hessian matrix */
     13:   Vec dbar;   /* Reduced gradient */
     14:   Vec GL;
     15:   Vec GAugL;
     16:   Vec GL_U;   /* Gradient of lagrangian */
     17:   Vec GL_V;   /* Gradient of lagrangian */
     18:   Vec GAugL_U; /* Augmented lagrangian gradient */
     19:   Vec GAugL_V; /* Augmented lagrangian gradient */
     20:   Vec GL_U0;   /* Gradient of lagrangian */
     21:   Vec GL_V0;   /* Gradient of lagrangian */
     22:   Vec GAugL_U0; /* Augmented lagrangian gradient */
     23:   Vec GAugL_V0; /* Augmented lagrangian gradient */

     25:   IS UIS;   /* Index set to state */
     26:   IS UID;   /* Index set to design */
     27:   IS UIM;   /* Full index set to all constraints */
     28:   VecScatter state_scatter;
     29:   VecScatter design_scatter;

     31:   Vec U;    /* State variable */
     32:   Vec V;    /* Design variable */
     33:   Vec U0;    /* State variable */
     34:   Vec V0;    /* Design variable */
     35:   Vec V1;    /* Design variable */

     37:   Vec DU;   /* State step */
     38:   Vec DV;   /* Design step */
     39:   Vec DL;   /* Multipliers step */

     41:   Vec GU;   /* Gradient wrt U */
     42:   Vec GV;   /* Gradient wrt V */
     43:   Vec GU0;   /* Gradient wrt U */
     44:   Vec GV0;   /* Gradient wrt V */

     46:   Vec W;    /* work vector */
     47:   Vec X0;
     48:   Vec G0;
     49:   Vec WU;   /* state work vector */
     50:   Vec WV;   /* design work vector */
     51:   Vec r;
     52:   Vec s;
     53:   Vec g1,g2;
     54:   Vec con1;

     56:   PetscInt m; /* number of constraints */
     57:   PetscInt n; /* number of variables */

     59:   Mat jacobian_state0;   /* Jacobian wrt U */
     60:   Mat jacobian_state0_pre; /* preconditioning matrix wrt U */
     61:   Mat jacobian_design0;   /* Jacobian wrt V */
     62:   Mat jacobian_state_inv0; /* Inverse of Jacobian wrt U */
     63:   Mat R;

     65:   Vec lamda;   /* Lagrange Multiplier */
     66:   Vec lamda0;   /* Lagrange Multiplier */
     67:   Vec lamda1;   /* Lagrange Multiplier */

     69:   Vec WL;   /* Work vector */
     70:   PetscReal rho; /* Penalty parameter */
     71:   PetscReal rho0;
     72:   PetscReal rhomax;
     73:   PetscReal eps1,eps2;
     74:   PetscReal aug,aug0,lgn,lgn0;
     75:   PetscInt    subset_type;
     76:   PetscInt    solve_type;
     77:   PetscBool recompute_jacobian_flag;
     78:   PetscInt phase2_niter;
     79:   PetscBool verbose;
     80:   PetscReal tau[4];

     82: } TAO_LCL;

     84: #endif