IndexSet solution_relevant_partitioning(dof_handler.n_dofs());
DoFTools::extract_locally_relevant_dofs(dof_handler, solution_relevant_partitioning);
LinearAlgebraTrilinos::MPI::Vector completely_distributed_solution(dof_handler.locally_owned_dofs(), mpi_communicator);
LinearAlgebraTrilinos::MPI::Vector completely_distributed_update(dof_handler.locally_owned_dofs(), mpi_communicator);
completely_distributed_solution = present_solution;
SolverControl solver_control (dof_handler.n_dofs(),
(system_rhs.l2_norm() > 0) ? 1e-6 * system_rhs.l2_norm() : 1e-6);
LinearAlgebraTrilinos::SolverGMRES solver (solver_control);
LinearAlgebraTrilinos::MPI::PreconditionAMG preconditioner;
LinearAlgebraTrilinos::MPI::PreconditionAMG::AdditionalData data;
print_status_update("Initializing system matrix with preconditioner\n");
preconditioner.initialize(system_matrix, data);
print_status_update("Solving\n");
solver.solve (system_matrix, completely_distributed_update, system_rhs,
preconditioner);
print_status_update("Solving done\n");
hanging_node_constraints.distribute (completely_distributed_update);
print_status_update("Adding to newton\n");
newton_update = completely_distributed_update;
newton_update.compress(VectorOperation::insert);
const double alpha = determine_step_length();
completely_distributed_solution.add (alpha, completely_distributed_update);
present_solution = completely_distributed_solution;
template <int dim>
class InitialValues : public Function<dim>
{
public:
InitialValues () : Function<dim>() {}
virtual double value(const Point<dim> &p, const unsigned int component) const;
};
template <int dim>
double InitialValues<dim>::value(const Point<dim> &p, const unsigned int component) const
{
return OFFSET;
}
//In run-function
LinearAlgebraTrilinos::MPI::Vector local_solution;
local_solution.reinit(dof_handler.locally_owned_dofs(), mpi_communicator);
VectorTools::project (dof_handler,
boundary_constraints,
QGauss<dim>(fe.degree+2),
InitialValues<dim>(),
local_solution);
//boundary_constraints.distribute(local_solution);
present_solution = local_solution;
An error occurred in line <522> of file </home/roland/Downloads/dealii/source/lac/trilinos_solver.cc> in function
void dealii::TrilinosWrappers::SolverBase::do_solve(const Preconditioner&) [with Preconditioner = dealii::TrilinosWrappers::PreconditionBase]
The violated condition was:
false
Additional information:
AztecOO::Iterate error code -3: loss of precision
template <int dim>
class BoundaryValues : public Function<dim>
{
public:
BoundaryValues () : Function<dim>() {}
virtual double value (const Point<dim> &p,
const unsigned int component = 0) const;
};
template <int dim>
double BoundaryValues<dim>::value (const Point<dim> &p,
const unsigned int /*component*/) const
{
return std::sin(2 * numbers::PI * (p[0]+p[1])) + OFFSET;
}
newton_constraints.clear();
newton_constraints.reinit(solution_relevant_partitioning);
DoFTools::make_hanging_node_constraints(dof_handler, newton_constraints);
VectorTools::interpolate_boundary_values(dof_handler, 0, ZeroFunction<dim>(), newton_constraints);
newton_constraints.close();
newton_constraints.distribute_local_to_global(cell_residual, local_dof_indices, local_residual);
newton_constraints.distribute_local_to_global(cell_matrix, cell_rhs, local_dof_indices, system_matrix, system_rhs);
Your assumption is correct, I checked the shape of the surface after initialization. It looks (for OFFSET=2 and refine_global(2)) like
Setting the OFFSET-value to 10 while leaving refine_global at 2 results in
Here the drop is clearly visible (which presumably results in the calculation problems), but can not be removed with higher values for refine_global. As example using refine_global(4) and OFFSET=10: