[deal.II] problem adding two blocks of BlockSparseMatrix

2017-07-25 Thread Anna Avdeeva
Dear All,

I need to subtract two blocks of a BlockSparseMatrix system_matrix.
I am trying to achieve this by 
creating SpraseMatrix tmp1, then 
  tmp1.copy_from(system_matrix.block(0,0));
  tmp1.add(-1.0, system_matrix.block(0,1));

However, I am getting the following error message:
"When copying one sparse matrix into another, or when adding one sparse 
matrix to another, both matrices need to refer to the same sparsity 
pattern."

Could you please help me to overcome this problem? 

system_matrix has BlockSparsityPattern sparsity_pattern;

which was obtained in the following way:

BlockDynamicSparsityPattern dsp (2, 2);
dsp.block (0, 0).reinit (n_E_re, n_E_re);
dsp.block (1, 0).reinit (n_E_im, n_E_re);
dsp.block (0, 1).reinit (n_E_re, n_E_im);
dsp.block (1, 1).reinit (n_E_im, n_E_im);
dsp.collect_sizes ();
DoFTools::make_sparsity_pattern (dof_handler, dsp, constraints,
false);
sparsity_pattern.copy_from (dsp);


I have tried various ways of declaring tmp1. Such as 
SparseMatrix tmp1(system_matrix.block(0,0).get_sparsity_pattern())
or creating tmp1 as BlockSparseMatrix tmp1(sparsity_pattern)

Thank you in advance for your help. 


-- 
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: Status of support for complex equations?

2017-07-25 Thread Matthias Maier

On Tue, Jul 25, 2017, at 14:24 CDT, Denis Davydov  wrote:

> which Matthias wanted to do over the weekend in July 2016 :-)

<_<

Long weekend! *cough*

Best,
Matthias

-- 
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: Status of support for complex equations?

2017-07-25 Thread Denis Davydov
Have a look at this issue which aggregates efforts in this 
direction: https://github.com/dealii/dealii/issues/2033
Essentially, the main missing piece is ConstraintMatrix 
https://github.com/dealii/dealii/issues/1760 
which Matthias wanted to do over the weekend in July 2016 :-) I think there 
is a prototype branch, 
so if you need to work with complex-valued algebra, you might want to look 
at this issue.

Cheers,
Denis.

On Wednesday, July 19, 2017 at 4:59:08 PM UTC+2, Maxi Miller wrote:
>
> Hei,
> I was wondering if dealII already natively supports equations containing 
> imaginary values, such as
>   
> 
> or if I still have to split them up, such as in example 29?
> 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.
For more options, visit https://groups.google.com/d/optout.


[deal.II] Re: website petsc tutorial

2017-07-25 Thread Jean-Paul Pelteret
Hi Yi-Chung,

We typically update that documentation for the versions that we 
specifically test against, so unless the documentation was accidentally not 
updated then it is best to assume that the version mentioned on the website 
is the most recent version that is, to the best of our knowledge, 
compatible and bug-free when used with that specific release of deal.II. It 
might be the case that a newer version works with deal.II, but it may not 
be fully tested.

However, I will see if I can dig up some information on which was the most 
recent version of PETSc tested at that time, and double check if the 
documentation was up-to-date at that point or not.

Best,
Jean-Paul

On Tuesday, July 25, 2017 at 5:02:00 PM UTC+2, Yi-Chung Chen wrote:
>
> Hi Jean-Paul, 
>
> Thank you for explaining it. I have the question because the page shows 
> deal.ii is compatible with petsc 3.6.0. As I may recall, 8.4.1 is 
> compatible with 3.6.4, right? 
>
> All best, 
> YC Chen
>
> On Tuesday, July 25, 2017 at 3:50:41 PM UTC+1, Jean-Paul Pelteret wrote:
>>
>> Dear Yi-Chung,
>>
>> Thanks for the information, but this is done by design (so there is no 
>> problem). 
>>
>> At the time of the release of deal.II 8.5.0, the content linked to on  
>> http://www.dealii.org/8.5.0/external-libs/petsc.html 
>> 
>> would have been the most recent release that deal.II was certified to 
>> work with. If, in the months that have passed since the release of that 
>> version, a new version of PETSc (or any other 3rd party libraries) then we 
>> test it, patch the developer version of deal.II if necessary, and update 
>> the information on the developer site, in this case being
>> https://www.dealii.org/developer/external-libs/petsc.html
>> for PETSc. At the time of the next release, we take a snapshot of the 
>> information on the developer site and it becomes "frozen" for that release.
>>
>> Does that make sense?
>>
>> Kind regards,
>> Jean-Paul
>>
>> On Tuesday, July 25, 2017 at 3:43:16 PM UTC+2, Yi-Chung Chen wrote:
>>>
>>> Hi all, 
>>>
>>> one link errors of the website regarding PETSC installation (I assume)
>>>
>>> if visiting http://www.dealii.org/8.5.0/readme.html
>>> and click More information on configuring and building PETSc can be 
>>> found here .<= 
>>> this link
>>>
>>> it will redirect you to 
>>> http://www.dealii.org/8.5.0/external-libs/petsc.html
>>> the content is old.
>>>
>>> try this https://www.dealii.org/developer/external-libs/petsc.html
>>> petsc 3.7.6 is compatible to 8.5.0 (I tested it)
>>>
>>>

