예제 #1
0
void
update_parameterC(int iCC,       /* CONDITION NUMBER */
                  double lambda, /* PARAMETER VALUE */
		  double *x, 	 /* UNKNOWN VECTOR */
		  double *xdot,  /* UNKNOWN_DOT VECTOR */
		  double *x_AC,  /* x_AC VECTOR */
		  double delta_s,/* STEP */
		  Comm_Ex *cx,	 /* array of communications structures */
		  Exo_DB *exo,	 /* ptr to the finite element mesh database */
		  Dpi *dpi)	 /* distributed processing information */
{

  int ic, mn, mpr;
  int ibc, idf;

#ifdef DEBUG
  static const char yo[] = "update_parameterC";

  /*
   * 		BEGIN EXECUTION
   */

  fprintf(stderr, "%s() begins...\n", yo);
#endif

/* Calls from ac_conti.c (nCC=0) */
  if (nCC == 0) {
    if (cont->upType == 1) { /* BC */
      ibc = cont->upBCID;
      idf = cont->upDFID;
      update_BC_parameter(lambda, ibc, idf, cx, exo, dpi);
    }
    else if (cont->upType == 2) {
      mn = cont->upMTID;
      mpr = cont->upMPID;
      ic = cont->upMDID;
      update_MT_parameter(lambda, mn, mpr, ic, cx, exo, dpi);
    }
   else if (cont->upType == 3) {
      ibc = cont->upBCID;
      idf = cont->upDFID;
      update_AC_parameter(lambda, ibc, idf, cx, exo, dpi);
    }
    else if (cont->upType == 4) {
      mn = cont->upMTID;
      mpr = cont->upMPID;
      ic = cont->upMDID;
      update_UM_parameter(lambda, mn, mpr, ic, cx, exo, dpi);
    }
    else if (cont->upType == 5) {
      update_user_parameter(lambda, x, xdot, x_AC, cx, exo, dpi);
    }
 
    else EH(-1, "Bad continuation type!");
  }

/* Calls from LOCA */
 else {
    
  /*
   *    BC parameters
   */

  if (cpcc[iCC].Type == 1) {
    ibc = cpcc[iCC].BCID;
    idf = cpcc[iCC].DFID;
    update_BC_parameter(lambda, ibc, idf, cx, exo, dpi);
  }

  /*
   *    MT parameters
   */

  else if (cpcc[iCC].Type == 2) {
    mn = cpcc[iCC].MTID;
    mpr = cpcc[iCC].MPID;
    ic = cpcc[iCC].MDID;
    update_MT_parameter(lambda, mn, mpr, ic, cx, exo, dpi);
  }

  /*
   *    AC parameters
   */

  else if (cpcc[iCC].Type == 3) {
    ibc = cpcc[iCC].BCID;
    idf = cpcc[iCC].DFID;
    update_AC_parameter(lambda, ibc, idf, cx, exo, dpi);
  }

  /*
   *    UM parameters
   */

  else if (cpcc[iCC].Type == 4) {
    mn = cpcc[iCC].MTID;
    mpr = cpcc[iCC].MPID;
    ic = cpcc[iCC].MDID;
    update_UM_parameter(lambda, mn, mpr, ic, cx, exo, dpi);
  }

  /*
   *    UF parameters
   */

  else if (cpcc[iCC].Type == 5) {
    update_user_parameter(lambda, x, xdot, x_AC, cx, exo, dpi);
  }

  else {
    if (cont->upType != 6) EH(-1, "Bad continuation type!");
  }
 }

}
예제 #2
0
void
update_parameterHC(int iHC,      /* Hunting condition number */
                   double lambda, /* PARAMETER VALUE */
		   double *x, 	 /* UNKNOWN VECTOR */
		   double *xdot,  /* UNKNOWN_DOT VECTOR */
		   double *x_AC,  /* x_AC VECTOR */
		   double delta_s,/* STEP */
		   Comm_Ex *cx,	 /* array of communications structures */
		   Exo_DB *exo,	 /* ptr to the finite element mesh database */
		   Dpi *dpi)	 /* distributed processing information */
{

  int ic, mn, mpr;
  int ibc, idf;

#ifdef DEBUG
  static const char yo[] = "update_parameterHC";


  /*
   * 		BEGIN EXECUTION
   */

  fprintf(stderr, "%s() begins...\n", yo);
#endif

  /*
   *    BC parameters
   */

  if (hunt[iHC].Type == 1) {
    ibc = hunt[iHC].BCID;
    idf = hunt[iHC].DFID;
    if(ibc > -1)
	{ update_BC_parameter(lambda, ibc, idf, cx, exo, dpi); }
  }

  /*
   *    MT parameters
   */

  else if (hunt[iHC].Type == 2) {
    mn = hunt[iHC].MTID;
    mpr = hunt[iHC].MPID;
    ic = hunt[iHC].MDID;
    update_MT_parameter(lambda, mn, mpr, ic, cx, exo, dpi);
  }

  /*
   *    AC parameters
   */

  else if (hunt[iHC].Type == 3) {
    ibc = hunt[iHC].BCID;
    idf = hunt[iHC].DFID;
    update_AC_parameter(lambda, ibc, idf, cx, exo, dpi);
    }

  /*
   *    UM parameters
   */

  else if (hunt[iHC].Type == 4) {
    mn = hunt[iHC].MTID;
    mpr = hunt[iHC].MPID;
    ic = hunt[iHC].MDID;
    update_UM_parameter(lambda, mn, mpr, ic, cx, exo, dpi);
  }

  /*
   *    UF parameters
   */

  else if (hunt[iHC].Type == 5) {
    update_user_parameter(lambda, x, xdot, x_AC, cx, exo, dpi);
  }

  else EH(-1, "Bad HC continuation type!");

}
예제 #3
0
void
update_parameterS(double lambda, /* PARAMETER VALUE */
		  double *x, 	 /* UNKNOWN VECTOR */
		  double *xdot,  /* UNKNOWN_DOT VECTOR */
		  int sens_type,/*  type of sensitivity variable(BC or MT) */
		  int sens_id,		/*  variable id BCID or MT# */
		  int sens_flt,		/* data float id or matl prop id */
		  int sens_flt2,		/* data float id for UM */
		  Comm_Ex *cx,	 /* array of communications structures */
		  Exo_DB *exo,	 /* ptr to the finite element mesh database */
		  Dpi *dpi)	 /* distributed processing information */
{

  int ic, mn, mpr;
  int ibc, idf;

#ifdef DEBUG
  static const char yo[] = "update_parameterS";

  /*
   * 		BEGIN EXECUTION
   */

  fprintf(stderr, "%s() begins...\n", yo);
#endif

  /*
   *    BC parameters
   */

  if (sens_type == 1) {
    ibc = sens_id;
    idf = sens_flt;
    update_BC_parameter(lambda, ibc, idf, cx, exo, dpi);
  }

  /*
   *    MT parameters
   */

  else if (sens_type == 2) {
    mn = sens_id;
    mpr = sens_flt;
    ic = sens_flt;
    update_MT_parameter(lambda, mn, mpr, ic, cx, exo, dpi);
  }

  /*
   *    AC parameters
   */

  else if (sens_type == 3) {
    ibc = sens_id;
    idf = sens_flt;
    update_AC_parameter(lambda, ibc, idf, cx, exo, dpi);
  }

  /*
   *    UM parameters
   */

  else if (sens_type == 4) {
    mn = sens_id;
    mpr = sens_flt;
    ic = sens_flt2;
    update_UM_parameter(lambda, mn, mpr, ic, cx, exo, dpi);
  }

  /*
   *    UF parameters
   */

  else if (sens_type == 5) {
    update_user_parameter(lambda, x, xdot, NULL, cx, exo, dpi);
  }

  else EH(-1, "Bad sens. parameter type!");

}
예제 #4
0
int
do_user_update(int n, int first_cp, int first_tp,
               int Type, int BCID, int DFID, int MTID, int MPID, int MDID,
               double value, Comm_Ex *cx, Exo_DB *exo, Dpi *dpi)
