Hello,
thank You for response and the advices.

>>         LA::Vector<double> vec_old_solution(dof_handler_nse.n_dofs());
>>
>>         VectorTools::interpolate(dof_handler_nse, ZeroFunction<3>(dim +
1),
>>                 vec_old_solution);
>>
>>         old_solution_nse = vec_old_solution;
>

> > Are you using a serial vector here, interpolate a zero function, and
> > then copy it over? That will be slow of course. You could just write
> > "old_solution_nse=0" instead.
>

It doesnt take such a long time, but I will try it, see below


> It would also be helpful to know, which part of your setup is slow.
> > You can find out by adding more timing sections.
>

I have added timing subsections:

  computing_timer.enter_subsection("Setup NS");

        computing_timer.enter_subsection("NS renumbering");
            dof_handler_nse.distribute_dofs(fe_nse);
            DoFRenumbering::Cuthill_McKee(dof_handler_nse);
        computing_timer.leave_subsection();

        locally_owned_dofs_nse = dof_handler_nse.locally_owned_dofs();
        DoFTools::extract_locally_relevant_dofs(dof_handler_nse,
                locally_relevant_dofs_nse);

        locally_relevant_solution_nse.reinit(locally_owned_dofs_nse,
                locally_relevant_dofs_nse, mpi_communicator);

        old_solution_nse.reinit(locally_owned_dofs_nse,
                locally_relevant_dofs_nse, mpi_communicator);
        old_solution_nse = 0;

        solution_nse.reinit(locally_owned_dofs_nse,
locally_relevant_dofs_nse,
                mpi_communicator);

        system_rhs_nse.reinit(locally_owned_dofs_nse, mpi_communicator);
        system_rhs_nse = 0;


        computing_timer.enter_subsection("constraint matrix preparation");
            constraint_matrix_nse.clear();
            constraint_matrix_nse.reinit(locally_relevant_dofs_nse);
            DoFTools::make_hanging_node_constraints(dof_handler_nse,
                    constraint_matrix_nse);
            std::vector<bool> component_mask(dim + 1, false);
            for (int i = 0; i < dim; ++i)
                component_mask[i] = true; // velocities

            VectorTools::interpolate_boundary_values(dof_handler_nse, 0,
                    ConstantFunction<dim>(0., dim + 1),
constraint_matrix_nse,
                    component_mask);

            VectorTools::interpolate_boundary_values(dof_handler_nse, 1,
                    InflowVelocityBoundaryValues<dim>(),
constraint_matrix_nse,
                    component_mask);

            constraint_matrix_nse.close();
        computing_timer.leave_subsection();


        computing_timer.enter_subsection("interpolation zero nse solution");
            LA::Vector<double> vec_old_solution(dof_handler_nse.n_dofs());

            VectorTools::interpolate(dof_handler_nse, ZeroFunction<3>(dim +
1),
                    vec_old_solution);

            old_solution_nse = vec_old_solution;
        computing_timer.leave_subsection();


        computing_timer.enter_subsection("making sparsity pattern");
            DynamicSparsityPattern csp(locally_relevant_dofs_nse);

            DoFTools::make_sparsity_pattern(dof_handler_nse, csp,
                    constraint_matrix_nse, false);


            SparsityTools::distribute_sparsity_pattern(csp,
                    dof_handler_nse.n_locally_owned_dofs_per_processor(),
                    mpi_communicator, locally_relevant_dofs_nse);


        computing_timer.leave_subsection();

        computing_timer.enter_subsection("reinit of system matrix");
            system_matrix_nse.reinit(locally_owned_dofs_nse,
locally_owned_dofs_nse,
                    csp, mpi_communicator);
        computing_timer.leave_subsection();



    computing_timer.leave_subsection();

The Navier-Stokes system has ~47000 dofs
I have compiled it in release mode, I ran it on 4-cores
Results from the log:

constraint matrix preparation, wall time: *6.41976s.*
interpolation zero nse solution, wall time: 0.00220919s.
making sparsity pattern, wall time: 0.0638468s.
reinit of system matrix, wall time: 0.222504s.
Setup NS, wall time: 7.57601s.
Setup, wall time: 7.72225s.        (together with Cahn-Hilliard system
setting)

So, apparently the constraint matrix preparation is dominant.
Maybe I am doing  something wrong

I will try to prepare some comparison with Step-40, Step-33 as you proposed.

Thank You

Marek

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