step-35 in modified

206 views
Skip to first unread message

andrew jack urombo

unread,
Jul 10, 2021, 6:23:32 AM7/10/21
to dea...@googlegroups.com
Hie.

I am working on flow problems with a model based on the NSE.  The project involves using adaptive finite elementts, and first steps are  to:

1) have a mesh adapting strategy

2) compute errors

3) obtain convergence rates

I am basing these on the dealii step-35 and have attached my attempt to implement these 3 , and  would you to point in the right direction.

I have attached the  amended code here, and would like suggestions on how to make it work.

The error is that at line 1050  "a function is expected at ,..."

How do you implement this in an amendment to step-35?

mathematical sciences
15015 Ganges road
p.o box be277
belvedere
harare
zimbabwe

business:   +263.24.274.1423-36
fax : +263.24.274.1408
mobile zw1: +263.77.283.8167
mobile zw2: +263.77.412.0815
mobile ind: +91.844.867.9322
home : +263.68.215.3910



The information in this message is confidential and legally privileged. It is intended solely for the addressee(s). Access to this message by anyone else is unauthorized. If received in error, please accept our apologies and notify the sender immediately. You must also delete the original message from your machine. If you are not the intended recipient, any use, disclosure, copying, distribution or action taken in reliance of it, is prohibited and may be unlawful. The information, attachments, opinions or advice contained in this email are not the views or opinions of Harare Institute of Technology, its subsidiaries or affiliates. Although this email and any attachments are believed to be free of any virus or other defects which might affect any computer or IT system into which they are received, no responsibility is accepted by Harare Institute of Technology and/or its subsidiaries for any loss or damage arising in any way from the receipt or use thereof.

step-35a error
step-35a.cc

Wolfgang Bangerth

unread,
Jul 11, 2021, 3:24:07 PM7/11/21
to dea...@googlegroups.com
On 7/10/21 4:23 AM, andrew jack urombo wrote:
>>
> I have attached the  amended code here, and would like suggestions on how to
> make it work.
>
> The error is that at line 1050 /"a function is expected at ,..." /

Andrew,
the line in question is this one, in the middle of a comment:

// Now everything is ready, so do the refinement and recreate the DoF
// structure on the new grid, and finally initialize the matrix structures
// and the new vectors in the <code>
</code> function. Next, we
// actually perform the interpolation of the solution from old to new
// grid. The final step is to apply the hanging node constraints to the
// solution vector, i.e., to make sure that the values of degrees of

It complains about the '<code>' part, which is simply not valid C++ -- this is
meant to be a part of the commentary, not the code itself. Just comment it out.

Best
W.


--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

andrew jack urombo

unread,
Jul 12, 2021, 2:59:45 AM7/12/21
to dea...@googlegroups.com

The error I am trying to have suggestions to fix is:

/home/dealii/dealii/examples/step-35a/step-35a.cc: In member function ‘void Step35a::NavierStokesProjection<dim>::refine_mesh(unsigned int, unsigned int)’:
/home/dealii/dealii/examples/step-35a/step-35a.cc:1057:5: error: there are no arguments to ‘setup_system’ that depend on a template parameter, so a declaration of ‘setup_system’ must be available [-fpermissive]
 1057 |     setup_system();
      |     ^~~~~~~~~~~~
/home/dealii/dealii/examples/step-35a/step-35a.cc:1057:5: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/home/dealii/dealii/examples/step-35a/step-35a.cc:1059:32: error: ‘previous_solution’ was not declared in this scope
 1059 |     solution_trans.interpolate(previous_solution, output_results);
      |                                ^~~~~~~~~~~~~~~~~
/home/dealii/dealii/examples/step-35a/step-35a.cc:1060:5: error: ‘constraints’ was not declared in this scope
 1060 |     constraints.distribute(output_results);
      |     ^~~~~~~~~~~
/home/dealii/dealii/examples/step-35a/step-35a.cc: At global scope:
/home/dealii/dealii/examples/step-35a/step-35a.cc:1071:8: error: no declaration matches ‘void Step35a::NavierStokesProjection<dim>::process_solution(unsigned int)’
 1071 |   void NavierStokesProjection<dim>::process_solution(const unsigned int cycle)
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dealii/dealii/examples/step-35a/step-35a.cc:1071:8: note: no functions named ‘void Step35a::NavierStokesProjection<dim>::process_solution(unsigned int)’
/home/dealii/dealii/examples/step-35a/step-35a.cc:437:9: note: ‘class Step35a::NavierStokesProjection<dim>’ defined here
  437 |   class NavierStokesProjection
      |         ^~~~~~~~~~~~~~~~~~~~~~
make[3]: *** [CMakeFiles/step-35a.dir/build.make:63: CMakeFiles/step-35a.dir/step-35a.cc.o] Error 1

