Wasim,
we do not know what modifications you made to your program, and so there is very little anyone can help you with the error. If I had to guess, you are forgetting to call dof_handler.distribute_dofs() before you start to access vertex dof indices.

Best
 W.

On 4/19/23 12:14, Wasim Niyaz Munshi ce21d400 wrote:
*** Caution: EXTERNAL Sender ***

I am running the program in debug mode and this is the error message that I get:
Running with PETSc on 1 MPI rank(s)...
Cycle 0:

--------------------------------------------------------
An error occurred in line <324> of file </home/wasim/dealii-candi/deal.II-v9.4.0/include/deal.II/dofs/dof_accessor.templates.h> in function     static void dealii::internal::DoFAccessorImplementation::Implementation::process_dof_index(const dealii::DoFHandler<dim, spacedim>&, unsigned int, unsigned int, unsigned int, unsigned int, const std::integral_constant<int, structdim>&, GlobalIndexType&, const DoFPProcessor&) [with int dim = 2; int spacedim = 2; int structdim = 0; GlobalIndexType = unsigned int; DoFPProcessor = dealii::internal::DoFAccessorImplementation::Implementation::get_dof_index<2, 2, 0>::<lambda(const auto:9&, auto:10&)>]
The violated condition was:
    ::dealii::deal_II_exceptions::internals::compare_less_than(obj_level, dof_handler.object_dof_indices.size())
Additional information:
     Index 0 is not in the half-open range [0,0). In the current case, this
     half-open range is in fact empty, suggesting that you are accessing an
     element of an empty collection such as a vector that has not been set
     to the correct size.

Stacktrace:
-----------
#0  ./step-40: void dealii::internal::DoFAccessorImplementation::Implementation::process_dof_index<2, 2, 0, unsigned int, dealii::internal::DoFAccessorImplementation::Implementation::get_dof_index<2, 2, 0>(dealii::DoFHandler<2, 2> const&, unsigned int, unsigned int, unsigned int, unsigned int, std::integral_constant<int, 0> const&)::{lambda(auto:1 const&, auto:2&)#1}>(dealii::DoFHandler<2, 2> const&, unsigned int, unsigned int, unsigned int, unsigned int, std::integral_constant<int, 0> const&, unsigned int&, dealii::internal::DoFAccessorImplementation::Implementation::get_dof_index<2, 2, 0>(dealii::DoFHandler<2, 2> const&, unsigned int, unsigned int, unsigned int, unsigned int, std::integral_constant<int, 0> const&)::{lambda(auto:1 const&, auto:2&)#1} const&) #1  ./step-40: unsigned int dealii::internal::DoFAccessorImplementation::Implementation::get_dof_index<2, 2, 0>(dealii::DoFHandler<2, 2> const&, unsigned int, unsigned int, unsigned int, unsigned int, std::integral_constant<int, 0> const&) #2  ./step-40: dealii::DoFAccessor<2, 2, 2, false>::vertex_dof_index(unsigned int, unsigned int, unsigned int) const
#3  ./step-40: Step40::LaplaceProblem<2>::setup_boundary_values()
#4  ./step-40: Step40::LaplaceProblem<2>::run()
#5  ./step-40: main
--------------------------------------------------------

