From: kronbichler Date: Tue, 2 Dec 2008 14:11:29 +0000 (+0000) Subject: Corrected an obvious error in time step calculation. Need to think about efficiency... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e9fa99a1914a20daa2e37afe154a4ce8adca589;p=dealii-svn.git Corrected an obvious error in time step calculation. Need to think about efficiency, though. git-svn-id: https://svn.dealii.org/trunk@17811 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-32/step-32.cc b/deal.II/examples/step-32/step-32.cc index 7f63ba7ade..df29bb2d36 100644 --- a/deal.II/examples/step-32/step-32.cc +++ b/deal.II/examples/step-32/step-32.cc @@ -388,7 +388,7 @@ double BoussinesqFlowProblem::get_maximal_velocity () const FEValues fe_values (stokes_fe, quadrature_formula, update_values); std::vector > stokes_values(n_q_points, Vector(dim+1)); - double max_velocity = 0; + double max_local_velocity = 0, max_velocity = 0; typename DoFHandler::active_cell_iterator cell = stokes_dof_handler.begin_active(), @@ -405,10 +405,12 @@ double BoussinesqFlowProblem::get_maximal_velocity () const for (unsigned int i=0; i::get_extrapolated_temperature_range () const if (timestep_number != 0) { - double min_temperature = (1. + time_step/old_time_step) * - old_temperature_solution.linfty_norm() - + - time_step/old_time_step * - old_old_temperature_solution.linfty_norm(), - max_temperature = -min_temperature; + double min_local_temperature = (1. + time_step/old_time_step) * + old_temperature_solution.linfty_norm() + + + time_step/old_time_step * + old_old_temperature_solution.linfty_norm(), + max_local_temperature = -min_local_temperature; typename DoFHandler::active_cell_iterator cell = temperature_dof_handler.begin_active(), @@ -455,17 +457,24 @@ BoussinesqFlowProblem::get_extrapolated_temperature_range () const (1. + time_step/old_time_step) * old_temperature_values[q]- time_step/old_time_step * old_old_temperature_values[q]; - min_temperature = std::min (min_temperature, temperature); - max_temperature = std::max (max_temperature, temperature); + min_local_temperature = std::min (min_local_temperature, + temperature); + max_local_temperature = std::max (max_local_temperature, + temperature); } } + double min_temperature, max_temperature; + + trilinos_communicator.MaxAll(&max_local_temperature, &max_temperature, 1); + trilinos_communicator.MaxAll(&min_local_temperature, &min_temperature, 1); + return std::make_pair(min_temperature, max_temperature); } else { - double min_temperature = old_temperature_solution.linfty_norm(), - max_temperature = -min_temperature; + double min_local_temperature = old_temperature_solution.linfty_norm(), + max_local_temperature = -min_local_temperature; typename DoFHandler::active_cell_iterator cell = temperature_dof_handler.begin_active(), @@ -480,11 +489,18 @@ BoussinesqFlowProblem::get_extrapolated_temperature_range () const { const double temperature = old_temperature_values[q]; - min_temperature = std::min (min_temperature, temperature); - max_temperature = std::max (max_temperature, temperature); + min_local_temperature = std::min (min_local_temperature, + temperature); + max_local_temperature = std::max (max_local_temperature, + temperature); } } + double min_temperature, max_temperature; + + trilinos_communicator.MaxAll(&max_local_temperature, &max_temperature, 1); + trilinos_communicator.MaxAll(&min_local_temperature, &min_temperature, 1); + return std::make_pair(min_temperature, max_temperature); } }