On 6/24/20 3:14 PM, Krishnakumar Gopalakrishnan wrote:
Hi,

I am solving the basic diffusion equation using the direct method (based on Step-52).

I have made the following changes from Step-52 tutorial

1. The domain is now 1D (as opposed to 2D in step-52)
2. We have Neumann BCs on both ends (left NeumannBC = 0.5, right NeumannBC= 0)
3. Removes the code for MMS validation (i.e. no source term S(t)) so that we solve for the unknown field variable, instead of verifying whether the pre-formulated analytical solution is retrieved)
4. Sets the absorpotion coefficient, Sigma_a = 0
5. Sets a non-zero initial condition (but a spatially constant value).

The C++ source code & Cmakelists.txt files are attached herewith. The solution is indeed correct and is as expected, and I have visualised this in Paraview. However, I'd like to understand the compilation warnings.

Some of them have to do with "unused variables", which are somewhat straightforward to get rid of. But the other warnings which all have the string  "required from here" is not so clear to me.

Read the error/warning message in its entirety. For example, the first one says

/home/bangerth/p/deal.II/1/install/examples/step-1/step-1.cc: In instantiation of ‘void DiffusionEqn::SolidDiffusion<dim>::run() [with int dim = 1]’: /home/bangerth/p/deal.II/1/install/examples/step-1/step-1.cc:441:26: required from here /home/bangerth/p/deal.II/1/install/examples/step-1/step-1.cc:420:24: warning: variable ‘n_steps’ set but not used [-Wunused-but-set-variable]
     unsigned int       n_steps      = 0;
                        ^~~~~~~

If you strip the details, it says:

   In instantiation of function b() // i.e., while compiling a()
   required from here               // i.e., we got to a() while compiling b()
   warning: variable unused

In other words, the compiler isn't just telling you where (in which function and line of code) the problem happened, but also *why* it is compiling this function (because it's called from some other place) and with which template arguments.

Best
 W.


Can someone please explain what these warnings mean, and what is the best practice for refactoring it to avoid such warnings.

Thanks!
Krishna

--
The deal.II project is located at http://www.dealii.org/ <https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.dealii.org%2F&data=02%7C01%7CWolfgang.Bangerth%40colostate.edu%7Cfd8a27c47f9a45cc323908d818838c1f%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637286300568833692&sdata=D5TEoM8Dk11JtvV6qM7o79260F%2BztbJpQw5M%2FVghgaU%3D&reserved=0> For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en <https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fforum%2Fdealii%3Fhl%3Den&data=02%7C01%7CWolfgang.Bangerth%40colostate.edu%7Cfd8a27c47f9a45cc323908d818838c1f%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637286300568843686&sdata=XWXhcdeMs1Poa%2BSLIqCZH73Wh1wqlvqLyz%2BTXB%2FMvBo%3D&reserved=0>
---
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 <mailto:dealii+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/d6aaa13b-5325-4f4a-9493-23859a5bcb9co%40googlegroups.com <https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fdealii%2Fd6aaa13b-5325-4f4a-9493-23859a5bcb9co%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=02%7C01%7CWolfgang.Bangerth%40colostate.edu%7Cfd8a27c47f9a45cc323908d818838c1f%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637286300568843686&sdata=4eiKv3%2FUh9%2Bx5zjYczkUfN%2F%2Fwn8M8zpGx%2Fvccf%2FIhjs%3D&reserved=0>.


--
------------------------------------------------------------------------
Wolfgang Bangerth          email:                 bange...@colostate.edu
                           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 dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/3d8d3b4d-0fd9-83e0-5457-34dc7e9c612f%40colostate.edu.

Reply via email to