Hello,

I'm trying to write a code in deal.II to solve a moving boundary problem, where 
the boundary moves according to the velocity field $\mathbf{v}$.  After solving 
at each timestep, I want to interpolate the "old_solution" onto the new grid.  
However, I am unsure about how to go about this.  I can move the mesh as in 
step-18, but this does not include interpolation of the solution?  I was 
thinking of using FEFieldFunction, but triangulation2 needs to be entirely 
included within triangulation1, but if the boundary is moving, this may not be  
the case.  

I tried using something like 

------------------------------------------------------------------------------------------------------------------------------------------

BlockVector<double> x_sol = solution;
SolutionTransfer<dim, BlockVector<double> > solution_transfer(dof_handler);

for (typename DoFHandler<dim>::active_cell_iterator
           cell = dof_handler.begin_active ();
         cell != dof_handler.end(); ++cell)
    {
      for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
      {
        if (vertex_touched[cell->vertex_index(v)] == false)
          {
            vertex_touched[cell->vertex_index(v)] = true;
            Point<dim> vertex_displacement;
            for (unsigned int d=0; d<dim; ++d)
            {
              vertex_displacement[d] = 
time_step*solution(cell->vertex_dof_index(v,d));
            }
            cell->vertex(v) += vertex_displacement;
          }
      }
    }

solution_transfer.interpolate(x_sol, solution);


--------------------------------------------------------------------------------------------------------------------

but even if I redistributed dofs etc, I still get the error

void dealii::SolutionTransfer<dim, VECTOR, DH>::interpolate(const VECTOR&, 
VECTOR&) const [with int dim = 2, VECTOR = dealii::BlockVector<double>, DH = 
dealii::DoFHandler<2>]
The violated condition was: 
    in.size()==n_dofs_old
The name and call sequence of the exception was:
    ExcDimensionMismatch(in.size(), n_dofs_old)
Additional Information: 
Dimension 3202 not equal to 0

which I don't really understand, as my "n_dofs_old" should have size 3202 as 
well, as the mesh is just moved! May be I have missed something quite simple.

Any help would be greatly appreciated :)

Thanks and have a good weekend!

Katie



Katie Leonard

DPhil student in Computational Biology,
The University of Oxford.
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to