- Thank you received: 0
Add on NGsolve: ngsxfem, levelset, NEG domain mesh boundary elements
7 years 2 weeks ago - 7 years 6 days ago #247
by Karatza
Hello,
motivated from your related manuals I would like to ask if
is there any way to add boundary condition on the formulation
I tried
and I had the error:
File "<string>", line 82, in <module>
AttributeError: 'xfem.ngsxfem_utils_py.BitArrayCF' object has no attribute 'Boundaries
Thank you
best wishes
Makis
motivated from your related manuals I would like to ask if
is there any way to add boundary condition on the formulation
Code:
a+= SymbolicBFI(lset_neg,form = u*v) ?
Code:
a += SymbolicBFI(lset_neg,form = u*v, skeleton=True, definedon=lset_neg.Boundaries())
File "<string>", line 82, in <module>
AttributeError: 'xfem.ngsxfem_utils_py.BitArrayCF' object has no attribute 'Boundaries
Thank you
best wishes
Makis
Attachments:
Last edit: 7 years 6 days ago by Karatza.
7 years 1 week ago #251
by schruste
Replied by schruste on topic Add on NGsolve: ngsxfem, levelset, NEG domain mesh boundary elements
To impose boundary conditions in a finite element formulation, you have to put the conditions either into the finite element spaces or enforce them (weakly) in a variational formulation.
In unfitted FEM (used in level set methods and the ngsxfem package) we have no degrees of freedom that are explicitly associated to the level set boundary. This is by construction of the unfitted method (the d.o.f. are defined by the background mesh and independent of the level set domains). Hence, we can not impose Dirichlet boundary conditions through the finite element space directly. What you tried in your example fails not due to implementation issues but simply due to the design paradigm of unfitted FEM.
Instead, one typically chooses to impose boundary conditions only weakly (e.g. with Lagrange multipliers or Nitsche's method), as in the fictdom_ghostpen.py example.
Best,
Christoph
In unfitted FEM (used in level set methods and the ngsxfem package) we have no degrees of freedom that are explicitly associated to the level set boundary. This is by construction of the unfitted method (the d.o.f. are defined by the background mesh and independent of the level set domains). Hence, we can not impose Dirichlet boundary conditions through the finite element space directly. What you tried in your example fails not due to implementation issues but simply due to the design paradigm of unfitted FEM.
Instead, one typically chooses to impose boundary conditions only weakly (e.g. with Lagrange multipliers or Nitsche's method), as in the fictdom_ghostpen.py example.
Best,
Christoph
The following user(s) said Thank You: Karatza
7 years 1 week ago - 7 years 1 week ago #252
by Karatza
Replied by Karatza on topic Add on NGsolve: ngsxfem, levelset, NEG domain mesh boundary elements
Dear Christoph,
deeply thank you for your response, and sorry for the basic level questions, I am new in ngsolve/ngsxfem and I am trying to understand the way it works (it is really great software).
Yes I am trying to make some tests with the provided tools for an embedded method imposing Nitsche's terms in the boundary elements of the lset_neg area (these boundary elements which are inside the NEG area) and not these in the "lset_if" area ...with quads or not. I used the GetFacetWithNeighborTypes as in the attached file with some success but I didn't manage to have exactly the elements I want.
Is there maybe any way to manage this please?
Best regards and many thanks
Makis
deeply thank you for your response, and sorry for the basic level questions, I am new in ngsolve/ngsxfem and I am trying to understand the way it works (it is really great software).
Yes I am trying to make some tests with the provided tools for an embedded method imposing Nitsche's terms in the boundary elements of the lset_neg area (these boundary elements which are inside the NEG area) and not these in the "lset_if" area ...with quads or not. I used the GetFacetWithNeighborTypes as in the attached file with some success but I didn't manage to have exactly the elements I want.
Is there maybe any way to manage this please?
Best regards and many thanks
Makis
Attachments:
Last edit: 7 years 1 week ago by Karatza.
7 years 1 week ago #254
by schruste
Replied by schruste on topic Add on NGsolve: ngsxfem, levelset, NEG domain mesh boundary elements
Dear Makis,
I am still not sure what you are trying to do. I understand that you want to select some certain elements, but don't know which ones and what the ultimate goal behind the marking of these is.
Your script files seems to do something meaningful. It marks all the facets between uncut interior elements and cut elements. The drawing is then done on the corresponding neighbors (to circumvent the difficulty of visualizing marked facets).
In case you want only the interior uncut elements of the previous selection you can use a simple intersection (test &= hasneg).
Best,
Christoph
I am still not sure what you are trying to do. I understand that you want to select some certain elements, but don't know which ones and what the ultimate goal behind the marking of these is.
Your script files seems to do something meaningful. It marks all the facets between uncut interior elements and cut elements. The drawing is then done on the corresponding neighbors (to circumvent the difficulty of visualizing marked facets).
In case you want only the interior uncut elements of the previous selection you can use a simple intersection (test &= hasneg).
Best,
Christoph
The following user(s) said Thank You: Karatza
7 years 6 days ago - 7 years 6 days ago #266
by Karatza
Replied by Karatza on topic Add on NGsolve: ngsxfem, levelset, NEG domain mesh boundary elements
Hi,
one more question please, related to the above marking (i attach again the related .py file after adding two lines), and trying to apply the SymbolicBFI onto specific elements using the commands:
even if lset_test and lset_IF both are the same <class 'dict'> type I see the error
File "<string>", line 65, in <module>
File "/install/ngsolve/2017-11-16-ef89d2d0/petsc-2017-09-30-c91a011401-3.8/lib/python3.6/site-packages/xfem/__init__.py", line 169, in SymbolicBFI *args, **kwargs)
TypeError: SymbolicCutBFI(): incompatible function arguments. The following argument types are supported:
1. (lset: ngsolve.fem.CoefficientFunction, domain_type: xfem.ngsxfem_py.DOMAIN_TYPE=DOMAIN_TYPE.NEG, force_intorder: int=-1, subdivlvl: int=0, form: ngsolve.fem.CoefficientFunction, VOL_or_BND: ngsolve.comp.VorB=VorB.VOL, element_boundary: bool=False, skeleton: bool=False, definedon: object=<ngsolve.ngstd.DummyArgument>, definedonelements: object=<ngsolve.ngstd.DummyArgument>) -> ngsolve.fem.BFI
Invoked with: kwargs: lset=<ngsolve.comp.GridFunction object at 0x7f3a48b0e7d8>, domain_type=<ngsolve.ngstd.BitArray object at 0x7f3a48b14c38>, force_intorder=-1, subdivlvl=0, form=<ngsolve.fem.CoefficientFunction object at 0x7f3a48b14e68>
do I have to use somehow the CoefficientFunction as it is mentioned in the error message? And how can I avoid the SymbolicCutBFI() mentioned in the error message (I don't want to use any cut element integration), thank you,
best regards
Makis
one more question please, related to the above marking (i attach again the related .py file after adding two lines), and trying to apply the SymbolicBFI onto specific elements using the commands:
Code:
#lset_IF = { "levelset" : lsetp1, "domain_type" : IF, "subdivlvl" : 0} #it works
#a += SymbolicBFI(lset_IF,form = u*v) #it works
lset_test = { "levelset" : lsetp1, "domain_type" : test, "subdivlvl" : 0} #It does not give any error
print("type(lset_test)=",type(lset_test),"\n") # <class 'dict'>
a += SymbolicBFI(lset_test,form = u*v)
File "<string>", line 65, in <module>
File "/install/ngsolve/2017-11-16-ef89d2d0/petsc-2017-09-30-c91a011401-3.8/lib/python3.6/site-packages/xfem/__init__.py", line 169, in SymbolicBFI *args, **kwargs)
TypeError: SymbolicCutBFI(): incompatible function arguments. The following argument types are supported:
1. (lset: ngsolve.fem.CoefficientFunction, domain_type: xfem.ngsxfem_py.DOMAIN_TYPE=DOMAIN_TYPE.NEG, force_intorder: int=-1, subdivlvl: int=0, form: ngsolve.fem.CoefficientFunction, VOL_or_BND: ngsolve.comp.VorB=VorB.VOL, element_boundary: bool=False, skeleton: bool=False, definedon: object=<ngsolve.ngstd.DummyArgument>, definedonelements: object=<ngsolve.ngstd.DummyArgument>) -> ngsolve.fem.BFI
Invoked with: kwargs: lset=<ngsolve.comp.GridFunction object at 0x7f3a48b0e7d8>, domain_type=<ngsolve.ngstd.BitArray object at 0x7f3a48b14c38>, force_intorder=-1, subdivlvl=0, form=<ngsolve.fem.CoefficientFunction object at 0x7f3a48b14e68>
do I have to use somehow the CoefficientFunction as it is mentioned in the error message? And how can I avoid the SymbolicCutBFI() mentioned in the error message (I don't want to use any cut element integration), thank you,
best regards
Makis
Attachments:
Last edit: 7 years 6 days ago by Karatza.
7 years 5 days ago #267
by jpreuss
Replied by jpreuss on topic Add on NGsolve: ngsxfem, levelset, NEG domain mesh boundary elements
Hi,
one can pass a BitArray to SymbolicBFI by means of definedonelements:
This restricts the integration to elements or facets (if skeleton=True) which are marked True.
Best regards,
Janosch
one can pass a BitArray to SymbolicBFI by means of definedonelements:
Code:
lset_test = { "levelset" : lsetp1, "domain_type" : NEG, "subdivlvl" : 0}
a += SymbolicBFI(lset_test,form = u*v,definedonelements=test)
Best regards,
Janosch
The following user(s) said Thank You: Karatza
Time to create page: 0.121 seconds