Re: [deal.II] Periodic Boundary conditions on Step-3 tutorial with dim != spacedim

2020-11-23 Thread Malhar T.
Hello Timo, 
Thank you for your reply. Yeah, I would definitely like try and make it 
work. So, what I did was, I made some small changes in the file 
'dof_tools_constraints.inst.in 
'. 
I just added spacedim loop for the first two 'for loop' blocks. 
This is how it looks after the changes, 

for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS)
  {
#if deal_II_dimension <= deal_II_space_dimension
template void DoFTools::make_periodicity_constraints(
  const DoFHandler::face_iterator &,
  const DoFHandler::face_iterator &,
  AffineConstraints &,
  const ComponentMask &,
  bool,
  bool,
  bool,
  const FullMatrix &,
  const std::vector &,
 const double);
#ifdef DEAL_II_WITH_COMPLEX_VALUES
template void DoFTools::make_periodicity_constraints(
  const DoFHandler::face_iterator &,
  const DoFHandler::face_iterator &,
  AffineConstraints> &,
  const ComponentMask &,
  bool,
  bool,
  bool,
  const FullMatrix &,
  const std::vector &,
  std::complex);#endif
#endif
  }
for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS)
  {
#if deal_II_dimension <= deal_II_space_dimension

template void DoFTools::make_periodicity_constraints(
  const std::vector::cell_iterator>> 
&,
  AffineConstraints &,
  const ComponentMask &,
  const std::vector &,
  const double);
#ifdef DEAL_II_WITH_COMPLEX_VALUES
template void DoFTools::make_periodicity_constraints>(
  const std::vector::cell_iterator>> 
&,
  AffineConstraints> &,
  const ComponentMask &,
  const std::vector &,
  const std::complex);#endif

template void DoFTools::make_periodicity_constraints(
  const DoFHandler &,
  const types::boundary_id,
  const types::boundary_id,
  const unsigned int,
  AffineConstraints &,
  const ComponentMask &,
  const double);
#ifdef DEAL_II_WITH_COMPLEX_VALUES
template void DoFTools::make_periodicity_constraints(
  const DoFHandler &,
  const types::boundary_id,
  const types::boundary_id,
  const unsigned int,
  AffineConstraints> &,
  const ComponentMask &,
  const std::complex);#endif

template void DoFTools::make_periodicity_constraints(
  const DoFHandler &,
  const types::boundary_id,
  const unsigned int,
  AffineConstraints &,
  const ComponentMask &,
  const double);
#ifdef DEAL_II_WITH_COMPLEX_VALUES
template void DoFTools::make_periodicity_constraints(
  const DoFHandler &,
  const types::boundary_id,
  const unsigned int,
  AffineConstraints> &,
  const ComponentMask &,
  const std::complex);
#endif#endif
  }

Although the build was successful, I am not sure how to check if its 
implemented correctly or not. One more slightly basic question, do I need 
to build all the other files if I only changed this one file? Does it not 
detect that only one file was changed? This is the way one goes about 
changing stuff right? 

Also, I will be sure to put a pull request if it works.

Thank You

On Monday, November 23, 2020 at 6:14:26 AM UTC+5:30 Timo Heister wrote:

> Hi Malhar,
>
> if you look at
>
> https://github.com/dealii/dealii/blob/a56c8585863b774de9dce5f7dd5c334ef56f3a51/source/dofs/dof_tools_constraints.inst.in#L69
>
> you can see that it is only instantiated for
> DoFHandler
> meaning only for dim=spacedim (the second argument is the default right 
> now).
>
> Instead, we would need to move the instantiation down into a loop that
> has two loops over dim and instantiate it for all pairs like it is
> done for
>
> https://github.com/dealii/dealii/blob/a56c8585863b774de9dce5f7dd5c334ef56f3a51/source/dofs/dof_tools_constraints.inst.in#L123
>
> Do you want to try if you can make this work? I am not sure if the
> implementation will work correctly, but we can check that in a second
> step.
> If this works, we would appreciate a pull request from you to fix this!
>
> Best,
> Timo
>
>
>
> On Sun, Nov 22, 2020 at 4:11 PM Malhar T.  wrote:
> >
> > Hello All !
> >
> > I was trying the step-3 with periodic boundary conditions and dim = 2 
> and spacedim = 3. The main reason behind this is I want to test periodic 
> boundary conditions for dim != spacedim. I have tested the code for dim = 
> spacedim = 2 and the periodic boundary conditions and it works (never mind 
> the results for now !). I have also tested the code for dim = 2 and 
> spacedim = 3 without periodic boundary conditions and it works too. But 
> only when I add periodic conditions for that case, the issue arises.
> >
> > I got the following error,
> >
> &g

[deal.II] Periodic Boundary conditions on Step-3 tutorial with dim != spacedim

2020-11-22 Thread Malhar T.
Hello All !

I was trying the step-3 
 with periodic 
boundary conditions and dim = 2 and spacedim = 3. The main reason behind 
this is I want to test periodic boundary conditions for dim != spacedim. I 
have tested the code for dim = spacedim = 2 and the periodic boundary 
conditions and it works (never mind the results for now !). I have also 
tested the code for dim = 2 and spacedim = 3 without periodic boundary 
conditions and it works too. But only when I add periodic conditions for 
that case, the issue arises. 

