Exemple #1
0
//-----------------------------------------------------------------------------
void dolfin::solve(const Equation& equation, Function& u,
                   std::vector<const DirichletBC*> bcs,
                   const double tol, GoalFunctional& M)

{
  // Solve linear problem
  if (equation.is_linear())
  {
    LinearVariationalProblem problem(*equation.lhs(), *equation.rhs(), u, bcs);
    AdaptiveLinearVariationalSolver solver(problem, M);
    solver.solve(tol);
  }
  else
  {
    // Raise error if the problem is nonlinear (for now)
    dolfin_error("solve.cpp",
                 "solve nonlinear variational problem adaptively",
                 "Nonlinear adaptive solve not implemented without Jacobian");
  }
}
Exemple #2
0
//-----------------------------------------------------------------------------
void dolfin::solve(const Equation& equation,
                   Function& u,
                   std::vector<const DirichletBC*> bcs,
                   const Form& J,
                   const double tol,
                   GoalFunctional& M)

{
  // Raise error if problem is linear
  if (equation.is_linear())
    dolfin_error("solve.cpp",
                 "solve nonlinear variational problem adaptively",
                 "Variational problem is linear");

  // Define nonlinear problem
  NonlinearVariationalProblem problem(*equation.lhs(), u, bcs, J);

  // Solve nonlinear problem adaptively
  AdaptiveNonlinearVariationalSolver solver(problem, M);
  solver.solve(tol);
}
Exemple #3
0
  //-----------------------------------------------------------------------------
  ViennaCLSolverIteratif::ViennaCLSolverIteratif( std::string preconditioner )
  {
   // Set preconditioner
    if ( preconditioner == "none" || preconditioner == "" )
      _preconditioner.reset( new ViennaCLPreconditionerNoPreconditioning(preconditioner) );
    else if ( preconditioner == "ilut" || preconditioner == "default" )
      _preconditioner.reset( new ViennaCLPreconditionerILUT(preconditioner) );
    else if ( preconditioner == "ilu0")
      _preconditioner.reset( new ViennaCLPreconditionerILU0(preconditioner) );
    else if ( preconditioner == "block_ilu0")
      _preconditioner.reset( new ViennaCLPreconditionerBlockILU0(preconditioner) );
    else if ( preconditioner == "block_ilut")
      _preconditioner.reset( new ViennaCLPreconditionerBlockILUT(preconditioner) );
    else if ( preconditioner == "jacobi")
      _preconditioner.reset( new ViennaCLPreconditionerJacobi(preconditioner) );
    else if ( preconditioner == "row_scaling")
      _preconditioner.reset( new ViennaCLPreconditionerRowScaling(preconditioner) );
    else
      dolfin_error("ViennaCLSolver.cpp",
		   "create ViennaCL preconditioner",
		   "Unknown preconditioner type (\"%s\")", preconditioner.c_str());
  };
Exemple #4
0
//-----------------------------------------------------------------------------
void dolfin::MPI::barrier()
{
  dolfin_error("MPI.cpp",
               "call MPI::barrier",
               "Your DOLFIN installation has been built without MPI support");
}
Exemple #5
0
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void dolfin::MPINonblocking::wait_all()
{
  dolfin_error("MPI.h",
               "call MPINonblocking::wait_all",
               "DOLFIN has been configured without MPI support");
}