[wasim-OptiPlex-5080:42036] *** Process received signal ***
[wasim-OptiPlex-5080:42036] Signal: Aborted (6)
[wasim-OptiPlex-5080:42036] Signal code:  (-6)
[wasim-OptiPlex-5080:42036] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x14420)[0x7fc3980c6420] [wasim-OptiPlex-5080:42036] [ 1] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7fc397f0100b] [wasim-OptiPlex-5080:42036] [ 2] /lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7fc397ee0859] [wasim-OptiPlex-5080:42036] [ 3] /home/wasim/dealii-candi/deal.II-v9.4.0/lib/libdeal_II.g.so.9.4.0(_ZN6dealii18deal_II_exceptions9internals22do_issue_error_nothrowERKNS_13ExceptionBaseE+0x0)[0x7fc3af7bb9f9] [wasim-OptiPlex-5080:42036] [ 4] ./step-40(_ZN6dealii18deal_II_exceptions9internals20issue_error_noreturnINS_18StandardExceptions17ExcIndexRangeTypeImEEEEvNS1_17ExceptionHandlingEPKciS8_S8_S8_T_+0x8c)[0x5602ad51a53d] [wasim-OptiPlex-5080:42036] [ 5] ./step-40(_ZN6dealii8internal25DoFAccessorImplementation14Implementation17process_dof_indexILi2ELi2ELi0EjZNS2_13get_dof_indexILi2ELi2ELi0EEEjRKNS_10DoFHandlerIXT_EXT0_EEEjjjjRKSt17integral_constantIiXT1_EEEUlRKT_RT0_E_EEvS8_jjjjSC_RT2_RKT3_+0x31f)[0x5602ad52ce3e] [wasim-OptiPlex-5080:42036] [ 6] ./step-40(_ZN6dealii8internal25DoFAccessorImplementation14Implementation13get_dof_indexILi2ELi2ELi0EEEjRKNS_10DoFHandlerIXT_EXT0_EEEjjjjRKSt17integral_constantIiXT1_EE+0x57)[0x5602ad528a2e] [wasim-OptiPlex-5080:42036] [ 7] ./step-40(_ZNK6dealii11DoFAccessorILi2ELi2ELi2ELb0EE16vertex_dof_indexEjjj+0xa6)[0x5602ad523a8e] [wasim-OptiPlex-5080:42036] [ 8] ./step-40(_ZN6Step4014LaplaceProblemILi2EE21setup_boundary_valuesEv+0x40c)[0x5602ad51f1f4] [wasim-OptiPlex-5080:42036] [ 9] ./step-40(_ZN6Step4014LaplaceProblemILi2EE3runEv+0x182)[0x5602ad51c61a]
[wasim-OptiPlex-5080:42036] [10] ./step-40(main+0x7a)[0x5602ad50a2dd]
[wasim-OptiPlex-5080:42036] [11] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7fc397ee2083]
[wasim-OptiPlex-5080:42036] [12] ./step-40(_start+0x2e)[0x5602ad50a16e]
[wasim-OptiPlex-5080:42036] *** End of error message ***
make[3]: *** [CMakeFiles/run.dir/build.make:71: CMakeFiles/run] Aborted (core dumped)
make[2]: *** [CMakeFiles/Makefile2:116: CMakeFiles/run.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:123:

I hope this is what you were asking for.
Regards
Wasim

On Wednesday, April 19, 2023 at 6:29:56 PM UTC+5:30 [email protected] wrote:

    Wasim,

    What does the backtrace in your debugger (gdb?) look like?

    Best,
    Daniel

    On Wed, Apr 19, 2023 at 7:27 AM Wasim Niyaz Munshi ce21d400
    <[email protected]> wrote:

        Hello everyone.
        I am trying to apply a particular boundary condition at one single
        point in the domain for a problem very similar to step-40.
        I am using the following code to do it:

        for (const auto &cell : dof_handler.active_cell_iterators())
           if (cell->is_locally_owned())

           {
           for (const auto &face : cell->face_iterators())

           for (const auto vertex_number : cell->vertex_indices())
           {
           const auto vert = cell->vertex(vertex_number);
           const Point<2>& node = vert;
           if (std::fabs(node(0)<1e-12) )
           {
        const unsigned int dof = cell->vertex_dof_index(vertex_number, 0);
           constraints.add_line(dof);
           constraints.set_inhomogeneity(dof,1);
           } // This set a scalar at node to value 1

           }

           }

        However, I am getting a segmentation fault. Kindly provide some help
        in this regard.

        Thanks
        Wasim

-- The deal.II project is located at http://www.dealii.org/
        <http://www.dealii.org/>
        For mailing list/forum options, see
        https://groups.google.com/d/forum/dealii?hl=en
        <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 [email protected].
        To view this discussion on the web visit
        
https://groups.google.com/d/msgid/dealii/eea6e885-5e7a-4330-b769-4272a70af626n%40googlegroups.com
 
<https://groups.google.com/d/msgid/dealii/eea6e885-5e7a-4330-b769-4272a70af626n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
The deal.II project is located at http://www.dealii.org/ <http://www.dealii.org/> For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en <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 [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/b77a4aa6-2a99-4a3e-b919-3fb67cebf537n%40googlegroups.com <https://groups.google.com/d/msgid/dealii/b77a4aa6-2a99-4a3e-b919-3fb67cebf537n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
------------------------------------------------------------------------
Wolfgang Bangerth          email:                 [email protected]
                           www: http://www.math.colostate.edu/~bangerth/


--
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/b9cc85c7-44aa-6ba5-3a86-b0d2aedd4724%40colostate.edu.

Reply via email to