-- 
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: website petsc tutorial

2017-07-25 Thread Yi-Chung Chen
Hi Jean-Paul, 

Thank you for explaining it. I have the question because the page shows 
deal.ii is compatible with petsc 3.6.0. As I may recall, 8.4.1 is 
compatible with 3.6.4, right? 

All best, 
YC Chen

On Tuesday, July 25, 2017 at 3:50:41 PM UTC+1, Jean-Paul Pelteret wrote:
>
> Dear Yi-Chung,
>
> Thanks for the information, but this is done by design (so there is no 
> problem). 
>
> At the time of the release of deal.II 8.5.0, the content linked to on  
> http://www.dealii.org/8.5.0/external-libs/petsc.html 
> 
> would have been the most recent release that deal.II was certified to work 
> with. If, in the months that have passed since the release of that version, 
> a new version of PETSc (or any other 3rd party libraries) then we test it, 
> patch the developer version of deal.II if necessary, and update the 
> information on the developer site, in this case being
> https://www.dealii.org/developer/external-libs/petsc.html
> for PETSc. At the time of the next release, we take a snapshot of the 
> information on the developer site and it becomes "frozen" for that release.
>
> Does that make sense?
>
> Kind regards,
> Jean-Paul
>
> On Tuesday, July 25, 2017 at 3:43:16 PM UTC+2, Yi-Chung Chen wrote:
>>
>> Hi all, 
>>
>> one link errors of the website regarding PETSC installation (I assume)
>>
>> if visiting http://www.dealii.org/8.5.0/readme.html
>> and click More information on configuring and building PETSc can be found 
>> here .<= this link
>>
>> it will redirect you to 
>> http://www.dealii.org/8.5.0/external-libs/petsc.html
>> the content is old.
>>
>> try this https://www.dealii.org/developer/external-libs/petsc.html
>> petsc 3.7.6 is compatible to 8.5.0 (I tested it)
>>
>>

-- 
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: website petsc tutorial

2017-07-25 Thread Jean-Paul Pelteret
Dear Yi-Chung,

Thanks for the information, but this is done by design (so there is no 
problem). 

At the time of the release of deal.II 8.5.0, the content linked to on  
http://www.dealii.org/8.5.0/external-libs/petsc.html 

would have been the most recent release that deal.II was certified to work 
with. If, in the months that have passed since the release of that version, 
a new version of PETSc (or any other 3rd party libraries) then we test it, 
patch the developer version of deal.II if necessary, and update the 
information on the developer site, in this case being
https://www.dealii.org/developer/external-libs/petsc.html
for PETSc. At the time of the next release, we take a snapshot of the 
information on the developer site and it becomes "frozen" for that release.

Does that make sense?

Kind regards,
Jean-Paul

On Tuesday, July 25, 2017 at 3:43:16 PM UTC+2, Yi-Chung Chen wrote:
>
> Hi all, 
>
> one link errors of the website regarding PETSC installation (I assume)
>
> if visiting http://www.dealii.org/8.5.0/readme.html
> and click More information on configuring and building PETSc can be found 
> here .<= this link
>
> it will redirect you to 
> http://www.dealii.org/8.5.0/external-libs/petsc.html
> the content is old.
>
> try this https://www.dealii.org/developer/external-libs/petsc.html
> petsc 3.7.6 is compatible to 8.5.0 (I tested it)
>
>

-- 
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: Parallel GridIn of large file - PETSC Error

2017-07-25 Thread Yi-Chung Chen
Hi Mathias

Would you mind to check the memory usage? I guess you have about 3M DOFs 
right (based on the file size of msh)? My experience told me that 32GB can 
handle 10M DOFs(roughly). Your case is about 10GB memory based on the 
calculation.If you are using distributed mesh, which means you has a 
initial copy for each processor you assigned. Say you have 40 in a node and 
you use all of them, which indicates that your memory use is 10*40= 400 per 
node. I guess this is the reason. 

Another problem is int range (for index).

All best, 
YC Chen.

