# Zero solution by solving the Laplace problem on part of the mes

**URL:** <https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018>\
**Category:** General Discussion\
**Created:** [March 7, 2024, 12:30am UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018 "2024-03-07T00:30:33Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anis](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@Anis](https://community.freefem.org/u/Anis)\
**Post date:** [March 7, 2024, 12:30am UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/1 "2024-03-07T00:30:33Z")

</div>

Hello everyone,  
I wanted to solve the Laplace problem on part of the mesh domain. After defining the region that interests me, the problem does not resolve.  
\<\<catch an erreur in solve =\> set sol = 0 !!! \>\>

load “msh3”  
load “medit”  
load “UMFPACK64”

int gam0 = 95;  
int gamin = 96;  
int gamout = 97;  
int Sminus = 98;  
int Splus = 99 ;

real [int] A(2), B(2), C(2), D(2), E(2), a(2), b(2), c(2), d(2);  
real [int] F(2), G(2), H(2), I(2), J(2);  
real [int] K(2), L(2), M(2), Ng(2), AA(2) , BB(2), CC(2), DD(2);  
A = [6,1.5]; B = [6, 2.5]; C = [12, 1.5]; D = [21,0];  
F = [15, 2]; I = [12, 2.5]; J = [21, 4]; M = [21, 1]; Ng = [21, 3];  
AA = [6,-1]; BB=[6,5]; CC=[21,-1]; DD=[21,5];  
a=[8,1.8]; b=[10,1.8]; c=[10,2.2]; d=[8,2.2];

border c1(t=0,1){x=(1-t)_A[0]+t_C[0]; y=(1-t)_A[1]+t_C[1];label=gam0;}  
border c3(t=0,1){x=(1-t)_C[0]+t_D[0]; y=(1-t)_C[1]+t_D[1];label=gam0;}

border c8(t=0,1){x=(1-t)_D[0]+t_M[0]; y=(1-t)_D[1]+t_M[1];label=gamout;}

border c9(t=0,1){x=(1-t)_M[0]+t_F[0]; y=(1-t)_M[1]+t_F[1];label=gam0;}  
border c10(t=0,1){x=(1-t)_F[0]+t_Ng[0]; y=(1-t)_F[1]+t_Ng[1];label=gam0;}

border c11(t=0,1){x=(1-t)_Ng[0]+t_J[0]; y=(1-t)_Ng[1]+t_J[1];label=gamout;}

border c12(t=0,1){x=(1-t)_J[0]+t_I[0]; y=(1-t)_J[1]+t_I[1];label=gam0;}  
border c13(t=0,1){x=(1-t)_I[0]+t_B[0]; y=(1-t)_I[1]+t_B[1];label=gam0;}

border c14(t=0,1){x=(1-t)_B[0]+t_A[0]; y=(1-t)_B[1]+t_A[1];label=gamin;}

border c001(t=0,1){x=(1-t)_a[0]+t_d[0]; y=(1-t)_a[1]+t_d[1];gam0;}  
border c002(t=0,1){x=(1-t)_d[0]+t_c[0]; y=(1-t)_d[1]+t_c[1];gam0;}  
border c003(t=0,1){x=(1-t)_c[0]+t_b[0]; y=(1-t)_c[1]+t_b[1];gam0;}  
border c004(t=0,1){x=(1-t)_b[0]+t_a[0]; y=(1-t)_b[1]+t_a[1];gam0;}

border c01(t=0,1){x=(1-t)_AA[0]+t_CC[0]; y=(1-t)_AA[1]+t_CC[1];Splus;}  
border c01b(t=0,1){x=(1-t)_CC[0]+t_D[0]; y=(1-t)_CC[1]+t_D[1];Splus;}  
border c02(t=0,1){x=(1-t)_M[0]+t_Ng[0]; y=(1-t)_M[1]+t_Ng[1];Splus;}  
border c02b(t=0,1){x=(1-t)_J[0]+t_DD[0]; y=(1-t)_J[1]+t_DD[1];Splus;}  
border c03(t=0,1){x=(1-t)_DD[0]+t_BB[0]; y=(1-t)_DD[1]+t_BB[1];Sminus;}  
border c04(t=0,1){x=(1-t)_BB[0]+t_B[0]; y=(1-t)_BB[1]+t_B[1]; Splus;}  
border c05(t=0,1){x=(1-t)_A[0]+t_AA[0]; y=(1-t)_A[1]+t_AA[1];Splus;}

plot(c001(1) +c01b(1)+c002(1)+c02b(1)+c003(1)+c004(1) +c1(1)+c3(1)+c8(1)+c9(9)+c10(1)+c11(1)  
+ c12(1)+c13(1)+c14(1)+c01(1)+c02(1)+c03(1)+c04(1)+c05(1)) ;

mesh Th = buildmesh(c1(50)+c3(60)+ c8(10) +c9(50)+ c10(50)+c11(10)+c12(60)+c13(50)+c14(10)  
+ c01(110)+c01b(10)+c02(15)+c02b(10)+c03(110)+c04(20)+c05(20)  
+ c001(-7)+c002(-30)+c003(-7)+c004(-30)) ;

plot(Th, wait=true) ;

fespace Vh(Th, P2) ;

int road = Th(12., 2.).region ;  
int air1 = Th(9., 2.).region ;  
int air2 = Th(9., 1.).region ;  
int air3 = Th(9., 4.).region ;  
int air4 = Th(19., 2.).region ;

cout \<\< "--------- Label number for road region = " \<\< road \<\< endl;  
cout \<\< "--------- Label number for air1 region = " \<\< air1 \<\< endl;  
cout \<\< "--------- Label number for air2 region = " \<\< air2 \<\< endl;  
cout \<\< "--------- Label number for air3 region = " \<\< air3 \<\< endl;  
cout \<\< "--------- Label number for air4 region = " \<\< air4 \<\< endl;

real U0 = 10. ;  
real U00 = 0. ;

Vh U = U0\*(region==road ? 1 : 0) + U00\*(region==air1 ? 1 : 0) + U00\*(region==air2 ? 1 : 0) + U00\*(region==air3 ? 1 : 0) + U00\*(region==air4 ? 1 : 0) ;

plot(U, fill=true, value = true);

Vh vv, vvh ;

problem Laplace(vv, vvh, solver=UMFPACK) = int2d(Th)(U\*(dx(vv)\*dx(vvh) + dy(vv)\*dy(vvh)))  
+ int1d(Th, gamin)(vvh)  
+ on(gamout, vv=0)  
;

Laplace ;  
plot(vv, nbiso=50, fill=1, value=1);

Could you help me please?  
Thanks

---

<div class="post-metadata">

**Author:** ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)\
**Post date:** [March 7, 2024, 9:45am UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/2 "2024-03-07T09:45:25Z")

