# Levelset Dirichlet Condition in 3d on phi=0 surface

**URL:** <https://community.freefem.org/t/levelset-dirichlet-condition-in-3d-on-phi-0-surface/1091>\
**Category:** General Discussion\
**Created:** [July 11, 2021, 4:34pm UTC](https://community.freefem.org/t/levelset-dirichlet-condition-in-3d-on-phi-0-surface/1091 "2021-07-11T16:34:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonas\_Zille](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@Jonas\_Zille](https://community.freefem.org/u/Jonas_Zille)\
**Post date:** [July 11, 2021, 4:34pm UTC](https://community.freefem.org/t/levelset-dirichlet-condition-in-3d-on-phi-0-surface/1091/1 "2021-07-11T16:34:47Z")

</div>

Dear All,  
I hope you can help me with the following problem.

I have a mesh (3d) where there is a rather sharp levelset function “phi” defined by scalar values (threshold).  
I have found the method int2d(Th,levelset=phi) … respectively the 3d variant (integrating over the volume where phi == -1)

Is there a way to impose a Dirichlet boundary condition on the levelset=0 function in 3d (on the 2d iso surface where phi=0 ?)?

The usual work around with a varf and accessing the Stiffnesmatrix and Lastvector A(ii,ii)=tgv and b(ii)=tgv\*bcvalue does not work because I can’t find the zero boundary since on none of the nodes it is exactly zero.

Can someone give me a hint on how to solve this?

Best regards,  
Jonas
