Re: [deal.II] compress error for vector of PETScWrappers::MPI::SparseMatrix

2017-06-06 Thread Weixiong Zheng


在 2017年6月6日星期二 UTC-7下午12:07:18,Wolfgang Bangerth写道:
>
> On 06/06/2017 12:10 PM, Weixiong Zheng wrote: 
> > It runs in serial. The error occurs when using multiple processors. 
>
>
To answer if it really happens when I call compress (), I added a bit of 
tracking:
for (unsigned int k=0; kid() << " component " 
<< k 
<< " on proc " << Utilities::MPI::this_mpi_process (mpi_communicator) 
<< std::endl;
  local_radio (os.str());
  sys_mats[k]->add (local_dof_indices,
local_dof_indices,
local_mats[k]);
}

and

for (unsigned int k=0; kcompress (VectorOperation::add);
  std::cout << "compress sys_mats ends component " << k 
<< " on proc " << Utilities::MPI::this_mpi_process (mpi_communicator) 
<< std::endl;
}

To test, I added 2-component test with 4 cells using 2 processors. Here is 
the tracking before error messages:

loc_to_glob mapping cell 2_0: component 0 on proc 1

loc_to_glob mapping cell 2_0: component 1 on proc 1

loc_to_glob mapping cell 0_0: component 0 on proc 0

loc_to_glob mapping cell 0_0: component 1 on proc 0

loc_to_glob mapping cell 1_0: component 0 on proc 0

loc_to_glob mapping cell 1_0: component 1 on proc 0

compress sys_mats begins component 0 on proc 0

loc_to_glob mapping cell 3_0: component 0 on proc 1

loc_to_glob mapping cell 3_0: component 1 on proc 1

compress sys_mats begins component 0 on proc 1

compress sys_mats ends component 0 on proc 1

compress sys_mats begins component 1 on proc 1

It looks like compress only gets through for direction-0 on processor 0.
 

> And it really happens when you call `compress()`? 
>
> The only thing I can think of is that you didn't set up the sparsity 
> pattern correctly. Can you show us the code that sets up the sparsity 
> pattern of these matrices? 
>
> Best 
>   W. 
>
> -- 
>  
> Wolfgang Bangerth  email: bang...@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.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] integrating a scalar in a vertical column (e.g. finding hydrostatic pressure at a point)

2017-06-06 Thread Wolfgang Bangerth


Sean,

Thanks for the wonderfully clear answer. For my function f, I can 
basically treat the line integral like a "normal" volume integral, 
setting the direction using the delta functions. This would be the right 
approach for a distributed adaptive setting as well, no?


Yes. You'd write the integral over the entire volume as a sum over 
integrals over the locally owned set of cells -- each processor computes 
on term in this sum, and you then just sum up a number over all processors.



It makes no 
assumptions about cell layout and is defined at the functional level.


Correct.


If I may ask a follow up with an added wrinkle - it concerns the 
interplay of material_id (cells) and functions:


What if I don't have the form of f?

In my case, I have been using the material_id marker at the cell level 
to indicate different materials, that in the assembly loops, then 
provide different coefficient values to the local sums.
  Suppose that the distribution of these cell identities(material_id) is 
updated based on the results of some FE field calculations. Then given 
the configuration of the cells at that time step, I would like to do the 
line integral (essentially compute the weight of the material above the 
point), and go on to another FE solve. However, I do not have a 
functional form to put in my line integral.


I don't think I quite understand. The function f(x,y,z) in your case 
will have the form


  if (some_condition)   // depends on the material_id.
return something;
  else
return something_else;


I don't know how to describe the weight function globally, but locally 
(at the cell level) it is defined.


That's all you need. You compute these integrals as sums over all 
(locally owned) cells, where you use quadrature. So at each quadrature 
point, you're going to evaluate what value f(x,y,z) has. But for this 
evaluation, you know what cell you're on, etc.


By way of an example, take a look at this postprocessor that computes 
the root-mean-square of the velocity over the entire domain in a flow 
solver (the only really important parts are lines 56-76):


https://github.com/geodynamics/aspect/blob/master/source/postprocess/velocity_statistics.cc



"The material of a cell may be used during matrix generation in order to 
implement different coefficients in different parts of the domain. It is 
not used by functions of the grid and dof handling libraries." [1]


