IndexSet locally_relevant_dofs;
unsigned int number_iterations;
- std::vector<double> run_time;
ConstraintMatrix constraints;
ConstraintMatrix constraints_hanging_nodes;
TrilinosWrappers::PreconditionAMG::AdditionalData additional_data;
TrilinosWrappers::PreconditionAMG preconditioner_u;
- TrilinosWrappers::PreconditionAMG preconditioner_t;
std::unique_ptr<Input<dim> > input_obstacle;
std::unique_ptr<ConstitutiveLaw<dim> > plast_lin_hard;
double gamma; // Parameter for the linear isotropic hardening
double e_modul; // E-Modul
double nu; // Poisson ratio
+
+ TimerOutput computing_timer;
};
// As explained above this class
yield = 0;
stress_strain_tensor = stress_strain_tensor_mu;
double beta = 1.0;
- if (deviator_stress_tensor_norm >
- sigma_0)
+ if (deviator_stress_tensor_norm > sigma_0)
{
-// beta = (sigma_0 + gamma/(2*mu + gamma)*(deviator_stress_tensor_norm - sigma_0))/deviator_stress_tensor_norm;
beta = sigma_0/deviator_stress_tensor_norm;
stress_strain_tensor *= (gamma + (1 - gamma)*beta);
yield = 1;
stress_strain_tensor = stress_strain_tensor_mu;
stress_strain_tensor_linearized = stress_strain_tensor_mu;
double beta = 1.0;
- if (deviator_stress_tensor_norm >
- sigma_0)
+ if (deviator_stress_tensor_norm > sigma_0)
{
-// beta = (sigma_0 + gamma/(2*mu + gamma)*(deviator_stress_tensor_norm - sigma_0))/deviator_stress_tensor_norm;
beta = sigma_0/deviator_stress_tensor_norm;
stress_strain_tensor *= (gamma + (1 - gamma)*beta);
stress_strain_tensor_linearized *= (gamma + (1 - gamma)*beta);
deviator_stress_tensor /= deviator_stress_tensor_norm;
stress_strain_tensor_linearized -= (1 - gamma)*beta*2*mu*outer_product(deviator_stress_tensor, deviator_stress_tensor);
-
-// std::cout << "Plastisch mit beta = " << beta
-// << ", sigma_0 = " << sigma_0
-// << std::endl;
}
stress_strain_tensor += stress_strain_tensor_kappa;
sigma_0 (400),
gamma (0.01),
e_modul (2.0e+5),
- nu (0.3)
+ nu (0.3),
+ computing_timer (pcout,
+ TimerOutput::summary,
+ TimerOutput::wall_times)
{
// double _E, double _nu, double _sigma_0, double _gamma
plast_lin_hard.reset (new ConstitutiveLaw<dim> (e_modul, nu, sigma_0, gamma, mpi_communicator, pcout));
template <int dim>
void PlasticityContactProblem<dim>::assemble_nl_system (TrilinosWrappers::MPI::Vector &u)
{
+ computing_timer.enter_section("Assembling");
+
QGauss<dim> quadrature_formula(2);
QGauss<dim-1> face_quadrature_formula(2);
system_matrix_newton.compress ();
system_rhs_newton.compress (VectorOperation::add);
+
+ computing_timer.exit_section("Assembling");
}
template <int dim>
template <int dim>
void PlasticityContactProblem<dim>::update_solution_and_constraints ()
{
- clock_t start_proj, end_proj;
+ computing_timer.enter_section("Update solution and constraints");
const EquationData::Obstacle<dim> obstacle (input_obstacle);
std::vector<bool> vertex_touched (dof_handler.n_dofs (), false);
constraints.close ();
constraints.merge (constraints_dirichlet_hanging_nodes);
+
+ computing_timer.exit_section("Update solution and constraints");
}
// @sect4{PlasticityContactProblem::dirichlet_constraints}
template <int dim>
void PlasticityContactProblem<dim>::solve ()
{
- Timer t;
+ computing_timer.enter_section ("Solving and Preconditioning");
TrilinosWrappers::MPI::Vector distributed_solution (system_rhs_newton);
distributed_solution = solution;
distributed_solution.compress(VectorOperation::insert);
system_rhs_newton.compress(VectorOperation::insert);
- MPI_Barrier (mpi_communicator);
- t.restart();
+ computing_timer.enter_section("Preconditioning");
preconditioner_u.initialize (system_matrix_newton, additional_data);
- MPI_Barrier (mpi_communicator);
- t.stop();
- if (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)
- run_time[6] += t.wall_time();
+ computing_timer.exit_section("Preconditioning");
- MPI_Barrier (mpi_communicator);
- t.restart();
+ computing_timer.enter_section("Solving");
PrimitiveVectorMemory<TrilinosWrappers::MPI::Vector> mem;
TrilinosWrappers::MPI::Vector tmp (system_rhs_newton);
<< " FGMRES iterations."
<< std::endl;
- MPI_Barrier (mpi_communicator);
- t.stop();
- if (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)
- run_time[7] += t.wall_time();
+ computing_timer.exit_section("Solving");
number_iterations += solver_control.last_step();
constraints.distribute (distributed_solution);
solution = distributed_solution;
+
+ computing_timer.exit_section("Solving and Preconditioning");
}
double resid_old=100000;
TrilinosWrappers::MPI::Vector res (system_rhs_newton);
TrilinosWrappers::MPI::Vector tmp_vector (system_rhs_newton);
- Timer t;
std::vector<std::vector<bool> > constant_modes;
DoFTools::extract_constant_modes (dof_handler,
pcout<< " Newton iteration " << j <<std::endl;
pcout<< " Updating active set..." <<std::endl;
- MPI_Barrier (mpi_communicator);
- t.restart();
-
update_solution_and_constraints ();
- MPI_Barrier (mpi_communicator);
- t.stop();
- if (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)
- run_time[5] += t.wall_time();
-
pcout<< " Assembling system... " <<std::endl;
- MPI_Barrier (mpi_communicator);
- t.restart();
system_matrix_newton = 0;
system_rhs_newton = 0;
assemble_nl_system (solution); //compute Newton-Matrix
- MPI_Barrier (mpi_communicator);
- t.stop();
- if (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)
- run_time[1] += t.wall_time();
number_assemble_system += 1;
- MPI_Barrier (mpi_communicator);
- t.restart();
pcout<< " Solving system... " <<std::endl;
solve ();
- MPI_Barrier (mpi_communicator);
- t.stop();
- if (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)
- run_time[2] += t.wall_time();
TrilinosWrappers::MPI::Vector distributed_solution (system_rhs_newton);
distributed_solution = solution;
// constraints.distribute (old_solution);
old_solution.compress (VectorOperation::add);
- MPI_Barrier (mpi_communicator);
- t.restart();
+ computing_timer.enter_section("Residual and lambda");
+
system_rhs_newton = 0;
solution = old_solution;
if (resid<resid_old)
damped=1;
- MPI_Barrier (mpi_communicator);
- t.stop();
- if (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)
- run_time[3] += t.wall_time();
+ computing_timer.exit_section("Residual and lambda");
pcout << " Residual of the non-contact part of the system: " << resid
<< std::endl
input_obstacle.reset (new Input<dim>("obstacle_file.pbm"));
pcout << "Ostacle is available now." << std::endl;
- Timer t;
- run_time.resize (8);
-
const unsigned int n_cycles = 6;
for (unsigned int cycle=0; cycle<n_cycles; ++cycle)
{
+ computing_timer.enter_section("Mesh refinement and setup system");
+
pcout << "" <<std::endl;
pcout << "Cycle " << cycle << ':' << std::endl;
- MPI_Barrier (mpi_communicator);
- t.restart();
-
if (cycle == 0)
{
make_grid();
setup_system ();
- MPI_Barrier (mpi_communicator);
- t.stop();
- run_time[0] += t.wall_time();;
+ computing_timer.exit_section("Mesh refinement and setup system");
solve_newton ();
pcout<< " Writing graphical output..." <<std::endl;
- MPI_Barrier (mpi_communicator);
- t.restart();
+ computing_timer.enter_section("Graphical output");
+
std::ostringstream filename_solution;
filename_solution << "solution-";
filename_solution << cycle;
output_results (filename_solution.str ());
- MPI_Barrier (mpi_communicator);
- t.stop();
- if (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)
- run_time[4] += t.wall_time();
-
- pcout << " Computing time for:" << std::endl
- << " making grid and setup = " << run_time[0] << std::endl
- << " updating active set = " << run_time[5] <<std::endl
- << " assembling system = " << run_time[1] <<std::endl
- << " solving system = " << run_time[2] <<std::endl
- << " preconditioning = " << run_time[6] <<std::endl
- << " solving with FGMRES = " << run_time[7] <<std::endl
- << " computing error and lambda = " << run_time[3] <<std::endl
- << " writing graphical output = " << run_time[4] <<std::endl;
+
+ computing_timer.exit_section("Graphical output");
+
+ computing_timer.print_summary();
}
}
}