On 11/07/2021 21:24, Wolfgang Bangerth wrote:
On 7/10/21 4:23 AM, andrew jack urombo wrote:

I have attached the  amended code here, and would like suggestions on how to make it work.

The error is that at line 1050 /"a function is expected at ,..." /

Andrew,
the line in question is this one, in the middle of a comment:

    // Now everything is ready, so do the refinement and recreate the DoF
    // structure on the new grid, and finally initialize the matrix structures
    // and the new vectors in the <code>
    </code> function. Next, we
    // actually perform the interpolation of the solution from old to new
    // grid. The final step is to apply the hanging node constraints to the
    // solution vector, i.e., to make sure that the values of degrees of

It complains about the '<code>' part, which is simply not valid C++ -- this is meant to be a part of the commentary, not the code itself. Just comment it out.

Best
 W.


-- 
mathematical sciences
15015 Ganges road
p.o box be277
belvedere
harare
zimbabwe

business:   +263.24.274.1423-36
fax : +263.24.274.1408
mobile zw1: +263.77.283.8167
mobile zw2: +263.77.412.0815
mobile ind: +91.844.867.9322
home : +263.68.215.3910

Wolfgang Bangerth

unread,
Jul 12, 2021, 9:03:54 AM7/12/21
to dea...@googlegroups.com
On 7/12/21 12:59 AM, andrew jack urombo wrote:
> The error I am trying to have suggestions to fix is:
>
> //home/dealii/dealii/examples/step-35a/step-35a.cc: In member function ‘void
> Step35a::NavierStokesProjection<dim>::refine_mesh(unsigned int, unsigned int)’://
> ///home/dealii/dealii/examples/step-35a/step-35a.cc:1057:5: error: there are
> no arguments to ‘setup_system’ that depend on a template parameter, so a
> declaration of ‘setup_system’ must be available [-fpermissive]//
> // 1057 |     setup_system();//
> //      |     ^~~~~~~~~~~~//

Andrew -- you are trying to call a function setup_system(), but your program
has no such function. The other errors are all of the same kind: You seem to
have copied code from another tutorial program, but it doesn't apply in the
case of step-35.

It is like copying a paragraph of the works of Charles Mungoshi verbatim into
a novel of Hamutyinei: It doesn't work. It requires understanding both works,
the context of both where the paragraph is taken from, and where it is put,
and then adaptation to the language, the characters, and the story of the
place where you want to put it. It is no different if you want to take code
from one program and add it to another one.

Best
Wolfgang

SebG

unread,
Aug 4, 2021, 6:20:39 AM8/4/21
to deal.II User Group
Dear all,

a colleague and I have also worked with step-35 and we programmed a parallelized version whose layout is similar to that of step-32. Currently, the code is not suitable to be directly used as a tutorial, but, if you are interested, we could refactor it and send it through github as a step-35b.

Best wishes,
Sebastian

Wolfgang Bangerth

unread,
Aug 4, 2021, 10:05:43 AM8/4/21
to dea...@googlegroups.com
On 8/4/21 4:20 AM, SebG wrote:
>
> a colleague and I have also worked with step-35 and we programmed a
> parallelized version whose layout is similar to that of step-32. Currently,
> the code is not suitable to be directly used as a tutorial, but, if you are
> interested, we could refactor it and send it through github as a step-35b.

Maybe a better option would be the code gallery:
https://dealii.org/code-gallery
It would relatively straightforward to get it in there.

Over the past few years, we've started to think of the tutorial more in terms
as a place where we *teach deal.II*, and so we tried to focus on programs that
illustrate specific aspects of deal.II rather than just a landing pad for
general deal.II-based programs. The latter should go into the code gallery
instead. Want to give that a try?

Best
W.

jack urombo

unread,
Mar 4, 2022, 2:12:44 PM3/4/22
to deal.II User Group
Still working on modified step-35, but now starting the modification by Muhammad Mohebujjaman.


I want to resolve the issue of the iterators defined here:

template <int dim>
void
NavierStokesProjection<dim>::
assemble_one_cell_of_gradient (const IteratorPair &SI,
                                InitGradScratchData &scratch,
                                InitGradPerTaskData &data)
{
  scratch.fe_val_vel.reinit (std::get<0> (SI.iterators));
  scratch.fe_val_pres.reinit (std::get<1> (SI.iterators));
  std::get<0> (SI.iterators)->get_dof_indices (data.vel_local_dof_indices);
  std::get<1> (SI.iterators)->get_dof_indices (data.pres_local_dof_indices);
  data.local_grad = 0.;
  Vector<double> rhs_vector (dim);
    for (unsigned int q=0; q<scratch.nqp; ++q)
      {
        for (unsigned int i=0; i<data.vel_dpc; ++i)
          for (unsigned int j=0; j<data.pres_dpc; ++j)
            data.local_grad (i, j) += -scratch.fe_val_vel.JxW(q) *
                                      scratch.fe_val_vel.shape_grad (i, q)[data.d] *
                                      scratch.fe_val_pres.shape_value (j, q);
      }
  }
 