Now see also this: https://github.com/dealii/dealii/pull/4492/files


Generally, I am hoping to better understand the relationship of the 
mesh( things like looping over cells, querying for the local properties, 
...) and the Function object class which returns values based on the 
spatial position.
There really isn't very much of one. Function objects are functions that 
are dependent on x,y,z. Querying local properties would correspond to 
functions that depend on K (the set of cells).


Best
 W.

--

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.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] compress error for vector of PETScWrappers::MPI::SparseMatrix

2017-06-06 Thread Weixiong Zheng
This is how I setup my sparsity pattern:
if (discretization=="DFEM")
fe = new FE_DGQ (p_order);
  else
fe = new FE_Q (p_order);

dof_handler.distribute_dofs (*fe);
locally_owned_dofs = dof_handler.locally_owned_dofs ();

DynamicSparsityPattern dsp (locally_owned_dofs);

if (discretization=="DFEM")
  DoFTools::make_flux_sparsity_pattern (dof_handler, dsp);
else
  DoFTools::make_sparsity_pattern (dof_handler, dsp);

SparsityTools::distribute_sparsity_pattern (dsp,

dof_handler.n_locally_owned_dofs_per_processor (),
mpi_communicator,
   locally_owned_dofs);



在 2017年6月6日星期二 UTC-7下午12:07:18,Wolfgang Bangerth写道:
>
> On 06/06/2017 12:10 PM, Weixiong Zheng wrote: 
> > It runs in serial. The error occurs when using multiple processors. 
>
> And it really happens when you call `compress()`? 
>
> The only thing I can think of is that you didn't set up the sparsity 
> pattern correctly. Can you show us the code that sets up the sparsity 
> pattern of these matrices? 
>
> Best 
>   W. 
>
> -- 
>  
> Wolfgang Bangerth  email: bang...@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.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] compress error for vector of PETScWrappers::MPI::SparseMatrix

2017-06-06 Thread Wolfgang Bangerth

On 06/06/2017 12:10 PM, Weixiong Zheng wrote:

It runs in serial. The error occurs when using multiple processors.


And it really happens when you call `compress()`?

The only thing I can think of is that you didn't set up the sparsity 
pattern correctly. Can you show us the code that sets up the sparsity 
pattern of these matrices?


Best
 W.

--

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.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] compress error for vector of PETScWrappers::MPI::SparseMatrix

2017-06-06 Thread Weixiong Zheng
It runs in serial. The error occurs when using multiple processors.

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


Re: [deal.II] convergence adaptive refinement

2017-06-06 Thread Wolfgang Bangerth

On 06/06/2017 04:43 AM, Lam DANG wrote:

Dear All

I use /write_ucd/ with /flags.write_faces = true/, but the result of 
.ucd file is *lack of information of face id 0.*

How I can output the information of face id 0?

The piece of code:
/Triangulation<2> triangulation;
 GridGenerator::hyper_cube (triangulation, 0, 1, true);
 GridOut grid_out_ucd;
 GridOutFlags::Ucd flags;
 flags.write_faces = true;
 grid_out_ucd.set_flags(flags);
 std::ofstream out_ucd ("triangulation.ucd");
 grid_out_ucd.write_ucd (triangulation, out_ucd);/

The result of "/triangulation.ucd/"
/4 4 0 0 0
1  0 0 0
2  1 0 0
3  0 1 0
4  1 1 0
1 0 quad1 2 4 3
2  2  line1 2
3  1  line2 4
4  3  line3 4 /

The information of line 0 (/5 0 line 1 3/) is not in output file


For reasons that are no longer entirely clear to me, GridOut documents 
this behavior as follows:


  struct Ucd
  {
[...]

/**
 * When writing a mesh, write boundary faces explicitly if their 
boundary
 * indicator is not the default boundary indicator, which is zero. 
This
 * is necessary if you later want to re-read the grid and want to 
get the
 * same boundary indicators for the different parts of the boundary 
of the

 * triangulation.
 *
 * It is not necessary if you only want to write the triangulation 
to view

 * or print it.
 *
 * Default: @p false.
 */
bool write_faces;

In other words, it *purposefully* omits faces with a zero boundary 
indicator. In your case, since you are "coloring" the cube upon mesh 
generation, the face that's omitted is exactly the one that has boundary 
indicator zero.


In other words, the function really does as is intended. What the 
original intent of the rule to omit faces with zero boundary indicator 
is not completely clear to me any more, however.


Best
 W.

--

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.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] compress error for vector of PETScWrappers::MPI::SparseMatrix

