hi, Dear Deal.II users,
I am using deal.II to solve for a simple flow with multiple inlets
where I need to impose Pouseuille BC (dirichlet) with different magnitudes.
I used to use the following piece of code together with
VectorTools::interpolate_boundary_values
to work for one BC. This is rather hard-coded, where I know the maximum
velocity of this the BC, the locations of the BC, which is ok for only one.
Now the issue arises if i have around 10 inlets to impose, these inlets
can in general have different positions, velocity magnitudes and channel
widths. I can also duplicate the following codes 10 times and customize
each corresponding to each inlet. However, this does not sound so elegant,
may I ask whether there might be some smarter way to achieve this?
Thanks in advance,
best,
lailai
template <int dim>
class PoiseuilleBoundaryValues : public Function<dim>
{
public:
PoiseuilleBoundaryValues () : Function<dim>(dim+1) {}
virtual double value (const Point<dim> &p,
const unsigned int component = 0) const;
virtual void vector_value (const Point<dim> &p,
Vector<double> &value) const;
};
template <int dim>
double
PoiseuilleBoundaryValues<dim>::value (const Point<dim> &p,
const unsigned int component) const
{
Assert (component < this->n_components,
ExcIndexRange (component, 0, this->n_components));
double umax = 1.5;
if (component == 0)
return
umax*(1-pow(2*p[1]/(UserGeometry::y_bottom-UserGeometry::y_top),2));
return 0;
}
template <int dim>
void
PoiseuilleBoundaryValues<dim>::vector_value (const Point<dim> &p,
Vector<double> &values) const
{
for (unsigned int c=0; c<this->n_components; ++c)
values(c) = PoiseuilleBoundaryValues<dim>::value (p, c);
}
--
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].
For more options, visit https://groups.google.com/d/optout.