コード例 #1
0
ファイル: derivatives.cpp プロジェクト: shedsaw/ProteusCFD
void Perturb_Param(Int beta, Param<RCmplx>& param)
{ 
  Real h = 1.0e-11;
  RCmplx I(0.0, 1.0);
  RCmplx perturb = h*I;
  
  std::string designName = param.path+param.spacename;
  Int ndv = GetNdvDesignFile(designName);
  Real* x = new Real[ndv];
  Real* bounds = new Real[ndv*2];
  Real f;
  Real* grad = new Real[ndv];
  Int* dvType = new Int[ndv];

  ReadDesignFile(designName, &ndv, x, bounds, &f, grad, dvType); 

  Int parType = dvType[beta];

  if(parType == 0 || parType == 1 || parType == 2){
    //direct point movement x,y,z
  }
  else if(parType == 3 || parType == 4 || parType == 5){
    //hicks-henne functions
  }
  else if(parType == 6 || parType == 7 || parType == 8){
    //boundary movement x,y,z
  }
  else if(parType == 9){
    //x location gaussian plume
    param.gaussianXloc += perturb;
  }
  else if(parType == 10){
    //y location gaussian plume
    param.gaussianYloc += perturb;
  }
  else{
    //should never be here
    std::stringstream ss;
    ss << "In Perturb_Param() and design parameter type ";
    ss << parType;
    ss << " not found!";
    
    Abort << ss.str();
  }

  param.PostCompute();
  param.PrintSolverParams();
  
  delete [] x;
  delete [] bounds;
  delete [] grad;
  delete [] dvType;
}