Deal all, I have an issue implementing Dirichlet boundary conditions in a mixed pressure-displacement problem.
In step-20 there is an example for implementing pressure boundary conditions like that: *template <int dim>* *class PressureBoundaryValues : public Function <https://www.dealii.org/current/doxygen/deal.II/classFunction.html><dim>* * {* *public:* * PressureBoundaryValues()* * : Function <https://www.dealii.org/current/doxygen/deal.II/classFunction.html><dim>(1)* * {}* *virtual double value(const Point<dim> <https://www.dealii.org/current/doxygen/deal.II/classPoint.html> & p,* *const unsigned int component = 0) const override;* * };* *template <int dim>* *double RightHandSide<dim>::value(const Point<dim> <https://www.dealii.org/current/doxygen/deal.II/classPoint.html> & /*p*/,* *const unsigned int /*component*/) const* *{* *return 0;* *}* And later: * for (const auto &face : cell->face_iterators())* *if (face->at_boundary())* * {* * fe_face_values.reinit(cell, face);* * pressure_boundary_values.value_list(* * fe_face_values.get_quadrature_points <https://www.dealii.org/current/doxygen/deal.II/classFEValuesBase.html#ae41b67cfd48e02f6035e39c84f0fb47a>(), boundary_values);* *for (unsigned int q = 0; q < n_face_q_points; ++q)* *for (unsigned int i = 0; i < dofs_per_cell; ++i)* * local_rhs(i) += -(fe_face_values[velocities].value(i, q) * * * fe_face_values.normal_vector <https://www.dealii.org/current/doxygen/deal.II/classFEValuesBase.html#ac25ec6835799c3b6c7c842f8acb05eb3>(q) * * * boundary_values[q] * * * fe_face_values.JxW <https://www.dealii.org/current/doxygen/deal.II/classFEValuesBase.html#abade89efb068b71b7ced7082012a2441>(q));* * }* I was trying to follow the same logic, implementing displacement BC (want to set the displacement of certain nodes to zero). In this case I create the Boundary condition template as follows: template <int dim> class DisplBoundaryValues : public Function<dim, std::complex<double>> { public: DisplBoundaryValues() : Function<dim, std::complex<double>>(dim) {} virtual std::complex<double> value(const Point<dim> &p, const unsigned int component = 0) const override; virtual void vector_value(const Point<dim> &p, Vector<std::complex<double>> & value) const override; }; template <int dim> std::complex<double> DisplBoundaryValues<dim>::value(const Point<dim> & p, const unsigned int component) const { const std::complex<double> i = {0,1}; return 0.+0.*i; } template <int dim> void DisplBoundaryValues<dim>::vector_value(const Point<dim> &p, Vector<std::complex<double>> & values) const { for (unsigned int c = 0; c < this->n_components; ++c) { const std::complex<double> i = {0,1}; values(c) = 0.+0.*i; } } After that I am trying to apply the boundary values to the right hand side. This time i should use the *vector_value_list *instead of value_list to get the boundary values assigned. But I am confused about the further proceeding while implementing the locar_rhs part. How can I apply these boundary values in vector form so that the algorithm understands these values need to be assigned exactly to the displacement components? for (const auto &face : cell->face_iterators()) if (face->boundary_id()==2) { displ_boundary_values.*vector*_value_list( fe_face_values.get_quadrature_points(), d_boundary_values); for (unsigned int q = 0; q < n_face_q_points; ++q) for (unsigned int i = 0; i < dofs_per_cell; ++i) { std::cout << d_boundary_values[q]<< " "; *local_rhs*(i) += -porosity*(1.+Q[k]/R[k]) *d_boundary_values[q] *fe_face_values[pressure].value(i,q) *fe_face_values.JxW(q); } } Than you a lot for your time! Kind regards, Mariia Bronzova -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/61df161a-1212-403e-8db7-b589b17e1e41n%40googlegroups.com.
