Thanks Daniel. I will try the first approach. My time dependent Function class returns an update and not a new value. Actually, I am trying to solve a free surface flow problem with moving mesh(for very small displacements). I am implementing the flow and mesh movement in a decoupled way. So at the end of every time step I get the flow solution(velocity and pressure). So I advect(displace) the free surface vertices as (U_{t_n} + U_{t_{n+1}})*time_step/2. This is the incremental displacement which I want to add to previous displacements. I use this free surface boundary displacements to solve for the interior vertices displacements using a simple 'laplacian'(which is linear and thus laplacian_system_matrix is assembled only once). And finally apply these displacements to the entire (initial)mesh. Of course all this can be done using just incremental displacements instead of cumulative displacement(as I am moving the mesh anyway at every time step), I just want to try with cumulative.
I will revert for any further clarifications. Thanks, Bhanu. On Monday, December 4, 2017 at 4:54:11 PM UTC+5:30, Daniel Arndt wrote: > > Bhanu, > > [...] >> VectorTools::interpolate_boundary_values(move_dof_handler, 106, >> move_boundary_values_function, move_boundary_values); >> MatrixTools::apply_boundary_values(move_boundary_values, >> move_system_matrix, move_solution, move_system_rhs); >> >> instead of 'constraints'. >> Now, I have to add the current time step dirichlet values to the >> 'previous cumulative dirichlet values at this boundary' in my >> 'move_boundary_values_function' object of type 'template <int dim> class >> MoveBoundaryValues106 : public Function<dim>'. How can I accomplish this in >> my member function >> >> template <int dim> >> void MoveBoundaryValues106<dim>::vector_value(const Point<dim> &p, >> Vector<double> &values) const >> { >> // std::vector<Tensor<1,dim>> >> previouscumulative(n_boundary_dofs_of_type_106); >> const double time = this->get_time(); >> previuouscumulative += get_function_values(); >> >> values[0] = previouscumulative[]; >> values[1] = previouscumulative[]; >> values[2] = previouscumulative[]; >> values[3] = previouscumulative[]; >> } >> > So you have a time-dependent Function class that only returns an update > instead of the new value? > In this case, I would still call > > VectorTools::interpolate_boundary_values(move_dof_handler, 106, > move_boundary_values_function, move_boundary_values_update); > > and add to the previous vector > > for (auto& it=move_boundary_values.begin(); > it!=move_boundary_values.end(); ++it) > it->second += move_boundary_values_update[it->first]; > > Since move_boundary_values are also just the boundary values for your > previous solution, you could also compute move_boundary_values on the fly > by extracting the boundary DoFs using DoFTools::extract_boundary_dofs > <https://www.dealii.org/8.5.1/doxygen/deal.II/namespaceDoFTools.html#ad3067f335a97de429176178689222f3a> > > and accessing the respective values in the solution vector, i.e. > > for (const IndexSet::ElementIterator& it=boundary_dofs.begin(); > it!=boundary_dofs.end(); ++it) > move_boundary_values[*it] = solution(*it) + > move_boundary_values_update[*it]; > > This is also the approach you would need to use if you want to refine your > mesh between time steps. > > All of this would of course be much simpler if your Function class would > simply return the actual values and not just an update. > > 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.