From 4014922db64eb426a224efca53c38c95f849ee4a Mon Sep 17 00:00:00 2001 From: bangerth Date: Fri, 18 Feb 2011 19:43:19 +0000 Subject: [PATCH] Make run with current setup. git-svn-id: https://svn.dealii.org/trunk@23398 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-46/step-46.cc | 49 +++++++++++++++++++---------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/deal.II/examples/step-46/step-46.cc b/deal.II/examples/step-46/step-46.cc index 64aef01aa9..a21d7ca381 100644 --- a/deal.II/examples/step-46/step-46.cc +++ b/deal.II/examples/step-46/step-46.cc @@ -36,6 +36,7 @@ #include #include +#include #include #include @@ -58,7 +59,8 @@ template class StokesProblem { public: - StokesProblem (const unsigned int stokes_degree); + StokesProblem (const unsigned int stokes_degree, + const unsigned int elasticity_degree); void run (); private: @@ -69,9 +71,11 @@ class StokesProblem void refine_mesh (); const unsigned int stokes_degree; + const unsigned int elasticity_degree; Triangulation triangulation; FESystem stokes_fe; + FESystem elasticity_fe; hp::FECollection fe_collection; hp::DoFHandler dof_handler; @@ -90,7 +94,7 @@ template class BoundaryValues : public Function { public: - BoundaryValues () : Function(dim+1) {} + BoundaryValues () : Function(dim+1+dim) {} virtual double value (const Point &p, const unsigned int component = 0) const; @@ -166,12 +170,18 @@ RightHandSide::vector_value (const Point &p, template -StokesProblem::StokesProblem (const unsigned int stokes_degree) +StokesProblem::StokesProblem (const unsigned int stokes_degree, + const unsigned int elasticity_degree) : stokes_degree (stokes_degree), + elasticity_degree (elasticity_degree), triangulation (Triangulation::maximum_smoothing), stokes_fe (FE_Q(stokes_degree+1), dim, - FE_Q(stokes_degree), 1), + FE_Q(stokes_degree), 1, + FE_Nothing(), dim), + elasticity_fe (FE_Nothing(), dim, + FE_Nothing(), 1, + FE_Q(elasticity_degree), dim), dof_handler (triangulation) { fe_collection.push_back (stokes_fe); @@ -185,17 +195,19 @@ void StokesProblem::setup_dofs () { system_matrix.clear (); + for (typename hp::DoFHandler::active_cell_iterator + cell = dof_handler.begin_active(); + cell != dof_handler.end(); ++cell) + cell->set_active_fe_index (0); + dof_handler.distribute_dofs (fe_collection); DoFRenumbering::Cuthill_McKee (dof_handler); - std::vector block_component (dim+1,0); - block_component[dim] = 1; - DoFRenumbering::component_wise (dof_handler, block_component); - { constraints.clear (); - std::vector component_mask (dim+1, true); - component_mask[dim] = false; + std::vector component_mask (dim+1+dim, false); + for (unsigned int d=0; d::output_results (const unsigned int refinement_cycle) const { std::vector solution_names (dim, "velocity"); solution_names.push_back ("pressure"); + for (unsigned int d=0; d data_component_interpretation (dim, DataComponentInterpretation::component_is_part_of_vector); data_component_interpretation .push_back (DataComponentInterpretation::component_is_scalar); + for (unsigned int d=0; d > data_out; data_out.attach_dof_handler (dof_handler); @@ -363,7 +380,7 @@ StokesProblem::refine_mesh () { Vector estimated_error_per_cell (triangulation.n_active_cells()); - std::vector component_mask (dim+1, false); + std::vector component_mask (dim+1+dim, false); component_mask[dim] = true; KellyErrorEstimator::estimate (dof_handler, QGauss(stokes_degree+1), @@ -384,15 +401,15 @@ template void StokesProblem::run () { GridGenerator::hyper_cube (triangulation, -1, 1); - for (typename Triangulation::active_cell_iterator cell = triangulation.begin_active(); cell != triangulation.end(); ++cell) for (unsigned int f=0; f::faces_per_cell; ++f) - if (cell->face(f)->center()[dim-1] == 1) + if (cell->face(f)->at_boundary() + && + (cell->face(f)->center()[dim-1] == 1)) cell->face(f)->set_all_boundary_indicators(1); - - triangulation.refine_global (3-dim); + triangulation.refine_global (2); for (unsigned int refinement_cycle = 0; refinement_cycle<6; ++refinement_cycle) @@ -424,7 +441,7 @@ int main () { deallog.depth_console (0); - StokesProblem<2> flow_problem(1); + StokesProblem<2> flow_problem(1, 1); flow_problem.run (); } catch (std::exception &exc) -- 2.39.5