2017-06-06 Thread Wolfgang Bangerth

On 06/06/2017 03:13 AM, Weixiong Zheng wrote:


Now, I got the error: compressing can go through direction 0 but not 1 
with the error at the end of this post.

Any ideas how to fix it?

Thanks in advance!
Weixiong

[0]PETSC ERROR: - Error Message 
--


[0]PETSC ERROR: Argument out of range

[0]PETSC ERROR: Inserting a new nonzero at global row/column (6, 15) 
into matrix


You say this happens during the compress() call? That is strange. Are 
you running in parallel, or does this also happen if you run on one 
processor?


Best
 W.

--

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.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] integrating a scalar in a vertical column (e.g. finding hydrostatic pressure at a point)

2017-06-06 Thread Sean McGovern
Hi Wolfgang, 
Thanks for the wonderfully clear answer. For my function f, I can basically 
treat the line integral like a "normal" volume integral, setting the 
direction using the delta functions. This would be the right approach for a 
distributed adaptive setting as well, no? It makes no assumptions about 
cell layout and is defined at the functional level.

If I may ask a follow up with an added wrinkle - it concerns the interplay 
of material_id (cells) and functions:

What if I don't have the form of f?

In my case, I have been using the material_id marker at the cell level to 
indicate different materials, that in the assembly loops, then provide 
different coefficient values to the local sums.
 Suppose that the distribution of these cell identities(material_id) is 
updated based on the results of some FE field calculations. Then given the 
configuration of the cells at that time step, I would like to do the line 
integral (essentially compute the weight of the material above the point), 
and go on to another FE solve. However, I do not have a functional form to 
put in my line integral. 
I don't know how to describe the weight function globally, but locally (at 
the cell level) it is defined. 
Would it be possible to:
1) somehow turn the distribution of cell->material_id over my mesh into a 
Function object (via the characteristic function)?
or 2) enumerate the material property (i.e., densities) into a vector 
defined at quadrature points over the whole mesh?

Thanks for your help. 
Best, 
Sean

PS
"The material of a cell may be used during matrix generation in order to 
implement different coefficients in different parts of the domain. It is 
not used by functions of the grid and dof handling libraries." [1]

Generally, I am hoping to better understand the relationship of the mesh( 
things like looping over cells, querying for the local properties, ...) and 
the Function object class which returns values based on the spatial 
position.

[1]https://www.dealii.org/developer/doxygen/deal.II/classTriangulation.html



On Monday, June 5, 2017 at 10:55:48 PM UTC+2, Wolfgang Bangerth wrote:
>
> On 06/02/2017 07:37 AM, Sean McGovern wrote: 
> > 
> > What's a good way to integrate a quantity in the vertical direction? For 
> > example, how do I find the weight of water above a point (assuming 
> variable 
> > density, so that the integration is necessary)? 
> > In a structured regular mesh, I would fix the x and y coordinates of the 
> grid 
> > and iterate over the z coordinate adding up the different weight 
> contributions 
> > per cell. 
> >   What would the way to emulate this in dealii be (in a globally refined 
> context)? 
>
> What you want to do (a line integral) is, in general, a difficult 
> operation on 
> non-uniform meshes. As with all integrals, you will want to approximate it 
> with some kind of quadrature rule, which would require you to evaluate the 
> solution at quadrature points that are located *somewhere*, as far as the 
> mesh 
> is concerned. You can do this evaluation with VectorTools::point_value(), 
> and 
> this will work if you use a relatively small number of quadrature points 
> located along your vertical line. But the function is expensive if you 
> need a 
> lot of quadrature points. 
>
> An alternative is to rewrite the line integral as a volume integral. For 
> example, your integral 
>
>\int_a^b  f(x0,y0,z)  dz 
>
> (where 'f' is a function of your finite element solution, and x0,y0 are 
> the 
> coordinates of the vertical line you're trying to integrate along) is 
> equal to 
>
>\int\int\int f(x,y,z) \delta(x-x0) \delta(y-y0)  dz dy dz 
>
> If you replace the delta functions by an appropriate approximation (e.g., 
> a 
> Gaussian with a width equal to several times the mesh size), then the 
> integral 
> is approximated by the volume integral 
>
>\int\int\int f(x,y,z) K(x,y,z)  dz dy dz 
>
> with some kernel K(x,y,z). This is now just any other ordinary volume 
> integral 
> where K(x,y,z) is explicitly given. It is easy to integrate on a finite 
> element mesh. 
>
> Best 
>   W. 
>
> -- 
>  
> Wolfgang Bangerth  email: bang...@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.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] Re: How to initialize PETScWrappers::SparseMatrix from a PETSc Mat

