How to implement an operator at the boundary?

Hi,

I am considering the heat equation u_t = \Delta u on a plate [0,1]\times [0,1]. I would like to impose, in FreeFem, the following type of boundary condition

u(x,0) = F\bigg(\int_{0}^{1}u(x,y)dy \bigg) for x\in (0,1),

where F is a given function (we can suppose for now that F is just the identity map). What is the syntax to implement such a boundary condition?

My intuition is to write something like on(border, u=w), and w= int2d(myMesh, y)(u_previous), to mean integration with respect to y, and here u_previous is the u at the previous time step (here, I initialize w as an element object). I don’t get an error when I try this on Freefem, but I’m not sure if it’s giving me the right answer, so I wanted to check here.

Thank you in advance for your answers

A first idea:

Use a explicite schema to compute u(x,0)) put in 1d mesh
Be careful to compute the interpolation of \int_0^1 u(x,y) dy due to
fixe name x for coordinate in integration and in interpolation
so I do a function to compute X \mapsto F(\int_0^1 u(X,x)) dx

the code is
boundary-Op.edp (567 Bytes)

1 Like

Thank you very much for your answer! I think I am starting to understand how it works.

So, let’s say I want to impose the (constant in space) boundary condition

u(x,0) = -\int_{0}^{1}\int_{0}^{1} u^2(x,y)\ dxdy

So here, I just need to define a function to integrate over y, and then I use int1d again in the loop, like in this code?

boundary-Op_energy.edp (639 Bytes)

Dear developer:
I would like to ask you a question. for layermesh , through :
mesh3 Th3 = buildlayers(Th, MaxLayer, zbound=[zmin,zmax],labelmid, labelup , labeldown );
we can get the label of the surface grid. Is there any method to set the label for each internal layer grid?
for example: MaxLayer=5,Is there any way to obtain the label of the second layer grid?

Not to day
Remark why you need this

to impose u = int u^2 dx hase a bounday condition it is very simple

just add a real

real intu2 = int2d(Th)(u*u); 
Fu[] = intu2; 

in the script

1 Like

Thank you for your reply.
What I want to do is treat each layer mesh as a floating conductor, where the unknowns in this layer are same value, and replace this layer unknowns with one degree of freedom,so i can reduce the computational scale.
thanks again.