So I think I finally figured out the issue but I still wanted to bring this up to help others and b/c the documentation seems a bit unintuitive to me. I took step-20 and modified it to have:
- 2 scalar diffusion equations with FE_Q for both components - Dirichlet BC on the left wall (boundary ID 1) with Functions::ConstantFunction() - Neumann BC on the right wall (boundary ID 2) When trying to implement the Dirichlet BCs I used: dealii::FEValuesExtractors::Scalar const var1(0); dealii::FEValuesExtractors::Scalar const var2(1); dealii::ComponentMask const var1Mask = fe.component_mask(var1); dealii::ComponentMask const var2Mask = fe.component_mask(var2); dealii::VectorTools::interpolate_boundary_values(dof_handler, 1, dealii::Functions::ConstantFunction<dim>(1.0), boundary_values, var1Mask); dealii::VectorTools::interpolate_boundary_values(dof_handler, 1, dealii::Functions::ConstantFunction<dim>(2.0), boundary_values, var2Mask); Var1 displays the correct BC in the vtu file but Var2 displays results as if a BC of 0.0 was used instead of 2.0. The fix seems to be that you need to actually use: dealii::VectorTools::interpolate_boundary_values(dof_handler, 1, dealii::Functions::ConstantFunction<dim>(2.0, *X*), boundary_values, var2Mask); where X >= (varIndex+1); i.e. 1 & 2 for var1 & var2 respectively. Looking at the documentation for ConstantFunction <https://www.dealii.org/current/doxygen/deal.II/classFunctions_1_1ConstantFunction.html#a97c9eeab728d22be4b3dddb351d8e754> I'd assume that the default value of 1 along with the ComponentMask would be sufficient to apply the BC since I only need a ConstantFunction of size 1 and the ComponentMask would then determine which component(s) to apply this value to. However, it appears you need a ConstantFunction with a size of ComponentMask+1 so the mask can access the ConstantFunction component(s) matching the ComponentMask(s). I also attached my modified step-20 for others to see where I was playing around with interpolate_boundary_values() in make_grid_and_dofs(). Hope this helps, Chad -- 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/d7ba3fa9-74f8-43d9-8f62-55db5421d1f7n%40googlegroups.com.
step-20b.tar.gz
Description: GNU Zip compressed data
