- Thank you received: 0
Algebraic Multigrid for Compressed VectorH1 space
I met a problem when I was trying to assemble algebraic multigrid preconditioner from a compressed VectorH1 space. Here is the script to show my problem,.
" fes = Compress(Vhbase, GetDofsOfElements(Vhbase, ci.GetElementsOfType(HASNEG)))"
And if I use VhBase as FEM space for BilinearForm a and assemble the corresponding algebraic multigrid, everything works. I am wondering if I need to add something extra to make algebraic multigrid work for this compressed VectorH1 space?
Thanks you!
Qi
Even with `fes = Vhbase` it's not working. The problem is that there are elements where the element matrix is zero and while trying to find proper weights for the H1amg local element matrix inversions fail (the standard use case for h1amg does not assume to work with empty contributions here). What you have to do is to make sure that you don't compute element matrices for the bilinear form a (and hence for the preconditioner) in the first place on in-active elements. To do so replace your integrator line with
a += SymbolicBFI(lset_doms[0], form= u * v, definedonelements=ci.GetElementsOfType(HASNEG))
Then only on active elements element matrices are computed for the matrix a and the h1amg preconditioner.
Best,
Christoph
Sorry, One thing I just want to make sure.
Suppose I have a two-phase problem, Can I use Algebraic Multigrid for the matrix from space WhGV?Vhbase = VectorH1(mesh, order=order, dirichlet="bottom|right|back", flags={"dgjumps": True})
Vhneg = Compress(Vhbase, GetDofsOfElements(Vhbase, ci.GetElementsOfType(HASNEG)))
Vhpos = Compress(Vhbase, GetDofsOfElements(Vhbase, ci.GetElementsOfType(HASPOS)))
WhGV = FESpace([Vhneg, Vhpos], flags={"dgjumps": True})
Or I need to build a block preconditioner for the matrix?
Again, thank you very much.
Algorithmically it should work. If it is performing well also depends on the diffusivity contrast, cut position (you are not using stabilization of any kind, right?). An example where it is doing well using h1amg is given in the py_tutorials/mpi directory.
Best,
Christoph
Thank you very much for your help, I was asking because when I tried to use Algebraic multigrid for the space WhGV, again I am having segmentation fault.
Is this somehow the same problem with the previous one?H1AMG: level = 0, num_edges = 102939, nv = 1692
[Qis-MacBook-Pro:34374] *** Process received signal ***
[Qis-MacBook-Pro:34374] Signal: Segmentation fault: 11 (11)
[Qis-MacBook-Pro:34374] Signal code: (0)
[Qis-MacBook-Pro:34374] Failing at address: 0x0
[Qis-MacBook-Pro:34374] [ 0] 0 libsystem_platform.dylib 0x00007fff6ecf05fd _sigtramp + 29
[Qis-MacBook-Pro:34374] [ 1] 0 libsystem_c.dylib 0x00007fff95242d80 __c_locale + 0
[Qis-MacBook-Pro:34374] [ 2] 0 libngcomp.dylib 0x000000010784016a _ZNSt3__110__function6__funcIZN6ngcore11ParallelForImZN6ngcomp12H1AMG_MatrixINS_7complexIdEEEC1ENS_10shared_ptrIN4ngla14SparseMatrixTMIS7_EEEENS9_INS2_8BitArrayEEENS2_9FlatArrayINS2_3INTILi2EiEEmEENSG_IdmEESK_mEUliE1_EEvNS2_7T_RangeIT_EET0_iNS2_10TotalCostsEEUlRNS2_8TaskInfoEE_NS_9allocatorIST_EEFvSS_EEclESS_ + 90
[Qis-MacBook-Pro:34374] [ 3] 0 libngcore.dylib 0x00000001020cd726 _ZN6ngcore11TaskManager9CreateJobERKNSt3__18functionIFvRNS_8TaskInfoEEEEi + 198
[Qis-MacBook-Pro:34374] [ 4] 0 libngcomp.dylib 0x000000010782ed14 _ZN6ngcomp12H1AMG_MatrixIdEC1ENSt3__110shared_ptrIN4ngla14SparseMatrixTMIdEEEENS3_IN6ngcore8BitArrayEEENS8_9FlatArrayINS8_3INTILi2EiEEmEENSB_IdmEESF_m + 4564
[Qis-MacBook-Pro:34374] [ 5] 0 libngcomp.dylib 0x0000000107839c8c _ZNSt3__110shared_ptrIN6ngcomp12H1AMG_MatrixIdEEE11make_sharedIJRNS0_IN4ngla14SparseMatrixTMIdEEEERNS0_IN6ngcore8BitArrayEEERNSB_5ArrayINSB_3INTILi2EiEEmEERNSF_IdmEESL_iEEES4_DpOT_ + 236
[Qis-MacBook-Pro:34374] [ 6] 0 libngcomp.dylib 0x0000000107838540 _ZN6ngcomp20H1AMG_PreconditionerIdE13FinalizeLevelEPKN4ngla10BaseMatrixE + 1120
[Qis-MacBook-Pro:34374] [ 7] 0 libngcomp.dylib 0x0000000107403de4 _ZN6ngcomp14S_BilinearFormIdE10DoAssembleERN6ngcore9LocalHeapE + 12180
[Qis-MacBook-Pro:34374] [ 8] 0 libngcomp.dylib 0x0000000107420044 _ZN6ngcomp12BilinearForm8AssembleERN6ngcore9LocalHeapE + 692
[Qis-MacBook-Pro:34374] [ 9] 0 libngcomp.dylib 0x0000000107b7a504 _ZZN8pybind1112cpp_function10initializeIZ12ExportNgcompRNS_6moduleEE5$_142NSt3__110shared_ptrIN6ngcomp12BilinearFormEEEJS9_bEJNS_4nameENS_9is_methodENS_7siblingENS_10call_guardIJNS_18gil_scoped_releaseEEEENS_5arg_vEPKcEEEvOT_PFT0_DpT1_EDpRKT2_ENUlRNS_6detail13function_callEE_8__invokeESW_ + 148
[Qis-MacBook-Pro:34374] [10] 0 libngcomp.dylib 0x00000001077724b9 _ZN8pybind1112cpp_function10dispatcherEP7_objectS2_S2_ + 4041
[Qis-MacBook-Pro:34374] [11] 0 python 0x0000000100ea31b8 _PyMethodDef_RawFastCallKeywords + 392
[Qis-MacBook-Pro:34374] [12] 0 python 0x0000000100ea2c80 _PyObject_FastCallKeywords + 592
[Qis-MacBook-Pro:34374] [13] 0 python 0x0000000100fdfed5 call_function + 453
[Qis-MacBook-Pro:34374] [14] 0 python 0x0000000100fddaec _PyEval_EvalFrameDefault + 46092
[Qis-MacBook-Pro:34374] [15] 0 python 0x0000000100fd149e _PyEval_EvalCodeWithName + 414
[Qis-MacBook-Pro:34374] [16] 0 python 0x00000001010349a0 PyRun_FileExFlags + 256
[Qis-MacBook-Pro:34374] [17] 0 python 0x0000000101033e17 PyRun_SimpleFileExFlags + 391
[Qis-MacBook-Pro:34374] [18] 0 python 0x0000000101061d3f pymain_main + 9663
[Qis-MacBook-Pro:34374] [19] 0 python 0x0000000100e7566d main + 125
[Qis-MacBook-Pro:34374] [20] 0 libdyld.dylib 0x00007fff6eaf7cc9 start + 1
[Qis-MacBook-Pro:34374] *** End of error message ***
Best,
Qi
Ok, my last reply was a bit premature. In the demo-file that I refered to we use a XFEM representation which harmonizes better with the h1amg in this case. The problem with the version that you tried is that on some elements there are some active dofs which however have no contribution to some local element matrices (e.g. on an element neighboring to cut element). This is in contrast to the XFEM formulation where dofs only occur on elements where they also have a contribution. This is not a flaw by the CutFEM formulation but rather of the implementation via the Compress-space. I see three possible solutions:
1. switch to an XFEM formulation
2. add a very small regularization which is independent of the cut configuration, e.g.
Best,
Christoph