示例#1
0
    void MiscibilityLiveOil::R(const std::vector<PhaseVec>& pressures,
                               const std::vector<CompVec>& surfvol,
                               int phase,
                               std::vector<double>& output) const
    {
        ASSERT(pressures.size() == surfvol.size());
        int num = pressures.size();
        output.resize(num);
#pragma omp parallel for
        for (int i = 0; i < num; ++i) {
            output[i] = evalR(pressures[i][phase], surfvol[i]);
        }
    }
void ExampleApplication::evalModel( const InArgs& inArgs, const OutArgs& outArgs ) const
{
  const Epetra_Vector &x = *(inArgs.get_x());
  const double t = inArgs.get_t();
  const Epetra_Vector &lambda = *lambda_ptr_;
#ifdef EXAMPLEAPPLICATION_DEBUG
      std::cout << "----------------------------------------------------------------------" << std::endl;
      std::cout << "ExampleApplication::evalModel x = " << std::endl;
      x.Print(std::cout);
      std::cout << "ExampleApplication::evalModel lambda = " << std::endl;
      lambda.Print(std::cout);
#endif
  int localNumElements = x.MyLength();
  if(implicit_) 
  {
    const Epetra_Vector &x_dot = *inArgs.get_x_dot();
    if(outArgs.get_f().get()) 
    {
      Epetra_Vector &f = *outArgs.get_f();
      for (int i=0 ; i<localNumElements ; ++i)
      {
        f[i] = x_dot[i] - lambda[i]*x[i] - evalR(t,lambda[i],coeff_s_);
      }
#ifdef EXAMPLEAPPLICATION_DEBUG
      std::cout << "ExampleApplication::evalModel (implicit) x_dot = " << std::endl;
      x_dot.Print(std::cout);
      std::cout << "ExampleApplication::evalModel (implicit) f = " << std::endl;
      f.Print(std::cout);
#endif
    }
    Teuchos::RCP<Epetra_Operator> W;
    if( (W = outArgs.get_W()).get() ) {
      const double alpha = inArgs.get_alpha();
      const double beta = inArgs.get_beta();
      Epetra_CrsMatrix &crsW = Teuchos::dyn_cast<Epetra_CrsMatrix>(*W);
      double values[1];
      int indices[1];
      const int IB = epetra_map_ptr_->IndexBase();
      for( int i = 0; i < localNumElements; ++i ) 
      {
        values[0] = alpha - beta*lambda[i];
        indices[0] = i + IB;  // global column
        crsW.ReplaceGlobalValues(i + IB              // GlobalRow
                                 ,1                  // NumEntries
                                 ,values             // Values
                                 ,indices            // Indices
                                          );
      }
#ifdef EXAMPLEAPPLICATION_DEBUG
      std::cout << "ExampleApplication::evalModel (implicit) alpha, beta = " << std::endl;
      std::cout << "alpha = " << alpha << std::endl;
      std::cout << "beta = "  << beta  << std::endl;
      std::cout << "ExampleApplication::evalModel (implicit) W = " << std::endl;
      crsW.Print(std::cout);
#endif
    }
  }
  else 
  {
    Epetra_Vector &f = *outArgs.get_f();
    for (int i=0 ; i<localNumElements ; ++i)
    {
      f[i] = lambda[i]*x[i]+evalR(t,lambda[i],coeff_s_);
    }
#ifdef EXAMPLEAPPLICATION_DEBUG
    std::cout << "ExampleApplication::evalModel (explicit) f = " << std::endl;
    f.Print(std::cout);
#endif
  }
#ifdef EXAMPLEAPPLICATION_DEBUG
  std::cout << "----------------------------------------------------------------------" << std::endl;
#endif
}
示例#3
0
/** Restart program on host */
remote::Process remote::restart (Process deadProcess) {
	return evalR (bind (MFUN(process,restart), deadProcess.value.program), deadProcess.host);}
示例#4
0
 // Dissolved gas-oil ratio   
 double MiscibilityLiveOil::R(int /*region*/, double press, const surfvol_t& surfvol) const
 {
     return evalR(press, surfvol);
 }
示例#5
0
/** Launch program on remote host. Return remote reference to its process. */
remote::Process remote::launch (program::Program program, Host host) {
	return evalR (bind (MFUN(process,launch), program), host);}