Equivalent option for local_range() for Trilinos vectors

21 views
Skip to first unread message

Vivek Kumar

unread,
Jul 10, 2019, 8:02:43 PM7/10/19
to deal.II User Group
Hi all,

I had a legacy code were PETScWrappers::MPI::Vectors were used to for parallel computing. For very large problems, I was told to move to Trilinos. It was fairly easy to do so for most part of the code but I am stuck in the implementation of boundary values. Currently the boundary values are implemented as follows:

template<int dim>
void ElasticityEquation<dim>::apply_boundary_conditions(const double time, const double velocity)
{
// Begin timer
TimerOutput::Scope t(computing_timer, "Apply Boundary Condition");

boundary_values.clear();
VectorTools::interpolate_boundary_values (dof_handler,2,ZeroFunction<dim>(dim),boundary_values);

VectorTools::interpolate_boundary_values (dof_handler,3,BoundaryValues<dim>(time, velocity) , boundary_values);
// The range of owned dofs
std::pair<unsigned int, unsigned int> range = solution.local_range();

// Set the boundary conditions
for (typename std::map<unsigned int, double>::const_iterator i = boundary_values.begin(); i != boundary_values.end(); ++i){
if (i->first >= range.first && i->first < range.second){
completely_distributed_solution(i->first) = i->second;
}
}

completely_distributed_solution.compress(VectorOperation::insert);

hanging_constraints.distribute( completely_distributed_solution);

solution = completely_distributed_solution;
}


This used to work fine with PETSc but not with Trilinos. The issue seems to be the fact the Trilinos does not arrange the vector contiguous ranges of elements (https://www.dealii.org/current/doxygen/deal.II/classTrilinosWrappers_1_1MPI_1_1Vector.html#abcc22742227d63950cb0995223e6ee32) . Is there a standard workaround?

Thanks
Vivek

Daniel Arndt

unread,
Jul 10, 2019, 9:59:08 PM7/10/19
to dea...@googlegroups.com
Vivek,

just remove the line
if (i->first >= range.first && i->first < range.second)
VectorTools::interpolate_boundary_values should only set values for locally active degrees of freedom anyway.
As long as the values are consistent between different processes, this should work just fine.

Best,
Daniel


--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/73ea3ef9-b5f8-461d-81c0-e43c0b4d8fbb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vivek Kumar

unread,
Jul 11, 2019, 9:28:53 AM7/11/19
to deal.II User Group
Thanks Daniel, it worked.
To unsubscribe from this group and stop receiving emails from it, send an email to dea...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages