[dune-pdelab] Segmentation fault

Tatiana Kim T.Kim at bath.ac.uk
Wed Jun 17 10:40:17 CEST 2015


Thanks Bernd and Oliver for your help. 

In order to get around the problem, I tried to use YaspGrid to create a fine mesh and solve the problem on the structured grid (I get a coefficient vector that would describe the "exact solution", u, in my program). I then use UGGrid to import a coarse mesh from Gmesh on the same geometry and compute solution on the unstructured grid (I get a coefficient vector that describes the approximate solution u_h). 

I now want to compute L2_error: u-u_h. 

Can this be done for two functions that are defined on different type grids? 

There is an Interpolation Error Example in PDELab-howto manual (Chapter 9.5) where code for l2interpolationerror.hh is given. It requires U (type of a function), GFS (grid function space) and X (coefficient vector). Would it be an option to interpolate the coefficient vector for the exact solution into a function U and use that in l2interpolationerror  to get what I want? Or is there an easier/correct/working way to do it?

Many thanks,
Tatiana.


________________________________________
From: dune-pdelab-bounces+t.kim=bath.ac.uk at dune-project.org <dune-pdelab-bounces+t.kim=bath.ac.uk at dune-project.org> on behalf of Oliver Sander <sander at igpm.rwth-aachen.de>
Sent: 15 June 2015 13:01
To: dune-pdelab at dune-project.org
Subject: Re: [dune-pdelab] Segmentation fault

> Concerning the second error: as the message says, it is not possible to have two
> UGGrids at once.

It is not possible to have two *parallel* UGGrids at once.  If you build UG without MPI
then you can have as may grids as you like.

--
Oliver

 You should be able to circummvent that by putting the two stages in separate blocks
>
> {
> typedef UGGrid<dim> GridType;
>
>     GridType grid;
>
>     GridFactory<GridType> factory(&grid);
>
>     GmshReader<GridType>::read(factory,"fine.msh");
>
>     factory.createGrid();
>
>     std::cout << " Fine mesh has been read " << std::endl;
> }
> {
>
> typedef UGGrid<dim> GridType1;
>
>     GridType1 grid1;
>
>     GridFactory<GridType1> factory1(&grid1);
>
>     GmshReader<GridType1>::read(factory1,"cube2.msh");
>
>     factory1.createGrid();
>
> typedef GridType1::LeafGridView GridView;
>
>
>     std::cout << " Coarse mesh has been read " << std::endl;
> }
>
>
> The question is if that is useful for you. If you need both grids to be present at the same time in order to compare your results, you should either use another grid manager or have both the fine and
> the coarse grid within one UGGrid multigrid structure.
>
> Kind regards
> Bernd
>
> On 06/15/2015 12:45 PM, Tatiana Kim wrote:
>>
>> Hello,
>>
>>
>> I would like to read in several meshes from Gmesh into UGGrid. Below is a simple example where I have two meshes: fine and coarse. I first read in the fine mesh and then I read in the coarse mesh.
>> The idea is that I solve the problem on fine mesh first and on the coarse mesh second and then compare the results.
>>
>>
>> //*******************************************************************
>>
>> typedef UGGrid<dim> GridType;
>>
>>     GridType grid;
>>
>>     GridFactory<GridType> factory(&grid);
>>
>>     GmshReader<GridType>::read(factory,"fine.msh");
>>
>>     factory.createGrid();
>>
>>     std::cout << " Fine mesh has been read " << std::endl;
>>
>> //************************************************************************
>>
>>
>>
>>     GmshReader<GridType>::read(factory,"coarse.msh");
>>
>>     factory.createGrid();
>>
>>
>>     std::cout << " Coarse mesh has been read " << std::endl;
>>
>> //************************************************************************ ​
>>
>>
>>
>> It compiles fine, but when I run it, I get the following error (when creating cube2.msh grid):
>>
>>
>> Reading 3d Gmsh grid...
>>
>> version 2.2 Gmsh file detected
>>
>> file contains 6580 nodes
>>
>> file contains 37673 elements
>>
>> number of real vertices = 6580
>>
>> number of boundary elements = 6266
>>
>> number of elements = 31407
>>
>>  Fine mesh has been read
>>
>> Reading 3d Gmsh grid...
>>
>> version 2.2 Gmsh file detected
>>
>> file contains 1115 nodes
>>
>> file contains 5961 elements
>>
>> number of real vertices = 1115
>>
>> number of boundary elements = 1476
>>
>> number of elements = 4485
>>
>> [138-38-185-242:14754] *** Process received signal ***
>>
>> [138-38-185-242:14754] Signal: Segmentation fault: 11 (11)
>>
>> [138-38-185-242:14754] Signal code: Address not mapped (1)
>>
>> [138-38-185-242:14754] Failing at address: 0xe8
>>
>> [138-38-185-242:14754] [ 0] 0   libsystem_platform.dylib     0x00007fff8647b5aa _sigtramp + 26
>>
>> [138-38-185-242:14754] [ 1] 0   libsystem_c.dylib     0x00007fff723d12a0 usual + 0
>>
>> [138-38-185-242:14754] [ 2] 0   testproject     0x00000001063ab5fa _ZN4Dune10GmshReaderINS_6UGGridILi3EEEE4readERNS_11GridFactoryIS2_EERKSsbb + 2426
>>
>> [138-38-185-242:14754] [ 3] 0   testproject     0x000000010642ce72 main + 226
>>
>> [138-38-185-242:14754] [ 4] 0   libmpi.1.dylib     0x0000000106d7df20 ompi_mpi_comm_world + 0
>>
>> [138-38-185-242:14754] *** End of error message ***
>>
>> Segmentation fault: 11
>>
>>
>>
>> If, for the second part of the code, I write:
>>
>> //************************************************************************
>>
>>
>> typedef UGGrid<dim> GridType1;
>>
>>     GridType1 grid1;
>>
>>     GridFactory<GridType1> factory1(&grid1);
>>
>>     GmshReader<GridType1>::read(factory1,"cube2.msh");
>>
>>     factory1.createGrid();
>>
>> typedef GridType1::LeafGridView GridView;
>>
>>
>>     std::cout << " Coarse mesh has been read " << std::endl;
>>
>> //************************************************************************
>>
>>
>> then I get this error instead of the segmentation fault:
>>
>> "ERROR in InitCurrMG: opening more than one MG is not allowed in parallel"
>>
>>
>>
>> Could you please help me figure out what I am doing wrong?
>>
>>
>> Thanks!
>>
>> Tatiana.
>>
>>
>>
>>
>> _______________________________________________
>> dune-pdelab mailing list
>> dune-pdelab at dune-project.org
>> http://lists.dune-project.org/mailman/listinfo/dune-pdelab
>
>
>
>
> _______________________________________________
> dune-pdelab mailing list
> dune-pdelab at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-pdelab
>



More information about the dune-pdelab mailing list