I got the following error,

error: undefined reference to 'void 
dealii::DoFTools::make_periodicity_constraints<2, 3, 
double>(dealii::DoFHandler<2, 3> const&, unsigned int, unsigned int, unsigned 
int, dealii::AffineConstraints&, dealii::ComponentMask const&, double)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/step1.dir/build.make:139: step1] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/step1.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

The version that I am using is 9.3.0-pre. Although I am not really great at 
C++ but according to the template 

 
and source 
,
 
it should have worked, but I could not find anything here 
.
 
I tried running it without template arguments or with only '2' as a 
template argument, but couldn't make it work. I have attached the code 
which I have tried, and also the code dim = 2 and spacedim = 3 without 
periodic boundary conditions. Any help will be greatly appreciated.

Thank You

-- 
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/e11a9f41-4750-459d-bedc-ef0b3ae83dddn%40googlegroups.com.
/* -
 *
 * Copyright (C) 1999 - 2020 by the deal.II authors
 *
 * This file is part of the deal.II library.
 *
 * The deal.II library is free software; you can use it, redistribute
 * it, and/or modify it under the terms of the GNU Lesser General
 * Public License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * The full text of the license can be found in the file LICENSE.md at
 * the top level directory of deal.II.
 *
 * -
 *
 * Authors: Wolfgang Bangerth, 1999,
 *  Guido Kanschat, 2011
 */
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace dealii;
class Step3
{
public:
  Step3();
  void run();
private:
  void make_grid();
  void setup_system();
  void assemble_system();
  void solve();
  void output_results() const;
  Triangulation<2,3> triangulation;
  FE_Q<2,3>  fe;
  DoFHandler<2,3>dof_handler;
  MappingQ<2,3>  mapping;
  SparsityPattern  sparsity_pattern;
  SparseMatrix system_matrix;
  Vector solution;
  Vector system_rhs;
};
Step3::Step3()
  : fe(1)
  , dof_handler(triangulation)
  , mapping(2)
{}
void Step3::make_grid()
{
  GridGenerator::subdivided_hyper_cube(triangulation, 10, -10.0, 10.0, 1);
  // triangulation.refine_global(5);
  std::cout << "Number of active cells: " << triangulation.n_active_cells()
<< std::endl;
}
void Step3::setup_system()
{
  dof_handler.distribute_dofs(fe);
  std::cout << "Number of degrees of freedom: " << dof_handler.n_dofs()
<< std::endl;
  DynamicSparsityPattern dsp(dof_handler.n_dofs());
  DoFTools::make_sparsity_pattern(dof_handler, dsp);
  sparsity_pattern.copy_from(dsp);
  system_matrix.reinit(sparsity_pattern);
  solution.reinit(dof_handler.n_dofs());
  system_rhs.reinit(dof_handler.n_dofs());
}
void Step3::assemble_system()
{
  QGauss<2> quadrature_formula(fe.degree + 1);
  FEValues<2,3> fe_values(mapping, fe,
quadrature_formula,
update_values | update_gradients | update_JxW_values);
  const unsigned int dofs_per_cell = fe.dofs_per_cell;
  FullMatrix cell_matrix(dofs_per_cell, dofs_per_cell);
  Vector cell_rhs(dofs_per_cell);
  std::vector 

[deal.II] Using DataOut when dim != spacedim

2020-09-21 Thread Malhar T.
Hello All,
I hope you are doing well !

I am working on a surface patch in 3D (dim=2 & spacedim=3 and developed 
using ChartManifold<2,3> by following code similar to step-53 
) and I would 
like to output the results into a vtk file. I am mostly following 
tutorials, as I am not really great with C++. So, initially I used the 
class DataOut and tried to specify the geometry using attach_dof_handler. 

This is how its defined,

Triangulation<2, 3> triangulation;
DoFHandler<2, 3>dof_handler;

And output_results function was written as

{
DataOut data_out;
data_out.attach_dof_handler(dof_handler);
}

But I got the error


error: cannot convert ‘const dealii::DoFHandler<2, 3>’ to ‘const 
dealii::DoFHandler<2, 2>&’
note:   initializing argument 1 of ‘void 
dealii::DataOut_DoFData::attach_dof_handler(const DoFHandlerType&) [with 
DoFHandlerType = dealii::DoFHandler<2, 2>; int patch_dim = 2; int 
patch_space_dim = 2]’

I tried searching in the forum and came to know about DataOutFaces (through 
this post ), 
and I also looked at the step-61 

 
tutorial on its implementation, but I got the same error again. I have a 
feeling that I am not understanding something very trivial, thus, any 
pointers would be really helpful. 

Thank You. 


I tried searching in the forum and came to know about DataOutFaces (through 
this post) , 
and I also looked at the step-61 

 
tutorial on its implementation, but I got the same error again. I have a 
feeling that I am not understanding something very trivial, any pointers 
would be helpful. Thank You. 

-- 
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/7e032f3f-2957-4235-9f32-df8858a2c575n%40googlegroups.com.