Junchao,

For what matters here, you are just interesting in how to deal with 
boundary constraints for a time-dependent problem.

I am not quite sure what your problem is. You have time-dependent boundary 
conditions so you want to use boundary
conditions corresponding to the correct time step. Why would you want to 
change the boundary conditions for an old solution?

The interpolated solution should already have the correct (old) boundary 
conditions.

Best,
Daniel


Am Freitag, 22. Juli 2016 00:34:10 UTC+2 schrieb Junchao Zhang:
>
> Hello,
>   I want to know how apply boundary constraints in a time-dependent, 
> adaptively refined and distributed memory code. In a time-step, I want 
> multiple refinements.  I could not find such an example in deal.II 
> tutorial. 
>   I have the following code, with questionable code in red.  Basically, 
> when transferring old solution, I need boundary constraints for one 
> time-step back. When assembling the system, I need boundary constraints for 
> the current time-step. But I don't know how to satisfy both.
>   
>       for (int time_step = 0; time_step < n_time_steps; time_step++) {
>        time += dt;
>        old_locally_relevant_solution = locally_relevant_solution;
>
>       for (int refine_step = 0; refine_step < n_refine_steps; 
> refine_step++) {
>          assemble_system(); // this function accesses 
> old_locally_relevant_solution and calls 
> constraints.distribute_local_to_global (...) to add local matrix to global 
> matrix.
>                                           // The boundary constraints 
> were computed for time - dt, i.e., one time-step back, however, here what 
> we need is boundary constraints for the current time step.
>          solve(); // update locally_relevant_solution
>
>          if (refine_step+1 < n_refine_steps) {
>             // Estimate Kelly errors;
>            ...
>             // Do triangulation, and transfer old solution from old mesh 
> to new mesh
>            triangulation.prepare_coarsening_and_refinement();
>            parallel::distributed::SolutionTransfer<dim, 
> PETScWrappers::MPI::Vector> soltrans(dof_handler);
>           
>  
> soltrans.prepare_for_coarsening_and_refinement(old_locally_relevant_solution);
>            triangulation.execute_coarsening_and_refinement ();
>
>            setup_system(); // reinit vector, matrix and constraints for 
> the new mesh. The boundary function is computed for time - dt, since that 
> is the time when old_locally_relevant_solution was computed
>
>            PETScWrappers::MPI::Vector 
> interpolated_solution(locally_owned_dofs, mpi_communicator);
>            soltrans.interpolate(interpolated_solution);
>
>            constraints.distribute(interpolated_solution); 
>            old_locally_relevant_solution = interpolated_solution;
>          }
>     }
>
>
>    Thank you!
>
> --Junchao Zhang
>

-- 
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.

Reply via email to