I am adding here an attempt I made. It seems to work but since this was
more intuition rather than full understanding, I do appreciate your
comments.
So, this is what I did: basically, I created two Dirichlet boundary
conditions and two masks, and I applied conditions in sequence, like this:
// Dirichlet bcs
// -------------
PETScWrappers::MPI::Vector tmp (locally_owned_dofs,mpi_communicator);
// Dirichlet bc for displacements
{
std::map<types::global_dof_index,double> boundary_values;
ComponentMask displacements_mask = fe.component_mask (displacements);
VectorTools::interpolate_boundary_values (dof_handler,
0,
IncrementalDirichletBoundaryValues<dim>( TIDM, NRit, GPDofs ),
boundary_values,
displacements_mask);
MatrixTools::apply_boundary_values (boundary_values,
system_matrix,
tmp,
system_rhs,
false);
}
// Dirichlet bc for concentrations
{
std::map<types::global_dof_index,double> boundary_values;
ComponentMask displacements_mask = fe.component_mask (concentration);
VectorTools::interpolate_boundary_values (dof_handler,
0,
IncrementalDirichletBoundaryValuesForConcentration<dim>( TIDM, NRit, GPDofs
),
boundary_values,
displacements_mask);
PETScWrappers::MPI::Vector tmp (locally_owned_dofs,mpi_communicator);
MatrixTools::apply_boundary_values (boundary_values,
system_matrix,
tmp,
system_rhs,
false);
}
incremental_displacement = tmp;
Within the classes IncrementalDirichletBoundaryValuesForConcentration
I have returned something like:
template <int dim>
void
IncrementalDirichletBoundaryValuesForConcentration<dim>::
vector_value (const Point<dim> & p ,
Vector<double> & return_value) const
{
static const unsigned int c_component = dim + 2;
return_value( c_component ) = ... ;
}
Does it make sense?
Thanks
Alberto
Il giorno mercoledì 31 maggio 2017 17:48:13 UTC-4, Alberto Salvadori ha
scritto:
>
> Dear all,
>
> your help is appreciated about how component mask and Dirichlet bc
> application work.
>
> I am implementing a SmallStrainDiffusionMechanicalProblem class, with 4
> fields: displacements, pressure, dilatation, and concentration.
>
> template <int dim>
>
> class SmallStrainDiffusionMechanicalProblem
>
> {
>
> ...
>
>
> // dofs definiton and dofs block enumeration
>
> // dim = displacements dofs
>
> // 1 = p
>
> // 1 = J
>
> // 1 = c ( interstitial concentration )
>
> const unsigned int GPDofs = dim + 3;
>
>
> static const unsigned int first_u_component = 0;
>
> static const unsigned int p_component = dim;
>
> static const unsigned int J_component = dim + 1;
>
> static const unsigned int c_component = dim + 2;
>
>
> enum
>
> {
>
> u_dof = 0, // displacement block ( dim components )
>
> p_dof = 1, // pressure block ( one component )
>
> J_dof = 2, // dilatation block ( one component )
>
> c_dof = 3 // concentration block ( one component )
>
> };
>
>
>
> ...
>
> }
>
>
> In a former implementation that did not include concentration fields, in
> order to impose bc to the vector solution incremental_displacement, I
> have edited some code from the tutorials, like this:
>
>
> const FEValuesExtractors::Vector displacements (first_u_component);
>
> const FEValuesExtractors::Scalar pressure(p_component);
>
> const FEValuesExtractors::Scalar dilatation(J_component);
>
> const FEValuesExtractors::Scalar concentration(c_component);
>
> ......
>
> std::map<types::global_dof_index,double> boundary_values;
>
>
> ComponentMask displacements_mask = fe.component_mask (displacements);
>
> VectorTools::interpolate_boundary_values (dof_handler,
>
> 0,
>
>
> IncrementalDirichletBoundaryValues<dim>( TIDM, NRit, GPDofs ),
>
> boundary_values,
>
> displacements_mask);
>
>
>
> PETScWrappers::MPI::Vector tmp (locally_owned_dofs,mpi_communicator);
>
> MatrixTools::apply_boundary_values (boundary_values,
>
> system_matrix,
>
> tmp,
>
> system_rhs,
>
> false);
>
> incremental_displacement = tmp;
>
> I would now impose Dirichlet bc on both displacements and concentrations
> and assume that the Dirichlet boundary for both fields is the same. Shall I
> therefore change the mask, I assume. Can it be done like this?
>
> ComponentMask displacements_mask = fe.component_mask (displacements,
> concentrations);
>
> or shall two masks be defined or even else?
>
> Many thanks!
> Alberto
>
>
--
Informativa sulla Privacy: http://www.unibs.it/node/8155
--
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.