# Extract Iso Surface in 3D

**URL:** <https://community.freefem.org/t/extract-iso-surface-in-3d/36>\
**Category:** General Discussion\
**Created:** [April 29, 2019, 11:23am UTC](https://community.freefem.org/t/extract-iso-surface-in-3d/36 "2019-04-29T11:23:38Z")\
**Posts on this page:** 6\
**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:** [April 29, 2019, 11:23am UTC](https://community.freefem.org/t/extract-iso-surface-in-3d/36/1 "2019-04-29T11:23:38Z")

</div>

Hi everyone,  
I recently installed FreeFem because I am interested in the 3d mesh adaption routines (very satisified with that so far).

My problem right now is, that I want to solve a 3 dimensional PDE (with a scalar solution “u”) but I want to have boundary condition on the 2d surface where u=u\_fix (just for the next time step).

Is there a smart (efficient) way to extract the iso mesh computational efficient and include a “int2d” boundary condition (du/dn=f(x,y,z))

(I have some Fortran code of my “old” naive solution without adaptive mesh algorithms, but I am not “willing” to port my bad code to FF++).  
I know the 2d isoline function (but to my knowledge nothing like this exists for 3d).

Every bit of help is appreciated!

Thanks,  
Jonas

---

<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:** [April 29, 2019, 11:49am UTC](https://community.freefem.org/t/extract-iso-surface-in-3d/36/2 "2019-04-29T11:49:20Z")

</div>

The solution “I came up with” utilizes “trunc” - but I only obtain a 3d mesh from that if i use “\>” operator.  
For “==” i get no results (because its unlikely to exaclity hit u==ufix on the any node).

---

<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:** [May 6, 2019, 12:05pm UTC](https://community.freefem.org/t/extract-iso-surface-in-3d/36/3 "2019-05-06T12:05:10Z")

</div>

Hi, i am still looking for a solution of the previous problem.

Furthermore, I want to solve a 2d equation on one surface of a 3d mesh, then transform the 3d mesh accordingly to the 2d solution.  
Is there any smart way to do that? (I want to utilize movemesh, but right now i am not able to adress the 2d submesh)

Thank you

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [August 27, 2019, 6:37am UTC](https://community.freefem.org/t/extract-iso-surface-in-3d/36/4 "2019-08-27T06:37:09Z")

</div>

Sorry to day, you can not extract Iso surface in 3d.  
In mmg3 I think they tool to do this but I am not sure.

---

<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:** [September 23, 2019, 4:00pm UTC](https://community.freefem.org/t/extract-iso-surface-in-3d/36/5 "2019-09-23T16:00:18Z")

</div>

A good idea…  
I created a level set metric with mshmet, but for mmg3d i need to call the “-ls” (for level set: on) option.  
But I cannot pass the argument.

Am I correct or missing something? (mmg3d does not adapt the mesh how I expect it - it rather does nothing)  
Thank you for your help so far!

Best regards,  
Jonas

---

<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:** [June 10, 2020, 9:46am UTC](https://community.freefem.org/t/extract-iso-surface-in-3d/36/6 "2020-06-10T09:46:36Z")

</div>

mesh3 ThSol = trunc( Th3, T\>=Tsol\*0.7);  
fespace Uh(ThSol,P1);  
Uh Tiso;  
Tiso=T-Tsol;  
ThSol = mmg3d(ThSol,metric=Tiso[],iso=1,ls=0,hausd=0.003,hgrad=2.3,verbose=10);  
plot(ThSol,cmm=“ThSol mmg3d bdmeshed”,wait=1);  
ThSol = buildBdMesh(ThSol);  
meshS ThSSol = ThSol.Gamma;  
ThSSol = trunc(ThSSol,region==10);  
ThSSol = mmgs(ThSSol,hausd=0.003,hgrad=2.3);

Thanks, with the new version it works!!

Best regards,  
Jonas
