# How to control on a specific part of domain

Dear All

How can we update a solution on a part of a domain?

For example: in an edge (right vertical) of a unit square, how could we take control.

Hello,

1. Have you tried using the chi function in the desired restriction?

Another possibility:

Or create the domain restriction at the desired range. Below I send an example. Hope to help.

Yours sincerely,

Pitágoras.

DOMAIN.edp (1.5 KB)

//=======================================================
//=======================================================
// NUMERICAL VALUES
//=======================================================
int NInt=0, NSigma=99, NBase=98, NSigma1=97; // labels
int N1=10; // Points in border

//=============== DOMAIN DATES ================
real x0=0., xF=1., x1=xF, a=(x0+xF)/4., b= xF-a;
real T=1.;

//=======================================================
// THE DOMAIN
//=======================================================
border C1(s=x0, a){x=s; y=0.; label=NBase;}
border C3p(s=a, b){x=s; y=0.; label=NBase;}
border C3(s=b, x1){x=s; y=0.; label=NBase;}
border C4(s=0., T){x=x1; y=s; label=NSigma;}
border C5(s=x1, b){x=s; y=T; label=NSigma;}
border C5p(s=b, a){x=s; y=T; label=NSigma;}
border C7(s=a,0.){x=s; y=T; label=NSigma;}
border C8(s=T,0.){x=x0; y=s; label=NSigma;}

//=================PLOT DOMAIN=========================
plot ( C1(2N1) + C3p(4N1) + C3(2N1)
+ C4(8
N1)
+ C5(2N1) + C5p(4N1) + C7(2N1)
+ C8(8
N1),
wait=true);

//=================PLOT MESH========================
mesh Th=buildmesh( C1(2N1) + C3p(4N1) + C3(2N1)
+ C4(8
N1)
+ C5(2N1) + C5p(4N1) + C7(2N1)
+ C8(8
N1));
plot(Th, wait=true, cmm=“MESH”);

//===========THE RESTRICTION==========

real one=1.;
func restri=one*(x>=a)*(x<=b);

1 Like

Dear @Pitagoras1 Sir,
Thanks for your prompt response with the code.

actually, my problem was a sub-part of an interface boundary problem.

I am trying to solve the Poissons equation on two subdomains having a single interface boundary.

u1_xx + u1_yy = x on domain1 with u1 = 0 on Ddomain1
u2_xx + u2_yy = x on domain2 with u1 = 0 on Ddomain2

on interface: u1 = u2 and u1_n = u2_n

while solving it I am trying to update a solution of the variable at the interface in each iteration (Like in Schwarz scheme )

It would be helpful for me if any freefem sample code including an interface boundary is available.

Dear @sumantkr ,

I’m not sure I understand your question correctly:

But if you have a domain-wide acting problem, but you need to constrain the action to one part of the domain, you can parameterize the region in two parts:

This is, \Omega = \Omega1 \ cup \Omega2.

Therefore, you can generate two characteristic functions:

chi (x1, y1) for \Omega1
and
chi (x2, y2) for \Omega2.

The chi (x, y) function generates the characteristic function of the parameterized region, taking only two internal points to it.

or, construct the mesh Th (for the 2D case)

mesh Th1= \Omega1 ;
mesh Th2= \Omega2 ;
mesh Th=Th1+Th2;

// and insert the chi functions:

func chi1= chi(Th1);
func chi2= chi(Th2);

To consider u1 in Th1 (restrict only in Th1), consider
u1chi1. The same for u2 in Th2 (u2chi2).

Hence the importance of parameterizing \Omega as \Omega1 \ cup \Omega2.

Best regards,

Pitágoras Carvalho.

1 Like

Thanks @Pitagoras1 Sir,

I think we are on the same path but here I have followed the generalized Schwarz non-overlapping algorithm for solving the interface boundary problem.

I have attached the iterative scheme and code script for the pseudo steps.

However, I am getting a good results agreement but It would help me if you can validate my steps.

Poissons equation defined as:  Solution steps for Schwarz algorithm for interface BCS is:

initialize u2 = 0, Freefem code:
rsirpoisson.edp (1.9 KB)

Results obtained for above code is:

The only thing I am confused about is that whether I am going in the right direction while implementing the FREEFEM code here or not.