which are giving me the errors attached in the file errors.txt

My attention is to fix the parts highlighted in red above.
errors

Wolfgang Bangerth

unread,
Mar 4, 2022, 3:39:14 PM3/4/22
to dea...@googlegroups.com
On 3/4/22 12:12, jack urombo wrote:
> /
>   std::get<0> (SI.iterators)->get_dof_indices (data.vel_local_dof_indices);
>   std::get<1> (SI.iterators)->get_dof_indices
> (data.pres_local_dof_indices);/

The code you are basing yours own is apparently built on an old version
of deal.II. I believe that you need to write this as
std::get<0> (*SI)->get_dof_indices
now.
Message has been deleted

Wolfgang Bangerth

unread,
Mar 4, 2022, 6:02:42 PM3/4/22
to dea...@googlegroups.com
On 3/4/22 14:37, jack urombo wrote:
> **
>
> Does this replace all the four instances of *std::get.... *or just the
> last two?

All of the ones where you call
std::get<...>(SI.iterators)

jack urombo

unread,
Mar 4, 2022, 10:42:26 PM3/4/22
to deal.II User Group
Yeah this:
  scratch.fe_val_vel.reinit(std::get<0> (*SI));
  scratch.fe_val_pres.reinit(std::get<1> (*SI));
  std::get<0> (*SI)->get_dof_indices(data.vel_local_dof_indices);
  std::get<1> (*SI)->get_dof_indices(data.pres_local_dof_indices);

jack urombo

unread,
Apr 5, 2022, 10:02:18 PM4/5/22
to deal.II User Group
I want to generate convergence table for the modified step-35 for a couple of velocity and pressure error norms.
The problem seems to emanate from my definition of the errors in process_output()   template.
The message is:

[ 50%] Building CXX object CMakeFiles/step-35a.dir/step-35a.cc.o
/home/jurombo/binaires/dealii/nse/step-35a/step-35a.cc: In member function ‘void Step35a::NavierStok
esProjection<dim>::compute_errors(unsigned int)’:
/home/jurombo/binaires/dealii/nse/step-35a/step-35a.cc:1941:40: error: vL2_error’ was not declared
in this scope
1941 |     convergence_table.add_value("vL2", vL2_error);
     |                                        ^~~~~~~~~
/home/jurombo/binaires/dealii/nse/step-35a/step-35a.cc:1942:40: error: vH1_error’ was not declared
in this scope
1942 |     convergence_table.add_value("vH1", vH1_error);
     |                                        ^~~~~~~~~
/home/jurombo/binaires/dealii/nse/step-35a/step-35a.cc:1943:44: error: vLinfty_error’ was not decla
red in this scope
1943 |     convergence_table.add_value("vLinfty", vLinfty_error);
     |                                            ^~~~~~~~~~~~~
/home/jurombo/binaires/dealii/nse/step-35a/step-35a.cc:1944:40: error: pL2_error’ was not declared
in this scope; did you mean ‘perror’?
1944 |     convergence_table.add_value("pL2", pL2_error);
     |                                        ^~~~~~~~~
     |                                        perror
/home/jurombo/binaires/dealii/nse/step-35a/step-35a.cc:1945:40: error: pH1_error’ was not declared
in this scope; did you mean ‘perror’?
1945 |     convergence_table.add_value("pH1", pH1_error);
     |                                        ^~~~~~~~~
     |                                        perror
/home/jurombo/binaires/dealii/nse/step-35a/step-35a.cc:1946:44: error: pLinfty_error’ was not decla
red in this scope
1946 |     convergence_table.add_value("pLinfty", pLinfty_error);
     |                                            ^~~~~~~~~~~~~
make[2]: *** [CMakeFiles/step-35a.dir/build.make:76: CMakeFiles/step-35a.dir/step-35a.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:90: CMakeFiles/step-35a.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
jurombo@MathW15Linux:~/binaires/dealii/nse/step-35a>


I need suggestions on how to properly define or indications of where I getting wrong.
The code is attached.
step-35a.cc

SebG

unread,
Apr 6, 2022, 3:07:21 AM4/6/22
to deal.II User Group
Dear Jack,

as the compiler error says the variables are not defined in the respective scope. You define vL2_error, pL2_error, vH1_error, pH1_error inside the for loop from line 1803 to 1861. Outside this loop, the variables are not defined anymore. The same applies to the variables vLinfty_error and pLinfty_error, lines 1897 to 1923.

Best wishes,
Sebastian
Reply all
Reply to author
Forward
0 new messages