On Tuesday, May 9, 2017 at 11:40:22 AM UTC+1, Mathias Mentler wrote:
>
> Hi everybody, 
>
> I am currently trying to read in a large (~300MB) .msh mesh-file by using 
> the GridIn-workflow (described here 
> 
>  ). 
> My triangulation is of type parallel::distributed::Triangulation. I then 
> use four nodes (each with 64GB RAM and 40 processors) of a cluster, 
> accordingly spawn 160 processes and try to do my computations. However 
> while doing the ".read_msh()"-bit I get a PETSC-error I can't make sense 
> of. What I get from one process is:
>
> [0]PETSC ERROR: 
> 
> [0]PETSC ERROR: Caught signal number 15 Terminate: Some process (or the 
> batch system) has told this process to end
> [0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
> [0]PETSC ERROR: or see 
> http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind
> [0]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac OS 
> X to find memory corruption errors
> [0]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and 
> run
> [0]PETSC ERROR: to get more information on the crash.
> [0]PETSC ERROR: - Error Message 
> --
> [0]PETSC ERROR: Signal received
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html 
> for trouble shooting.
> [0]PETSC ERROR: Petsc Release Version 3.7.5, Jan, 01, 2017
> [0]PETSC ERROR: Configure options 
> --prefix=/home/woody/iwtm/iwtm002h/spack_dealii/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/petsc-3.7.5-6itsodseoiu5dr5aizwji7ki42p7gg7y
>  
> --with-ssl=0 --with-x=0 --download-c2$
> [0]PETSC ERROR: #1 User provided function() line 0 in  unknown file
>
>
> Could there be a problem with the needed memory? From what I read in a 
> related 
> question 
> ,
>  
> each process holds the coarsest mesh and since I don't refine the mesh any 
> further, each process will hold the entire mesh/triangulation. 
>
>
> Regards,
>
> Mathias 
>

-- 
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] website petsc tutorial

2017-07-25 Thread Yi-Chung Chen
Hi all, 

one link errors of the website regarding PETSC installation (I assume)

if visiting http://www.dealii.org/8.5.0/readme.html
and click More information on configuring and building PETSc can be found 
here .<= this link

it will redirect you to http://www.dealii.org/8.5.0/external-libs/petsc.html
the content is old.

try this https://www.dealii.org/developer/external-libs/petsc.html
petsc 3.7.6 is compatible to 8.5.0 (I tested it)

-- 
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] Mapping points of mesh generated by gmsh

2017-07-25 Thread Giovanni Di Ilio
Dear Jean-Paul,

(I tried also version 8.4.1 and same problem).
Ok, thanks a lot!

Best,
Giovanni

On Tuesday, July 25, 2017 at 9:08:53 AM UTC+2, Jean-Paul Pelteret wrote:
>
> Dear Giovanni,
>
> Thank you very much for the clear and simple test case! I've played around 
> with it and I don't see any fault in the way that you're trying to use the 
> mapping functionality, so I think that its quite clear that there's 
> something wrong with Mapping::transform_real_to_unit_cell. I've tested this 
> with both deal.II 8.5 and the development version and the problem exists in 
> both cases. I've opened a issue on GitHub 
>  that uses your example to 
> demonstrate the problem. I'll report back here when we make some headway 
> towards solving the issue!
>
> Best regards,
> Jean-Paul
>
> On Tuesday, July 25, 2017 at 12:29:51 AM UTC+2, Giovanni Di Ilio wrote:
>>
>> Sorry, I thought I worked around the problem but actually I did not. The 
>> mapping fails again when I work with a refined mesh, for both the cases of 
>> a mesh read in from gmsh and a mesh generated with Deal.
>>
>> I try to explain better what I mean:
>> 1) I generate a grid, using: 
>> *GridGenerator::subdivided_hyper_rectangle(triangulation,repetitions,p1,p2)* 
>> ;
>> 2) I refine one time the grid with: *triangulation.refine_global(1)* ;
>> 3) I run over the cells and I try to get the mapped position of a given 
>> point, which I set to be in the centre of the considered cell: 
>> *mapping.transform_real_to_unit_cell*.
>>
>> Since the point I am testing is exactly in the centre of the cell I 
>> expect the mapped position, in the unit cell, to be x = 0.5; y = 0.5.
>> However, for some "random" cell, again, the mapping fails.
>>
>> Here I am not dealing anymore with the digits of accuracy.
>> The numbers I am dealing with are the coordinates of the vertexes 
>> provided by the GridGenerator and the coordinates of a testing point, which 
>> have just a couple of digits after comma. Moreover, the spacing between 
>> vertexes for the cells I am considering is of the order of 0.1.
>>
>> I attach a very simple example, where I consider a uniform grid of 5 x 5 
>> elements (repetitions[0]=repetitions[1]=5), refined one time, so 100 
>> elements in total.
>> For cell with index 96 of my example, which vertexes are:
>> vertex(0): 0.8 0.8
>> vertex(1): 0.9 0.8
>> vertex(2): 0.8 0.9
>> vertex(3): 0.9 0.9
>> I test the point (0.85, 0.85) and the mapped position in the unit cell 
>> results to be: (0.5, 0.46875) instead of (0.5, 0.5).
>>
>> You may notice that, by running the example with refineglobal(false), the 
>> mapping on an equivalent grid made of 10 x 10 elements, with no refinements 
>> (repetitions[0]=repetitions[1]=10), works just fine.
>> I don't see any difference between the two cases.
>> What is missing here? Can you help me please?
>>
>> Thank you very much,
>> Best,
>>
>> Giovanni
>>
>>
>>
>> On Saturday, July 22, 2017 at 8:57:57 PM UTC+2, Wolfgang Bangerth wrote:
>>>
>>> On 07/22/2017 04:42 AM, Giovanni Di Ilio wrote: 
>>> > 
>>> > Yes, I agree, the issue is definitely related to round-off error. But 
>>> I still 
>>> > don't understand why the mapping fails, if the vertex coordinates read 
>>> in from 
>>> > my .msh file are apparently stored as doubles... 
>>> > Anyway, yes, the problem is easily overcome by "manipulating" the 
>>> values 
>>> > before mapping. 
>>>
>>> The numbers you consider differ in the last two or three bits when 
>>> stored as 
>>> double precision. Any computations you do with them, for example in the 
>>> mapping, will then necessarily be completely off. 
>>>
>>> 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] Mapping points of mesh generated by gmsh

