Hello guys,
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,.
from netgen.geom2d import SplineGeometry
from netgen.meshing import MeshingParameters
from xfem import *
from netgen.csg import CSGeometry, OrthoBrick, Pnt
import netgen.gui
from netgen.geom2d import unit_square
from ngsolve import *
from ngsolve.la import EigenValues_Preconditioner
from xfem.lsetcurv import *
def Setup():
cube = CSGeometry()
cube.Add(OrthoBrick(Pnt(-1.5, -1.5, -1.5), Pnt(1.5, 1.5, 1.5)))
mesh = Mesh(cube.GenerateMesh(maxh=1, quad_dominated=False))
lsetmeshadap = LevelSetMeshAdaptation(mesh, order=3, threshold=1000, discontinuous_qn=True)
phi = Norm(CoefficientFunction((x, y, z))) - 1
deformation = lsetmeshadap.CalcDeformation(phi)
lsetp1 = lsetmeshadap.lset_p1
mesh.SetDeformation(deformation)
ci = CutInfo(mesh, lsetp1)
Vhbase = VectorH1(mesh, order=2, flags={"dgjumps": True})
fes = Compress(Vhbase, GetDofsOfElements(Vhbase, ci.GetElementsOfType(HASNEG)))
lset_neg = {"levelset": lsetp1, "domain_type": NEG}
lset_pos = {"levelset": lsetp1, "domain_type": POS}
lset_doms = [lset_neg, lset_pos]
u, v = fes.TnT()
a = BilinearForm(fes)
a += SymbolicBFI(lset_doms[0], form= u * v)
return mesh, fes, a
mesh, fes, a = Setup()
mg = Preconditioner(a, "h1amg") # register mg to a
a.Assemble()
a.inner_matrix
print('NDOF = ', fes.ndof)
When I run this part of code I immediately got the following segmentation fault,
[code]importing ngs-xfem1.3-2008
optfile ./ng.opt does not exist - using default values
togl-version : 2
OCC module loaded
loading ngsolve library
NGSolve-6.2.2008
Using Lapack
Including sparse direct solver Pardiso
Running parallel using 8 thread(s)
Start Findpoints
Analyze spec points
Find edges
Start Findpoints
Analyze spec points
Find edges
Start Findpoints
Analyze spec points
Find edges
Surface 1 / 6
Optimize Surface
Surface 2 / 6
Optimize Surface
Surface 3 / 6
Optimize Surface
Surface 4 / 6
Optimize Surface
Surface 5 / 6
Optimize Surface
Surface 6 / 6
Optimize Surface
Meshing subdomain 1 of 1
Delaunay meshing
start tetmeshing
Success !
72 points, 211 elements
Remove Illegal Elements
Volume Optimization
SearchCorrespondingPoint:: did not converge
WARNING: using flags as kwarg is deprecated in <class ‘ngsolve.comp.VectorH1’>, use the flag arguments as kwargs instead!
[Qis-MacBook-Pro:10639] *** Process received signal ***
[Qis-MacBook-Pro:10639] Signal: Segmentation fault: 11 (11)
[Qis-MacBook-Pro:10639] Signal code: Address not mapped (1)
[Qis-MacBook-Pro:10639] Failing at address: 0x7fbcee1e99cc
[Qis-MacBook-Pro:10639] [ 0] 0 libsystem_platform.dylib 0x00007fff6ecf05fd _sigtramp + 29
[Qis-MacBook-Pro:10639] [ 1] 0 ??? 0x0000000a0000000c 0x0 + 42949672972
[Qis-MacBook-Pro:10639] [ 2] 0 libngcore.dylib 0x00000001102f5726 _ZN6ngcore11TaskManager9CreateJobERKNSt3__18functionIFvRNS_8TaskInfoEEEEi + 198
[Qis-MacBook-Pro:10639] [ 3] 0 libngcomp.dylib 0x0000000115b5b1d1 _ZN6ngcomp12H1AMG_MatrixIdEC1ENSt3__110shared_ptrIN4ngla14SparseMatrixTMIdEEEENS3_IN6ngcore8BitArrayEEENS8_9FlatArrayINS8_3INTILi2EiEEmEENSB_IdmEESF_m + 1681
[Qis-MacBook-Pro:10639] [ 4] 0 libngcomp.dylib 0x0000000115b66c8c ZNSt3__110shared_ptrIN6ngcomp12H1AMG_MatrixIdEEE11make_sharedIJRNS0_IN4ngla14SparseMatrixTMIdEEEERNS0_IN6ngcore8BitArrayEEERNSB_5ArrayINSB_3INTILi2EiEEmEERNSF_IdmEESL_iEEES4_DpOT + 236
[Qis-MacBook-Pro:10639] [ 5] 0 libngcomp.dylib 0x0000000115b65540 _ZN6ngcomp20H1AMG_PreconditionerIdE13FinalizeLevelEPKN4ngla10BaseMatrixE + 1120
[Qis-MacBook-Pro:10639] [ 6] 0 libngcomp.dylib 0x0000000115730de4 _ZN6ngcomp14S_BilinearFormIdE10DoAssembleERN6ngcore9LocalHeapE + 12180
[Qis-MacBook-Pro:10639] [ 7] 0 libngcomp.dylib 0x000000011574d044 _ZN6ngcomp12BilinearForm8AssembleERN6ngcore9LocalHeapE + 692
[Qis-MacBook-Pro:10639] [ 8] 0 libngcomp.dylib 0x0000000115ea7504 _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:10639] [ 9] 0 libngcomp.dylib 0x0000000115a9f4b9 ZN8pybind1112cpp_function10dispatcherEP7_objectS2_S2 + 4041
[Qis-MacBook-Pro:10639] [10] 0 python 0x000000010f0cb1b8 _PyMethodDef_RawFastCallKeywords + 392
[Qis-MacBook-Pro:10639] [11] 0 python 0x000000010f0cac80 _PyObject_FastCallKeywords + 592
[Qis-MacBook-Pro:10639] [12] 0 python 0x000000010f207ed5 call_function + 453
[Qis-MacBook-Pro:10639] [13] 0 python 0x000000010f205aec _PyEval_EvalFrameDefault + 46092
[Qis-MacBook-Pro:10639] [14] 0 python 0x000000010f1f949e _PyEval_EvalCodeWithName + 414
[Qis-MacBook-Pro:10639] [15] 0 python 0x000000010f25c9a0 PyRun_FileExFlags + 256
[Qis-MacBook-Pro:10639] [16] 0 python 0x000000010f25be17 PyRun_SimpleFileExFlags + 391
[Qis-MacBook-Pro:10639] [17] 0 python 0x000000010f289d3f pymain_main + 9663
[Qis-MacBook-Pro:10639] [18] 0 python 0x000000010f09d66d main + 125
[Qis-MacBook-Pro:10639] [19] 0 libdyld.dylib 0x00007fff6eaf7cc9 start + 1
[Qis-MacBook-Pro:10639] *** End of error message ***
H1AMG: level = 0, num_edges = 19827, nv = 615[/code]
I found when I removed the
" 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