</div>

Are you sure that your problem is well-posed? Probably your matrix is not invertible because the factor U vanishes on some part of the domain (U00=0).  
If you want to solve the Laplace problem on the road region you need to define a mesh corresponding to this region and set the unknown vv to have degrees of freedom only in this road region.

---

<div class="post-metadata">

**Author:** ![Anis](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@Anis](https://community.freefem.org/u/Anis)\
**Post date:** [March 7, 2024, 10:05am UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/3 "2024-03-07T10:05:40Z")

</div>

Hello everyone,  
I wanted to solve the Laplace problem on part of the mesh domain. After defining the region that interests me, the problem does not resolve.  
\<\<catch an erreur in solve =\> set sol = 0 !!! \>\>

load “msh3”  
load “medit”  
load “UMFPACK64”

int gam0 = 95;  
int gamin = 96;  
int gamout = 97;  
int Sminus = 98;  
int Splus = 99 ;

real [int] A(2), B(2), C(2), D(2), E(2), a(2), b(2), c(2), d(2);  
real [int] F(2), G(2), H(2), I(2), J(2);  
real [int] K(2), L(2), M(2), Ng(2), AA(2) , BB(2), CC(2), DD(2);  
A = [6,1.5]; B = [6, 2.5]; C = [12, 1.5]; D = [21,0];  
F = [15, 2]; I = [12, 2.5]; J = [21, 4]; M = [21, 1]; Ng = [21, 3];  
AA = [6,-1]; BB=[6,5]; CC=[21,-1]; DD=[21,5];  
a=[8,1.8]; b=[10,1.8]; c=[10,2.2]; d=[8,2.2];

border c1(t=0,1){x=(1-t)_A[0]+t_C[0]; y=(1-t)_A[1]+t_C[1];label=gam0;}  
border c3(t=0,1){x=(1-t)_C[0]+t_D[0]; y=(1-t)_C[1]+t_D[1];label=gam0;}

border c8(t=0,1){x=(1-t)_D[0]+t_M[0]; y=(1-t)_D[1]+t_M[1];label=gamout;}

border c9(t=0,1){x=(1-t)_M[0]+t_F[0]; y=(1-t)_M[1]+t_F[1];label=gam0;}  
border c10(t=0,1){x=(1-t)_F[0]+t_Ng[0]; y=(1-t)_F[1]+t_Ng[1];label=gam0;}

border c11(t=0,1){x=(1-t)_Ng[0]+t_J[0]; y=(1-t)_Ng[1]+t_J[1];label=gamout;}

border c12(t=0,1){x=(1-t)_J[0]+t_I[0]; y=(1-t)_J[1]+t_I[1];label=gam0;}  
border c13(t=0,1){x=(1-t)_I[0]+t_B[0]; y=(1-t)_I[1]+t_B[1];label=gam0;}

border c14(t=0,1){x=(1-t)_B[0]+t_A[0]; y=(1-t)_B[1]+t_A[1];label=gamin;}

border c001(t=0,1){x=(1-t)_a[0]+t_d[0]; y=(1-t)_a[1]+t_d[1];gam0;}  
border c002(t=0,1){x=(1-t)_d[0]+t_c[0]; y=(1-t)_d[1]+t_c[1];gam0;}  
border c003(t=0,1){x=(1-t)_c[0]+t_b[0]; y=(1-t)_c[1]+t_b[1];gam0;}  
border c004(t=0,1){x=(1-t)_b[0]+t_a[0]; y=(1-t)_b[1]+t_a[1];gam0;}

border c01(t=0,1){x=(1-t)_AA[0]+t_CC[0]; y=(1-t)_AA[1]+t_CC[1];Splus;}  
border c01b(t=0,1){x=(1-t)_CC[0]+t_D[0]; y=(1-t)_CC[1]+t_D[1];Splus;}  
border c02(t=0,1){x=(1-t)_M[0]+t_Ng[0]; y=(1-t)_M[1]+t_Ng[1];Splus;}  
border c02b(t=0,1){x=(1-t)_J[0]+t_DD[0]; y=(1-t)_J[1]+t_DD[1];Splus;}  
border c03(t=0,1){x=(1-t)_DD[0]+t_BB[0]; y=(1-t)_DD[1]+t_BB[1];Sminus;}  
border c04(t=0,1){x=(1-t)_BB[0]+t_B[0]; y=(1-t)_BB[1]+t_B[1]; Splus;}  
border c05(t=0,1){x=(1-t)_A[0]+t_AA[0]; y=(1-t)_A[1]+t_AA[1];Splus;}

plot(c001(1) +c01b(1)+c002(1)+c02b(1)+c003(1)+c004(1) +c1(1)+c3(1)+c8(1)+c9(9)+c10(1)+c11(1)

- c12(1)+c13(1)+c14(1)+c01(1)+c02(1)+c03(1)+c04(1)+c05(1)) ;

mesh Th = buildmesh(c1(50)+c3(60)+ c8(10) +c9(50)+ c10(50)+c11(10)+c12(60)+c13(50)+c14(10)

- c01(110)+c01b(10)+c02(15)+c02b(10)+c03(110)+c04(20)+c05(20)
- c001(-7)+c002(-30)+c003(-7)+c004(-30)) ;

plot(Th, wait=true) ;

fespace Vh(Th, P2) ;

int road = Th(12., 2.).region ;  
int air1 = Th(9., 2.).region ;  
int air2 = Th(9., 1.).region ;  
int air3 = Th(9., 4.).region ;  
int air4 = Th(19., 2.).region ;

cout \<\< "--------- Label number for road region = " \<\< road \<\< endl;  
cout \<\< "--------- Label number for air1 region = " \<\< air1 \<\< endl;  
cout \<\< "--------- Label number for air2 region = " \<\< air2 \<\< endl;  
cout \<\< "--------- Label number for air3 region = " \<\< air3 \<\< endl;  
cout \<\< "--------- Label number for air4 region = " \<\< air4 \<\< endl;

real U0 = 10. ;  
real U00 = 0. ;

Vh U = U0\*(region==road ? 1 : 0) + U00\*(region==air1 ? 1 : 0) + U00\*(region==air2 ? 1 : 0) + U00\*(region==air3 ? 1 : 0) + U00\*(region==air4 ? 1 : 0) ;

plot(U, fill=true, value = true);

Vh vv, vvh ;

problem Laplace(vv, vvh, solver=UMFPACK) = int2d(Th)(U\*(dx(vv)\*dx(vvh) + dy(vv)\*dy(vvh)))

- int1d(Th, gamin)(vvh)
- on(gamout, vv=0)  
;

Laplace ;  
plot(vv, nbiso=50, fill=1, value=1);

Could you help me please?  
Thanks

---

<div class="post-metadata">

**Author:** ![marchywka](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@marchywka](https://community.freefem.org/u/marchywka)\
**Post date:** [March 7, 2024, 11:05am UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/4 "2024-03-07T11:05:25Z")

</div>

You could probably use the CG solver to get an answer or, IIRC I’ve played with this, use an “indcator”  
fespace to enforce the laplace or identity ( u=1) in the various regions to make  
it invertible.

---

<div class="post-metadata">

**Author:** ![Anis](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@Anis](https://community.freefem.org/u/Anis)\
**Post date:** [March 7, 2024, 11:19am UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/5 "2024-03-07T11:19:56Z")

</div>

The problem is well posed and can be easily solved (only) on the road region. However, my goal is to immerse this road region in a larger region to subsequently model the pollution. So I thought of defining two domains (road + air). On the first one, I wanted to start by solving the Laplace problem and then the problem of pollution on the whole domain (air + road).

---

<div class="post-metadata">

**Author:** ![marchywka](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@marchywka](https://community.freefem.org/u/marchywka)\
**Post date:** [March 7, 2024, 11:24am UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/6 "2024-03-07T11:24:53Z")

</div>

can you upload the thing? my copy/paste messes it up.  
thanks.

---

<div class="post-metadata">

**Author:** ![Anis](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@Anis](https://community.freefem.org/u/Anis)\
**Post date:** [March 7, 2024, 11:55am UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/7 "2024-03-07T11:55:29Z")

</div>

[Transport-mod-bis (5).edp](https://community.freefem.org/uploads/short-url/9ffLIK0DHib5vLEJi0CMFfZN3LY.edp) (3.5 KB)  
Here is the code to download.  
Using CG solver did not solve the problem.

---

<div class="post-metadata">

**Author:** ![marchywka](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@marchywka](https://community.freefem.org/u/marchywka)\
**Post date:** [March 7, 2024, 12:42pm UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/8 "2024-03-07T12:42:38Z")

</div>

Is this what you wanted?

[Transport-mod.edp](https://community.freefem.org/uploads/short-url/5Dv8etYl2ypxpCw7k0Ikxj7okQT.edp) (3.6 KB)

## diff Transpo\* 80,84c80,81 \< // problem Laplace(vv, vvh, solver=CG) = int2d(Th)(U\*(dx(vv)_dx(vvh) + dy(vv)dy(vvh))) \< problem Laplace(vv, vvh) = int2d(Th)(U(dx(vv)dx(vvh) + dy(vv)dy(vvh))) \< +int2d(Th)((1-U)((vv)(vvh) + (vv)_(vvh))) \< \< + int1d(Th, gamin)(vvh)

> problem Laplace(vv, vvh, solver=CG) = int2d(Th)(U\*(dx(vv)\*dx(vvh) + dy(vv)\*dy(vvh)))  
> + int1d(Th, gamin)(vvh)

---

<div class="post-metadata">

**Author:** ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)\
**Post date:** [March 7, 2024, 1:19pm UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/9 "2024-03-07T13:19:58Z")

</div>

Anis,  
The answer depends on the boundary conditions you want. If you solve a Laplace problem for vv on the “road” region, you have to say what are the associated conditions you want on the boundary of the “road” domain.  
Is it “vanishing normal derivative” everywhere, except on “gamout” where you set vv=0?  
I am not sure that the proposition of Mike does that.  
Or maybe “realistic” boundary conditions are more involved and depend on what happens on the “air” region?  
Francois.

---

<div class="post-metadata">

**Author:** ![Anis](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@Anis](https://community.freefem.org/u/Anis)\
**Post date:** [March 7, 2024, 1:20pm UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/10 "2024-03-07T13:20:01Z")

</div>

Not exactly.  
I should have a solution that resembles the result of this code if I run the calculation on the road region only.  
[Transport-mod-bis.edp](https://community.freefem.org/uploads/short-url/mwnByjH4ygrLv4JbxP6bKpepJJ4.edp) (2.0 KB)

---

<div class="post-metadata">

**Author:** ![marchywka](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@marchywka](https://community.freefem.org/u/marchywka)\
**Post date:** [March 7, 2024, 2:26pm UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/11 "2024-03-07T14:26:57Z")

</div>

yes, you need to fix the boundary conditions to get an exact match.  
See “natural boundary conditions” to get them for the road-only example.  
I took some of this and your mesh and ended up with this code  
[Transport-mod.edp](https://community.freefem.org/uploads/short-url/5YSdVTwYWja95nOTkAveIze98b7.edp) (3.9 KB)

[https://community.freefem.org/t/normal-boundary-condition/341](https://community.freefem.org/t/normal-boundary-condition/341)

---

<div class="post-metadata">

**Author:** ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)\
**Post date:** [March 7, 2024, 3:09pm UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/12 "2024-03-07T15:09:19Z")

</div>

Since you have the right solution `vv` from your code on the road region only, what is your problem?  
If you like you can extend this solution outside the road region by solving another Laplace problem for `vvext`, set in the air region only, with nonhomogeneous Dirichlet boundary condition `vvext=vv` at the interface between the two regions (and for example Neumann condition on the external boundary).

---

<div class="post-metadata">

**Author:** ![Anis](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@Anis](https://community.freefem.org/u/Anis)\
**Post date:** [March 7, 2024, 4:40pm UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/13 "2024-03-07T16:40:13Z")

</div>

If I define and discretize only the road region, the Laplace problem can be solved on this region (no worries). However, if I define and discretize the entire domain (air + road) I can’t figure out how to calculate the solution of the problem only on the road region despite that I have defined the two regions correctly: Vh U = U0\*(region==road? 1 : 0) + U00\*(region==air1 ? 1 : 0) + U00\*(region==air2 ? 1 : 0) + U00\*(region==air3 ? 1 : 0) + U00\*(region==air4 ? 1 : 0) ;  
In other words, how could I integrate this definition into the weak formulation in order to have a solution on the road region only?  
According to [MIKE MARCHYWKA], it is necessary to modify the conditions on gam0 ie at the interface between the two regions. Even taking vv=0 on gam0, it doesn’t work.  
Thank you in advance for your help.  
Anis

---

<div class="post-metadata">

**Author:** ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)\
**Post date:** [March 7, 2024, 5:23pm UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/14 "2024-03-07T17:23:13Z")

</div>

I think that gluing the two pieces I described above is equivalent to take your first version of the code and simply setting

`real U00 = 1e-8 ;`

in order to make it invertible.

---

<div class="post-metadata">

**Author:** ![Anis](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@Anis](https://community.freefem.org/u/Anis)\
**Post date:** [March 7, 2024, 6:06pm UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/15 "2024-03-07T18:06:50Z")

</div>

Thanks for the suggestion. This allowed me to avoid a null solution, however I obtain get a solution on the whole domain and not only on the road.

---

<div class="post-metadata">

**Author:** ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)\
**Post date:** [March 8, 2024, 8:57am UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/16 "2024-03-08T08:57:19Z")

</div>

You can make a cutoff by setting zero outside the road:

```auto
 fespace Vhr(Th, P2dc) ;
 Vhr vvr;
 vvr=vv*(region==road ? 1 : 0);
 plot(vvr, nbiso=50, fill=1, value=1, wait=true);

```

full file is attached.  
[laplace.edp](https://community.freefem.org/uploads/short-url/gcotckNHyftd2tw8x6z8rbkpr7P.edp) (3.8 KB)

---

<div class="post-metadata">

**Author:** ![marchywka](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@marchywka](https://community.freefem.org/u/marchywka)\
**Post date:** [March 8, 2024, 11:32am UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/17 "2024-03-08T11:32:55Z")

</div>

Zero is still a something. I think if you take the complete solution and also make your  
road-only mesh you can just assign one solution to the other and ff will use  
the points as needed.

In reality though the “road only” solution imposes a “natural” bndary condition that won’t  
exist in the full problem unless there is something about it that makes it so.  
Probably you have issues like sources and maybe diffusion rates that vary  
without an actual boundary condition.

---

<div class="post-metadata">

**Author:** ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)\
**Post date:** [March 8, 2024, 12:10pm UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/18 "2024-03-08T12:10:44Z")

</div>

The boundary conditions used in the code posted by Anis as “Transport-mod-bis.edp” that solves the “road” alone is normal derivative vanishing (Neumann) on the interface between “road” and “air”.  
The code for the full domain with `U00 = 1e-8` provides the same solution with the same boundary condition in the “road” domain, which as I said is extended outside by nonhomogeneous Dirichlet for the “air” part.  
If you consider another boundary condition in the “road” part, the code for the full domain will not get it (in the present version).

---

<div class="post-metadata">

**Author:** ![marchywka](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@marchywka](https://community.freefem.org/u/marchywka)\
**Post date:** [March 8, 2024, 12:27pm UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/19 "2024-03-08T12:27:16Z")

</div>

What was wrong with the code I posted earlier using tgv on rhs and the normal along the  
road boundary? I guess if you need non-zero entries along A diagonal that may be easier  
than adding new entries.

---

<div class="post-metadata">

**Author:** ![Anis](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@Anis](https://community.freefem.org/u/Anis)\
**Post date:** [March 8, 2024, 1:20pm UTC](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018/20 "2024-03-08T13:20:05Z")

</div>

Thank you François for the code \<\< laplace.edp \>\>. It allows you to calculate a solution only on the road after having calculated it over the entire domain (road + air).  
Moreover and as you mentioned above, a Dirichlet condition on the boundary of the road “gam0=0” with a homogeneous Neumann condition on gamout change everything and give a solution that does not seem realistic to me. Could you tell me what to do to have the right code with these two conditions. It is clear that the problem comes from the condition “gam0=0”.  
Here is the code with the new conditions :  
[laplace (1).edp](https://community.freefem.org/uploads/short-url/bm8i6CliCAJStv28Rig126OlC8P.edp) (3.9 KB)  
Thank you in advance

[Next page](https://community.freefem.org/t/zero-solution-by-solving-the-laplace-problem-on-part-of-the-mes/3018.md?page=2)
