Is there any support in PETSC (with other packages) for finite element multigrid on unstructured meshes? Any recommended way to do that? Any tutorial or examples? Thanks. <br><br>------------------------------<br>
<br>
Message: 3<br>
Date: Mon, 16 May 2011 14:08:12 -0500<br>
From: Barry Smith &lt;<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>&gt;<br>
Subject: Re: [petsc-users] Can you provide a basic example of using<br>
        PCMG for        multigrid applications?<br>
To: PETSc users list &lt;<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>&gt;<br>
Message-ID: &lt;<a href="mailto:E727136F-395E-4E88-9D0A-6C8E07177DD4@mcs.anl.gov">E727136F-395E-4E88-9D0A-6C8E07177DD4@mcs.anl.gov</a>&gt;<br>
Content-Type: text/plain; charset=us-ascii<br>
<br>
<br>
On May 16, 2011, at 1:36 AM, Li, Zhisong (lizs) wrote:<br>
<br>
&gt;  Hi, Petsc Team,<br>
&gt;<br>
&gt; In my knowledge of Petsc, the PCMG object is the main tool for 
general multigrid calculations, as DMMG only works for simple constant 
matrix and RHS.<br>
<br>
   This is not correct. DMMG can be used for non-constant matrix. DMMG 
is restricted to structured grids only. But if your problem is on a two 
or three dimensional structured grid you can use it and it is much 
easier than coding the pieces directly.<br>
<br>
<br>
<br>
&gt;  But it&#39;s difficult to find any example code for using PCMG.  I 
checked out the petsc-user mail archive on this topic but still not find
 a good description on it.  I encounter similar errors in the practice 
as some previous question-raisers did.<br>
&gt;<br>
&gt; Here is my simple code implementing the PCMG based on my 
understanding from the user manual and tutorial.  It is supposed to have
 multigrid of only two levels (finest and coarsest grid).  The error 
message indicates SEGV segmentation violation because of this part of 
code.  Anything wrong with this implementation?<br>
&gt;<br>
<br>
    This code looks more or less correct. You need to run with -start_in_debugger to track down what is trigger the SEGV<br>
<br>
    src/ksp/ksp/examples/<div id=":1iz">tutorials/ex19.c is a simple example that runs on two levels.<br>
<br>
<br>
   Barry<br>
<br>
<br>
&gt;<br>
&gt;   DAGetMatrix(da, MATAIJ, &amp;M);<br>
&gt;<br>
&gt;   KSPCreate(PETSC_COMM_WORLD, &amp;ksp);<br>
&gt;   KSPSetType(ksp, KSPGMRES);<br>
&gt;   KSPGetPC(ksp, &amp;pcmg);<br>
&gt;   PCSetType(pcmg, PCMG);<br>
&gt;<br>
&gt;   PCMGSetLevels(pcmg, 2, &amp;PETSC_COMM_WORLD);<br>
&gt;   PCMGSetType(pcmg, PC_MG_MULTIPLICATIVE);<br>
&gt;   PCMGSetCycleType(pcmg, PC_MG_CYCLE_W);<br>
&gt;   PCMGSetCyclesOnLevel(pcmg, 0, 1);<br>
&gt;   PCMGSetCyclesOnLevel(pcmg, 1, 1);<br>
&gt;<br>
&gt;   PCMGGetCoarseSolve(pcmg, &amp;ksp);<br>
&gt;<br>
&gt;   PCMGGetSmoother(pcmg, 0, &amp;ksp);<br>
&gt;   PCMGGetSmoother(pcmg, 1, &amp;ksp);<br>
&gt;   PCMGSetInterpolation(pcmg, 1, M);<br>
&gt;   PCMGSetRestriction(pcmg, 1, M);<br>
&gt;<br>
&gt;   PCMGSetResidual(pcmg, 0, PCMGDefaultResidual, M);<br>
&gt;   PCMGSetResidual(pcmg, 1, PCMGDefaultResidual, M);<br>
&gt;<br>
&gt;<br>
&gt;  The mandatory remaining PCMGSetRhs( ), PCMGSetX( ) and PCMGSetR( ) functions should be generated by Petsc automatically.<br>
&gt;<br>
&gt; It is tough to learn some Petsc functions when no detailed example 
and few guidance is provided.  I wish you can add some tutorials codes 
on PCMG usage in the future version of Petsc.<br>
&gt;<br>
&gt;<br>
&gt; Thank you very much.<br>
&gt;<br>
&gt;<br>
&gt; Zhisong Li<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
<br>
<br>
------------------------------</div>