/*
 * This function calls the appropriate parameter update function
 * for each user-defined continuation condition type and saves
 * the calculated values. On the first call from each condition,
 * the ID's are also saved. The incremented function counter is returned.
 */
{
    int param_type = -1;    /* 1 = first (CP), 2 = second (TP) */

    /* Determine which parameter is being updated */
    if (first_cp >= 0 && first_tp == -1)
    {
        param_type = 1;
    }
    else if (first_tp >= 0 && first_cp == -1)
    {
        param_type = 2;
    }
    else
    {
        EH(-1, "User parameter type settings inconsistent!");
    }

    /* Store new and old values */
    if (param_type == 1)
    {
        cpuc[n].old_value = cpuc[n].value;
        cpuc[n].value = value;
    }
    else if (param_type == 2)
    {
        tpuc[n].old_value = tpuc[n].value;
        tpuc[n].value = value;
    }

    /* Call the appropriate update function */
    switch (Type) {
    case BC:
        update_BC_parameter(value, BCID, DFID, cx, exo, dpi);

        /* Store ID info on first call */
        if (first_cp == 1)
        {
            cpuc[n].Type = 1;
            cpuc[n].BCID = BCID;
            cpuc[n].DFID = DFID;
        }
        else if (first_tp == 1)
        {
            tpuc[n].Type = 1;
            tpuc[n].BCID = BCID;
            tpuc[n].DFID = DFID;
        }
        break;

    case MT:
        update_MT_parameter(value, MTID-1, MPID, MDID, cx, exo, dpi);

        /* Store ID info on first call */
        if (first_cp == 1)
        {
            cpuc[n].Type = 2;
            cpuc[n].MTID = MTID-1;
            cpuc[n].MPID = MPID;
        }
        else if (first_tp == 1)
        {
            tpuc[n].Type = 2;
            tpuc[n].MTID = MTID-1;
            tpuc[n].MPID = MPID;
        }
        break;

    case AC:
        update_AC_parameter(value, BCID, DFID, cx, exo, dpi);

        /* Store ID info on first call */
        if (first_cp == 1)
        {
            cpuc[n].Type = 3;
            cpuc[n].BCID = BCID;
            cpuc[n].DFID = DFID;
        }
        else if (first_tp == 1)
        {
            tpuc[n].Type = 3;
            tpuc[n].BCID = BCID;
            tpuc[n].DFID = DFID;
        }
        break;

    case UM:
        update_UM_parameter(value, MTID-1, MPID, MDID, cx, exo, dpi);

        /* Store ID info on first call */
        if (first_cp == 1)
        {
            cpuc[n].Type = 4;
            cpuc[n].MTID = MTID-1;
            cpuc[n].MPID = MPID;
            cpuc[n].MDID = MDID;
        }
        else if (first_tp == 1)
        {
            tpuc[n].Type = 4;
            tpuc[n].MTID = MTID-1;
            tpuc[n].MPID = MPID;
            tpuc[n].MDID = MDID;
        }
        break;
    }

    /* Update counter and return */
    n++;
    return n;
}