2017-07-25 Thread Jean-Paul Pelteret
Dear Giovanni,

Thank you very much for the clear and simple test case! I've played around 
with it and I don't see any fault in the way that you're trying to use the 
mapping functionality, so I think that its quite clear that there's 
something wrong with Mapping::transform_real_to_unit_cell. I've tested this 
with both deal.II 8.5 and the development version and the problem exists in 
both cases. I've opened a issue on GitHub 
 that uses your example to 
demonstrate the problem. I'll report back here when we make some headway 
towards solving the issue!

Best regards,
Jean-Paul

On Tuesday, July 25, 2017 at 12:29:51 AM UTC+2, Giovanni Di Ilio wrote:
>
> Sorry, I thought I worked around the problem but actually I did not. The 
> mapping fails again when I work with a refined mesh, for both the cases of 
> a mesh read in from gmsh and a mesh generated with Deal.
>
> I try to explain better what I mean:
> 1) I generate a grid, using: 
> *GridGenerator::subdivided_hyper_rectangle(triangulation,repetitions,p1,p2)* 
> ;
> 2) I refine one time the grid with: *triangulation.refine_global(1)* ;
> 3) I run over the cells and I try to get the mapped position of a given 
> point, which I set to be in the centre of the considered cell: 
> *mapping.transform_real_to_unit_cell*.
>
> Since the point I am testing is exactly in the centre of the cell I expect 
> the mapped position, in the unit cell, to be x = 0.5; y = 0.5.
> However, for some "random" cell, again, the mapping fails.
>
> Here I am not dealing anymore with the digits of accuracy.
> The numbers I am dealing with are the coordinates of the vertexes provided 
> by the GridGenerator and the coordinates of a testing point, which have 
> just a couple of digits after comma. Moreover, the spacing between vertexes 
> for the cells I am considering is of the order of 0.1.
>
> I attach a very simple example, where I consider a uniform grid of 5 x 5 
> elements (repetitions[0]=repetitions[1]=5), refined one time, so 100 
> elements in total.
> For cell with index 96 of my example, which vertexes are:
> vertex(0): 0.8 0.8
> vertex(1): 0.9 0.8
> vertex(2): 0.8 0.9
> vertex(3): 0.9 0.9
> I test the point (0.85, 0.85) and the mapped position in the unit cell 
> results to be: (0.5, 0.46875) instead of (0.5, 0.5).
>
> You may notice that, by running the example with refineglobal(false), the 
> mapping on an equivalent grid made of 10 x 10 elements, with no refinements 
> (repetitions[0]=repetitions[1]=10), works just fine.
> I don't see any difference between the two cases.
> What is missing here? Can you help me please?
>
> Thank you very much,
> Best,
>
> Giovanni
>
>
>
> On Saturday, July 22, 2017 at 8:57:57 PM UTC+2, Wolfgang Bangerth wrote:
>>
>> On 07/22/2017 04:42 AM, Giovanni Di Ilio wrote: 
>> > 
>> > Yes, I agree, the issue is definitely related to round-off error. But I 
>> still 
>> > don't understand why the mapping fails, if the vertex coordinates read 
>> in from 
>> > my .msh file are apparently stored as doubles... 
>> > Anyway, yes, the problem is easily overcome by "manipulating" the 
>> values 
>> > before mapping. 
>>
>> The numbers you consider differ in the last two or three bits when stored 
>> as 
>> double precision. Any computations you do with them, for example in the 
>> mapping, will then necessarily be completely off. 
>>
>> 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.