From 423dae7b99dee077835d26dbbc01131cdc62643a Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 18 Feb 2011 01:53:30 +0000 Subject: [PATCH] Fix assembly of matrix. Set up like lid-driven cavity. git-svn-id: https://svn.dealii.org/trunk@23386 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-46/step-46.cc | 32 +++++++++-------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/deal.II/examples/step-46/step-46.cc b/deal.II/examples/step-46/step-46.cc index 5ad37baf86..a6e48b69dd 100644 --- a/deal.II/examples/step-46/step-46.cc +++ b/deal.II/examples/step-46/step-46.cc @@ -106,7 +106,7 @@ BoundaryValues::value (const Point &p, ExcIndexRange (component, 0, this->n_components)); if (component == 0) - return (p[0] < 0 ? -1 : (p[0] > 0 ? 1 : 0)); + return 1; return 0; } @@ -192,6 +192,11 @@ void StokesProblem::setup_dofs () component_mask[dim] = false; DoFTools::make_hanging_node_constraints (dof_handler, constraints); + VectorTools::interpolate_boundary_values (dof_handler, + 0, + ZeroFunction(dim+1), + constraints, + component_mask); VectorTools::interpolate_boundary_values (dof_handler, 1, BoundaryValues(), @@ -291,8 +296,7 @@ void StokesProblem::assemble_system () { local_matrix(i,j) += (phi_grads_u[i] * phi_grads_u[j] - div_phi_u[i] * phi_p[j] - - phi_p[i] * div_phi_u[j] - + phi_p[i] * phi_p[j]) + - phi_p[i] * div_phi_u[j]) * fe_values.JxW(q); } @@ -388,31 +392,15 @@ StokesProblem::refine_mesh () template void StokesProblem::run () { - { - std::vector subdivisions (dim, 1); - subdivisions[0] = 4; - - const Point bottom_left = (dim == 2 ? - Point(-2,-1) : - Point(-2,0,-1)); - const Point top_right = (dim == 2 ? - Point(2,0) : - Point(2,1,0)); - - GridGenerator::subdivided_hyper_rectangle (triangulation, - subdivisions, - bottom_left, - top_right); - } + 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] == 0) + if (cell->face(f)->center()[dim-1] == 1) cell->face(f)->set_all_boundary_indicators(1); - - + triangulation.refine_global (4-dim); for (unsigned int refinement_cycle = 0; refinement_cycle<6; -- 2.39.5