2017-06-06 Thread Praveen C
In my applications, I add this to CMakeLists.txt

# In release mode, disable some warning messages

IF(CMAKE_BUILD_TYPE MATCHES Release)

SET( CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -Wno-tautological-compare" )

SET( CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -Wno-unused-parameter" )

SET( CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -Wno-unused-variable" )

ENDIF()

Then I will get warnings in Debug mode but not in Release mode.

praveen

On Tue, Jun 6, 2017 at 8:07 AM, Bruno Turcksin 
wrote:

> Juan Carlos
>
> On Tuesday, June 6, 2017 at 5:34:09 AM UTC-4, Juan Carlos Araujo Cabarcas
> wrote:
>>
>> The warnings come from my code, which is in developing stage!
>> In the installation I had before, [-Wunused-variable],[-Wunused-
>> parameter],[-Wunused-but-set-variable] did not show up. It's a bummer
>> that changing deal.II version will make such a difference! As I am not
>> proficient in cmake, I still think it would be useful to know how to pass
>> compiler flags by modifying CMakeLists.
>>
> cmake -DCMAKE_CXX_FLAGS="my_flags" should work.
>
> Best,
>
> Bruno
>
> --
> 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.
>

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


Re: [deal.II] Re: How to initialize PETScWrappers::SparseMatrix from a PETSc Mat

2017-06-06 Thread Bruno Turcksin
Juan Carlos

On Tuesday, June 6, 2017 at 5:34:09 AM UTC-4, Juan Carlos Araujo Cabarcas 
wrote:
>
> The warnings come from my code, which is in developing stage! 
> In the installation I had before, 
> [-Wunused-variable],[-Wunused-parameter],[-Wunused-but-set-variable] did 
> not show up. It's a bummer that changing deal.II version will make such a 
> difference! As I am not proficient in cmake, I still think it would be 
> useful to know how to pass compiler flags by modifying CMakeLists.
>
cmake -DCMAKE_CXX_FLAGS="my_flags" should work.

Best,

Bruno 

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


Re: [deal.II] convergence adaptive refinement

2017-06-06 Thread Lam DANG
Dear All

I use *write_ucd* with *flags.write_faces = true*, but the result of .ucd 
file is *lack of information of face id 0.*
How I can output the information of face id 0?

The piece of code:







*Triangulation<2> triangulation;GridGenerator::hyper_cube 
(triangulation, 0, 1, true);GridOut grid_out_ucd;GridOutFlags::Ucd 
flags;flags.write_faces = true;grid_out_ucd.set_flags(flags);
std::ofstream out_ucd ("triangulation.ucd");grid_out_ucd.write_ucd 
(triangulation, out_ucd);*

The result of "*triangulation.ucd*"








*4 4 0 0 01  0 0 02  1 0 03  0 1 04  1 1 01 0 quad1 2 4 3 2  2  line
1 2 3  1  line2 4 4  3  line3 4 *

The information of line 0 (*5 0 line 1 3*) is not in output file

Best regards

Lam DANG

On Thursday, June 20, 2013 at 1:20:54 PM UTC+2, Helmut Müller wrote:
>
> Hi Bärbel,
>
> could you give me a short advice how to export the grid/mesh to ucd as you 
> suggested in a previous post ?
>
> I tried it this way:
> stringstream ss2;
> ss2 << "grid-" << cycle << ".ucd";
> GridOut myGridOut;
> GridOutFlags::Ucd flags;
> flags.write_faces = true;
> flags.write_lines = true;
> myGridOut.set_flags(flags);
> std::ofstream output(ss2.str());
> myGridOut.write_ucd(triangulation, output);
> but ParaView doesn´t find the mesh :
>
> ERROR: In 
> /Users/kitware/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/Utilities/VisItBridge/databases/AvtAlgorithms/vtkAvtSTMDFileFormatAlgorithm.cxx,
>  
> line 122
>
> vtkVisItCEAucdReader (0x10b664120): Unable to find any meshes
>
> Any help would be apreciated :)
>
> Cheers,
>
> Helmut
>
> Am Mittwoch, 19. Juni 2013 15:10:45 UTC+2 schrieb Bärbel Janssen:
>>
>> You could use GridOut to write it as a ucd file. If you pass the correct 
>> flags to GridOut it colorizes the boundaries and you can visualize it with 
>> paraview. That's how I usually do it. 
>> There is one more question: How does the solution on the adaptive mesh 
>> look compared to the uniform refined mesh? Is there something wrong with 
>> the solution or just with the quantity you compare?
>>
>> Best,
>> Bärbel
>>
>>
>> 2013/6/19 Scott Miller 
>>
>>> is there a way to output a (refined) grid with colorization (eg. with 
 boundary-id and material-id as number) just to be sure that the 
 inheritance 
 is performed properly ? Which other way would be thinkable ?
>>>
>>>
>>> You can do something like this to output material ids:
>>>
>>> Vector material_ids (triangulation.n_active_cells());
>>> // Omitted code:  Create iterators:  cell, endc
>>> unsigned int cell_counter =0;
>>>
>>> for (unsigned int cell_counter =0; cell!=endc; ++cell,++cell_counter)
>>>
>>> material_ids(cell_counter) = int(cell->material_id());
>>>
>>>
>>> // Add to DataOut object
>>>
>>> data_out.add_data_vector (material_ids, "Material IDs");
>>>
>>>
>>> I don't know that you can output boundary ids to visualize easily, at 
>>> least I typically don't.  You can, however, do the same sort of thing but 
>>> give cells with certain boundary faces different values in the data vector.
>>>
>>>
>>> -Scott
>>>
>>> 
>>>  
>>>
>>> -- 
>>> 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+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>  
>>>  
>>>
>>
>>

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


Re: [deal.II] Re: How to initialize PETScWrappers::SparseMatrix from a PETSc Mat

2017-06-06 Thread Juan Carlos Araujo Cabarcas
Thanks for answering!

The warnings come from my code, which is in developing stage! 
In the installation I had before, 
[-Wunused-variable],[-Wunused-parameter],[-Wunused-but-set-variable] did 
not show up. It's a bummer that changing deal.II version will make such a 
difference! As I am not proficient in cmake, I still think it would be 
useful to know how to pass compiler flags by modifying CMakeLists.

El lunes, 5 de junio de 2017, 22:48:28 (UTC+2), Wolfgang Bangerth escribió:
>
>
> Juan Carlos, 
>
> > 1) First, I get way too many warnings like: 
> >   
> [-Wunused-variable],[-Wunused-parameter],[-Wunused-but-set-variable],etc 
> ... 
> > 
> > Then I would like to ask if there is a clean to disable warnings of this 
> type? 
> > maybe adding some lines to the CMakeLists? 
>
> Are these warnings coming out of deal.II, or out of your own code? If the 
> latter, you should of course fix them -- warnings warn you about issues 
> with 
> your code for very good reasons! 
>
>
> > 2) I realized that the type *PETScWrappers::Vector *has disappeared from 
> the 
> > library! 
> > As mentioned above, I was comfortably reading a native PETSc vector 
> *vec* from 
> > disk by doing *PETScWrappers::Vector (vec); *Now that it is gone,**I 
> don't 
> > really know what is the successor. 
>
> Just use PETScWrappers::MPI::Vector, but with MPI_COMM_SELF as the 
> communicator. This creates a local vector. 
>
> Best 
>   W. 
>
> -- 
>  
> Wolfgang Bangerth  email: bang...@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.
For more options, visit https://groups.google.com/d/optout.


