On 10/14/23 21:01, Chad wrote:
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.
I am surprised this actually works. The boundary value function needs to have
the same number of vector components as the finite element in use. Are you
running your program in debug mode? You should have gotten an error message
with the code above.
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).
The general rule is that you need to pass function objects that have the same
number of components as the finite element in question -- regardless of
whether or not you are only evaluating some of the components. That's because
oftentimes you create function objects that will be used in a variety of
contexts (for boundary values of different kinds, computing the error,
evaluating error estimators, etc.) where sometimes you might apply a mask and
othertimes you don't.
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email: bange...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/
--
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 dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/dealii/9f8d708a-053d-5ee3-eee1-d17380509a79%40colostate.edu.