Ejemplo n.º 1
0
void
LOCA::Pitchfork::MooreSpence::ExtendedGroup::printSolution(
						  const double conParam) const 
{
  if (globalData->locaUtils->isPrintType(NOX::Utils::StepperDetails)) {
    globalData->locaUtils->out() << 
      "LOCA::Pitchfork::MooreSpence::ExtendedGroup::printSolution\n";

    globalData->locaUtils->out() << "Pitchfork located at: " << 
      globalData->locaUtils->sciformat(conParam) << "   " << 
      globalData->locaUtils->sciformat(getBifParam()) << std::endl;

    globalData->locaUtils->out() << 
      "\tSlack variable sigma = " << 
      globalData->locaUtils->sciformat(xVec->getSlack()) << std::endl;

    globalData->locaUtils->out() << 
      "\tPrinting Solution Vector for conParam = " << 
      globalData->locaUtils->sciformat(conParam) << std::endl;
  }
  grpPtr->printSolution(conParam);
  if (globalData->locaUtils->isPrintType(NOX::Utils::StepperDetails)) {
    globalData->locaUtils->out() << 
      "\tPrinting Null Vector for bif param = " << 
      globalData->locaUtils->sciformat(getBifParam()) << std::endl;
  }
  grpPtr->printSolution(*(xVec->getNullVec()), xVec->getBifParam());
}
Ejemplo n.º 2
0
void
LOCA::Pitchfork::MooreSpence::ExtendedGroup::init(bool perturbSoln, 
						  double perturbSize)
{
  xVec->getBifParam() = getBifParam();

  // Rescale length vector so that the normalization condition is met
  double lVecDotNullVec = lTransNorm(*(xVec->getNullVec()));

  if (fabs(lVecDotNullVec) < 1.0e-8) {
    globalData->locaErrorCheck->throwError(
		   "LOCA::Pitchfork::MooreSpence::ExtendedGroup::init()",
		   "null vector cannot be orthogonal to length-scaling vector: ");
  }
  if (globalData->locaUtils->isPrintType(NOX::Utils::StepperDetails)) {
    globalData->locaUtils->out() << 
      "\tIn LOCA::Pitchfork::MooreSpence::ExtendedGroup::init(), " << 
      "scaling null vector by:" << 
      globalData->locaUtils->sciformat(1.0 / lVecDotNullVec) << std::endl;
  }
  xVec->getNullVec()->scale(1.0/lVecDotNullVec);

  // Rescale asymmetric vector to have unit length
  double psi_norm = sqrt( grpPtr->innerProduct(*asymVec, *asymVec) );
  if (globalData->locaUtils->isPrintType(NOX::Utils::StepperDetails)) {
    globalData->locaUtils->out() << 
      "\tIn LOCA::Pitchfork::MooreSpence::ExtendedGroup::init(), " << 
      "scaling asymmetric vector by:" <<
      globalData->locaUtils->sciformat(1.0 / psi_norm) << std::endl;
  }
  asymVec->scale(1.0 / psi_norm);

  if (perturbSoln) {
    if (globalData->locaUtils->isPrintType(NOX::Utils::StepperDetails)) {
     globalData->locaUtils->out() << 
       "\tIn LOCA::Pitchfork::MooreSpence::ExtendedGroup::init(), " << 
       "applying random perturbation to initial solution of size: " << 
       globalData->locaUtils->sciformat(perturbSize) << endl;
    }
    Teuchos::RCP<NOX::Abstract::Vector> perturb = 
      xVec->getXVec()->clone(NOX::ShapeCopy);
    perturb->random();
    perturb->scale(*(xVec->getXVec()));
    xVec->getXVec()->update(perturbSize, *perturb, 1.0);
    grpPtr->setX(*(xVec->getXVec()));
  }
}
void
LOCA::TurningPoint::MooreSpence::ExtendedGroup::init(bool perturbSoln, 
						     double perturbSize)
{
  xVec->getBifParam() = getBifParam();

  // Rescale null vector
  scaleNullVector(*lengthVec);

  // Rescale length vector so that the normalization condition is met
  double lVecDotNullVec = lTransNorm(*(xVec->getNullVec()));

  if (lVecDotNullVec == 0.0) {
    globalData->locaErrorCheck->throwError(
		   "LOCA::TurningPoint::MooreSpence::ExtendedGroup::init()",
		   "null vector can be orthogonal to length-scaling vector");
  }
  if (globalData->locaUtils->isPrintType(NOX::Utils::StepperDetails)) {
    globalData->locaUtils->out() << 
      "\tIn LOCA::TurningPoint::MooreSpence::ExtendedGroup::init(), " << 
      "scaling null vector by:" << 
      globalData->locaUtils->sciformat(1.0 / lVecDotNullVec) << std::endl;
  }
  xVec->getNullVec()->scale(1.0/lVecDotNullVec);

  if (perturbSoln) {
    if (globalData->locaUtils->isPrintType(NOX::Utils::StepperDetails)) {
     globalData->locaUtils->out() << 
       "\tIn LOCA::TurningPoint::MooreSpence::ExtendedGroup::init(), " << 
       "applying random perturbation to initial solution of size: " << 
       globalData->locaUtils->sciformat(perturbSize) << endl;
    }
    Teuchos::RCP<NOX::Abstract::Vector> perturb = 
      xVec->getXVec()->clone(NOX::ShapeCopy);
    perturb->random();
    perturb->scale(*(xVec->getXVec()));
    xVec->getXVec()->update(perturbSize, *perturb, 1.0);
    grpPtr->setX(*(xVec->getXVec()));
  }
}