[deal.II] Re: compress error for vector of PETScWrappers::MPI::SparseMatrix

2017-06-06 Thread Weixiong Zheng


在 2017年6月6日星期二 UTC-7上午2:13:28,Weixiong Zheng写道:
>
> Dear All,
>
> I am doing a radiation transport problem, which has multiple individual 
> equations (number determined by the number of directions we input). As the 
> number of directions is arbitrary, I put the sparsematries are contained in 
> std::vectors as raw pointers (using LA namespace to stand for PETScWrappers)
>
std::vector sys_mats;
> When initializing:
> for (unsigned int i=0; i {
>
Sorry for the typo, I actually meant for
sys_mats.push_back (new LA::MPI::SparseMatrix);
 

>
>   sys_mats.push_back (new LA::MPI::SparseMatrix*);
>   sys_mats[i]->reinit (locally_owned_dofs,
>   locally_owned_dofs,
>   dsp,
>   mpi_communicator);
> }
>
> When assembling:
> for (; cell!=endc; ++cell)
> {
>   if (cell->is_locally_owned())
>   {
> std::vector > local_mats
> // do local matrix and boundary term assembly for all directions in 
> one cell
> cell->get_dof_indices (local_dof_indices);
>
> // Map local matrices to global matrices for all directions
> for (unsigned int i=0; i {
>   sys_mats[i]->add (local_dof_indices,
> local_mats [ i ]);
> }
>   }
> }
>
> Then we compress:
> for (unsigned int i=0; i {
>   sys_mats[i]->compress (VectorOperation::add);
>   pcout << "we have compressed Dir " << i << std::endl;
> }
>
> Now, I got the error: compressing can go through direction 0 but not 1 
> with the error at the end of this post.
> Any ideas how to fix it?
>
> Thanks in advance!
> Weixiong
>
> [0]PETSC ERROR: - Error Message 
> --
>
> [0]PETSC ERROR: Argument out of range
>
> [0]PETSC ERROR: Inserting a new nonzero at global row/column (6, 15) into 
> matrix
>
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html 
> for trouble shooting.
>
> [0]PETSC ERROR: Petsc Release Version 3.6.3, unknown 
>
>
> [0]PETSC ERROR: #1 MatSetValues_MPIAIJ() line 613 in 
> /usr/local/src/d2-parallel-package/petsc/src/mat/impls/aij/mpi/mpiaij.c
>
> [0]PETSC ERROR: #2 MatAssemblyEnd_MPIAIJ() line 731 in 
> /usr/local/src/d2-parallel-package/petsc/src/mat/impls/aij/mpi/mpiaij.c
>
> [0]PETSC ERROR: #3 MatAssemblyEnd() line 5098 in 
> /usr/local/src/d2-parallel-package/petsc/src/mat/interface/matrix.c
>
> ERROR: Uncaught exception in MPI_InitFinalize on proc 0. Skipping 
> MPI_Finalize() to avoid a deadlock.
>
> 
>
> Exception on processing: 
>
>
> 
>
> An error occurred in line <263> of file 
> <../source/lac/petsc_matrix_base.cc> in function
>
> void dealii::PETScWrappers::MatrixBase::compress(const 
> VectorOperation::values)
>
> The violated condition was: 
>
> ierr == 0
>
> The name and call sequence of the exception was:
>
> ExcPETScError(ierr)
>
> Additional Information: 
>
> An error with error number 63 occurred while calling a PETSc function
>
> 
>
>
> Aborting!
>
> 
>
> ---
>
> Primary job  terminated normally, but 1 process returned
>
> a non-zero exit code.. Per user-direction, the job has been aborted.
>
> ---
>
> --
>
> MPI_ABORT was invoked on rank 1 in communicator MPI_COMM_WORLD 
>
> with errorcode 59.
>
>
> NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
>
> You may or may not see output from other processes, depending on
>
> exactly when Open MPI kills them.
>
> --
>
> [1]PETSC ERROR: 
> 
>
> [1]PETSC ERROR: Caught signal number 15 Terminate: Some process (or the 
> batch system) has told this process to end
>
> [1]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
>
> [1]PETSC ERROR: or see 
> http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind
>
> [1]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac OS 
> X to find memory corruption errors
>
> [1]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and 
> run 
>
> [1]PETSC ERROR: to get more information on the crash.
>
> [1]PETSC ERROR: - Error Message 
> --
>
> [1]PETSC ERROR: Signal received
>
> [1]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html 
> for trouble shooting.
>
> [1]PETSC ERROR: Petsc Release Version 3.6.3, unknown 
>
> [1]PETSC ERROR: dg-ep-proto on a uly

[deal.II] compress error for vector of PETScWrappers::MPI::SparseMatrix

2017-06-06 Thread Weixiong Zheng
Dear All,

I am doing a radiation transport problem, which has multiple individual 
equations (number determined by the number of directions we input). As the 
number of directions is arbitrary, I put the sparsematries are contained in 
std::vectors as raw pointers (using LA namespace to stand for PETScWrappers)
std::vector sys_mats;
When initializing:
for (unsigned int i=0; ireinit (locally_owned_dofs,
  locally_owned_dofs,
  dsp,
  mpi_communicator);
}

When assembling:
for (; cell!=endc; ++cell)
{
  if (cell->is_locally_owned())
  {
std::vector > local_mats
// do local matrix and boundary term assembly for all directions in one 
cell
cell->get_dof_indices (local_dof_indices);

// Map local matrices to global matrices for all directions
for (unsigned int i=0; iadd (local_dof_indices,
local_mats [ i ]);
}
  }
}

Then we compress:
for (unsigned int i=0; icompress (VectorOperation::add);
  pcout << "we have compressed Dir " << i << std::endl;
}

Now, I got the error: compressing can go through direction 0 but not 1 with 
the error at the end of this post.
Any ideas how to fix it?

Thanks in advance!
Weixiong

[0]PETSC ERROR: - Error Message 
--

[0]PETSC ERROR: Argument out of range

[0]PETSC ERROR: Inserting a new nonzero at global row/column (6, 15) into 
matrix

[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for 
trouble shooting.

[0]PETSC ERROR: Petsc Release Version 3.6.3, unknown 


[0]PETSC ERROR: #1 MatSetValues_MPIAIJ() line 613 in 
/usr/local/src/d2-parallel-package/petsc/src/mat/impls/aij/mpi/mpiaij.c

[0]PETSC ERROR: #2 MatAssemblyEnd_MPIAIJ() line 731 in 
/usr/local/src/d2-parallel-package/petsc/src/mat/impls/aij/mpi/mpiaij.c

[0]PETSC ERROR: #3 MatAssemblyEnd() line 5098 in 
/usr/local/src/d2-parallel-package/petsc/src/mat/interface/matrix.c

ERROR: Uncaught exception in MPI_InitFinalize on proc 0. Skipping 
MPI_Finalize() to avoid a deadlock.



Exception on processing: 




An error occurred in line <263> of file 
<../source/lac/petsc_matrix_base.cc> in function

void dealii::PETScWrappers::MatrixBase::compress(const 
VectorOperation::values)

The violated condition was: 

ierr == 0

The name and call sequence of the exception was:

ExcPETScError(ierr)

Additional Information: 

An error with error number 63 occurred while calling a PETSc function




Aborting!



---

Primary job  terminated normally, but 1 process returned

a non-zero exit code.. Per user-direction, the job has been aborted.

---

--

MPI_ABORT was invoked on rank 1 in communicator MPI_COMM_WORLD 

with errorcode 59.


NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.

You may or may not see output from other processes, depending on

exactly when Open MPI kills them.

--

[1]PETSC ERROR: 


[1]PETSC ERROR: Caught signal number 15 Terminate: Some process (or the 
batch system) has told this process to end

[1]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger

[1]PETSC ERROR: or see 
http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind

[1]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac OS X 
to find memory corruption errors

[1]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and 
run 

[1]PETSC ERROR: to get more information on the crash.

[1]PETSC ERROR: - Error Message 
--

[1]PETSC ERROR: Signal received

[1]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for 
trouble shooting.

[1]PETSC ERROR: Petsc Release Version 3.6.3, unknown 

[1]PETSC ERROR: dg-ep-proto on a uly named my_hostname by GrillCheese Tue 
Jun  6 01:18:23 2017

[1]PETSC ERROR: Configure options --with-make-np=8 --with-debugging=0 
--prefix=/Applications/deal.II.app/Contents/Resources/opt/petsc-3e25e16 
--with-mpi-dir=/Applications/deal.II.app/Contents/Resources/opt/openmpi-1.10.2 
--with-sundials-dir=/Applications/deal.II.app/Contents/Resources/opt/sundials-6b7e4b6
 
--with-shared-libraries 
--with-external-packages-dir=/Users/heltai/d2-parallel-package/petsc-external 
--download-parmetis --download-metis --downl