Hi,
I'm attempting to apply a displacement boundary condition on a surface in
my problem. However, I would like the direction of the displacement of
each point on the surface to depend on its direction from some point (for
example the origin). Imagine a balloon inflating where the displacement
direction is from the center of the balloon. My thought was to use a
function similar to the example boundary conditions in step 23 but extended
for 3 dimensions. I defined the following class in my code:
template
class BoundaryValuesU : public Function{
public:
virtual void vector_value(const Point & p, Vector )
const override
{
double xpos, ypos, zpos;
xpos = p[0];
ypos = p[1];
if (dim==3){zpos=p[2];}
else {zpos=0.0;}
values[0]
=
xpos/std::pow(std::pow(xpos,2.0)+std::pow(ypos,2.0)+std::pow(zpos,2.0),0.5)*0.1;
values[1]
=
ypos/std::pow(std::pow(xpos,2.0)+std::pow(ypos,2.0)+std::pow(zpos,2.0),0.5)*0.1;
values[2]
=
zpos/std::pow(std::pow(xpos,2.0)+std::pow(ypos,2.0)+std::pow(zpos,2.0),0.5)*0.1;
return;
}
};
Then I apply the boundary conditions in the following way to the surface
with boundary id 2:
std::vector uBC (3, true);
BoundaryValuesU boundary_values_u_function;
VectorTools::interpolate_boundary_values (dof_handler, 2,
boundary_values_u_function, constraints, uBC);
However, when I attempt to run with this case I get the following error:
An error occurred in line <2263> of file
in function
void
dealii::VectorToolsdo_interpolate_boundary_values(const
M_or_MC &, const DoFHandlerType &, const
std::map *,
std::less, std::allocator *>>> &, std::map, std::allocator>> &, const dealii::ComponentMask &) [with dim = 3, spacedim =
3, number = double, DoFHandlerType = dealii::DoFHandler, M_or_MC =
dealii::Mapping]
The violated condition was:
n_components == i->second->n_components
Additional information:
Dimension 3 not equal to 1.
Is there a way I am supposed to be initializing n_components in the class
to make this work? Or is this just the wrong way to be doing this?
Thank you.
--
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/e48e163e-048a-49f6-bca7-89fb10531b01%40googlegroups.com.