///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// Test mesh distribution in parallel, starting with n_uniform_first uniform refinments before starting the distribution. Then refine and unrefine uniformly as specified. Re-distribute after every uniform refinement if requested by the boolean flag.
318 << std::endl << std::endl
319 <<
"Running with " << n_refine_first <<
" initial serial refinements and \n"
320 <<
"with " << n_refine_once_distributed
321 <<
" subsequent distributed refinements"
322 << std::endl << std::endl;
324 double av_efficiency;
325 double max_efficiency;
326 double min_efficiency;
327 double av_number_halo_nodes;
328 unsigned max_number_halo_nodes;
329 unsigned min_number_halo_nodes;
332 std::ofstream some_file;
351 unsigned n_dof_orig=problem_pt->
ndof();
352 unsigned n_dof=problem_pt->
ndof();
357 clock_t t_start = clock();
358 for (
unsigned i=0;
i<n_refine_first;
i++)
363 clock_t t_end = clock();
369 double t_tot=
double(t_end-t_start)/CLOCKS_PER_SEC;
370 oomph_info <<
"Time for initial adaptation [ndof=" << problem_pt->
ndof()
371 <<
"]: " << t_tot << std::endl;
373 n_dof=problem_pt->
ndof();
376 "%s/three_d_initial_refinement_nrefinement_%i_ndofbefore_%i_ndofafter_%i.dat",
382 some_file << n_refine_first <<
" "
397 std::ifstream input_file;
398 std::ofstream output_file;
401 unsigned n_partition=problem_pt->
mesh_pt()->nelement();
403 sprintf(
filename,
"three_d_mesh_dist_partition.dat");
406 for (
unsigned e=0;
e<n_partition;
e++)
408 getline(input_file,input_string,
'\n');
409 element_partition[
e]=atoi(input_string.c_str());
413 bool report_stats=
false;
414 problem_pt->distribute(element_partition,doc_info,report_stats);
428 problem_pt->distribute();
435 problem_pt->
mesh_pt()->get_halo_node_stats(av_number_halo_nodes,
436 max_number_halo_nodes,
437 min_number_halo_nodes);
438 problem_pt->
mesh_pt()->get_efficiency_of_mesh_distribution
439 (av_efficiency,max_efficiency,min_efficiency);
445 double t_tot=
double(t_end-t_start)/CLOCKS_PER_SEC;
446 oomph_info <<
"Time for problem distribution [ndof=" << problem_pt->
ndof()
447 <<
"]: " << t_tot << std::endl;
451 "%s/three_d_initial_distr_np_%i_nrefinement_%i_ndof_%i.dat",
457 some_file << n_proc <<
" "
460 << av_number_halo_nodes <<
" "
461 << max_number_halo_nodes <<
" "
462 << min_number_halo_nodes <<
" "
463 << av_efficiency <<
" "
464 << max_efficiency <<
" "
465 << min_efficiency <<
" "
473 problem_pt->check_halo_schemes(quiet_doc_info);
481 #ifdef OOMPH_HAS_TRILINOS
493 linear_solver_pt->
solver_type()=TrilinosAztecOOSolver::GMRES;
525 for (
unsigned i=0;
i<n_refine_once_distributed;
i++)
528 n_dof_orig=problem_pt->
ndof();
539 problem_pt->
mesh_pt()->get_halo_node_stats(av_number_halo_nodes,
540 max_number_halo_nodes,
541 min_number_halo_nodes);
542 problem_pt->
mesh_pt()->get_efficiency_of_mesh_distribution
543 (av_efficiency,max_efficiency,min_efficiency);
548 double t_tot=
double(t_end-t_start)/CLOCKS_PER_SEC;
549 oomph_info <<
"Time for distributed adaptation [ndof="
550 << problem_pt->
ndof()
551 <<
"]: " << t_tot << std::endl;
554 n_dof=problem_pt->
ndof();
558 if (!redistribute) snippet=
"out";
562 "%s/three_d_distributed_refinement_np_%i_ninitialrefinement_%i_ntotalrefinement_%i_ndof_%i_with%sredistribution.dat",
570 some_file << n_proc <<
" "
574 << av_number_halo_nodes <<
" "
575 << max_number_halo_nodes <<
" "
576 << min_number_halo_nodes <<
" "
577 << av_efficiency <<
" "
578 << max_efficiency <<
" "
579 << min_efficiency <<
" "
592 bool report_stats=
false;
594 problem_pt->prune_halo_elements_and_nodes(doc_info,
597 double t_tot=
double(t_end-t_start)/CLOCKS_PER_SEC;
603 oomph_info <<
"Av., min. max. efficiency before redistribution "
604 << av_efficiency <<
" "
605 << min_efficiency <<
" "
606 << max_efficiency <<
" "
610 "%s/three_d_redistribution_np_%i_ninitialrefinement_%i_ntotalrefinement_%i_ndof_%i.dat",
617 some_file << n_proc <<
" "
620 << av_number_halo_nodes <<
" "
621 << max_number_halo_nodes <<
" "
622 << min_number_halo_nodes <<
" "
623 << av_efficiency <<
" "
624 << max_efficiency <<
" "
625 << min_efficiency <<
" "
632 problem_pt->
mesh_pt()->get_halo_node_stats(av_number_halo_nodes,
633 max_number_halo_nodes,
634 min_number_halo_nodes);
636 get_efficiency_of_mesh_distribution(av_efficiency,
643 oomph_info <<
"Time for redistribution [ndof="
644 << problem_pt->
ndof()
645 <<
"]: " << t_tot << std::endl;
648 some_file << n_proc <<
" "
651 << av_number_halo_nodes <<
" "
652 << max_number_halo_nodes <<
" "
653 << min_number_halo_nodes <<
" "
654 << av_efficiency <<
" "
655 << max_efficiency <<
" "
656 << min_efficiency <<
" "
662 get_efficiency_of_mesh_distribution(av_efficiency,
665 oomph_info <<
"Av., min., max. efficiency after redistribution "
666 << av_efficiency <<
" "
667 << min_efficiency <<
" "
668 << max_efficiency <<
" "
675 problem_pt->check_halo_schemes(quiet_doc_info);
700 n_dof_orig=problem_pt->
ndof();
709 double t_tot=
double(t_end-t_start)/CLOCKS_PER_SEC;
710 oomph_info <<
"Time for distributed unrefinement [ndof="
711 << problem_pt->
ndof()
712 <<
"]: " << t_tot << std::endl;
715 n_dof=problem_pt->
ndof();
719 "%s/three_d_distributed_unrefinement_np_%i_ninitialrefinement_%i_ntotalrefinement_%i_ndof_%i.dat",
723 n_refine_first+n_refine_once_distributed,
726 some_file << n_proc <<
" "
730 << av_number_halo_nodes <<
" "
731 << max_number_halo_nodes <<
" "
732 << min_number_halo_nodes <<
" "
733 << av_efficiency <<
" "
734 << max_efficiency <<
" "
735 << min_efficiency <<
" "
743 problem_pt->check_halo_schemes(quiet_doc_info);
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Poisson problem.
Definition: three_d_mesh_dist.cc:133
void doc_solution(DocInfo &doc_info)
Doc the solution.
Definition: three_d_mesh_dist.cc:257
RefineableSimpleCubicMesh< ELEMENT > * mesh_pt()
Definition: three_d_mesh_dist.cc:146
Definition: oomph_utilities.h:499
void disable_doc()
Disable documentation.
Definition: oomph_utilities.h:542
std::string directory() const
Output directory.
Definition: oomph_utilities.h:524
void set_directory(const std::string &directory)
Definition: oomph_utilities.cc:298
Preconditioner *& preconditioner_pt()
Access function to preconditioner.
Definition: iterative_linear_solver.h:95
void disable_doc_time()
Disable documentation of solve times.
Definition: linear_solver.h:116
int my_rank() const
my rank
Definition: communicator.h:176
int nproc() const
number of processors
Definition: communicator.h:157
void refine_uniformly(const Vector< unsigned > &nrefine_for_mesh)
Definition: problem.h:2575
unsigned long ndof() const
Return the number of dofs.
Definition: problem.h:1674
unsigned unrefine_uniformly()
Definition: problem.cc:15831
OomphCommunicator * communicator_pt()
access function to the oomph-lib communicator
Definition: problem.h:1246
LinearSolver *& linear_solver_pt()
Return a pointer to the linear solver object.
Definition: problem.h:1466
void newton_solve()
Use Newton method to solve the problem.
Definition: problem.cc:8783
Definition: trilinos_solver.h:267
unsigned & solver_type()
Access function to Solver_type.
Definition: trilinos_solver.h:442
Definition: trilinos_preconditioners.h:152
string filename
Definition: MergeRestartFiles.py:39
void get_source(const Vector< double > &x, double &source)
Source function to make it an exact solution.
Definition: extrude_with_macro_element_representation.cc:224
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286