Integrating a variable over a line, and returning nodewise value

Dear Colleagues;
I want to solve an equation like \nabla \Psi=0 with a Dirichlet boundary condition on the dashed-blue line border, where
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\Psi(y)=\int_0^y f(y) dy

Indeed I want to integrate over a boundary to return value at each node, while the existing functions return the integral on whole boundary. In other words I want F(y)=\int_0^y f(y) dy , while the existing function gives F(L)=\int_0^L f(y) dy.

Any thoughts on how can I solve this problem?

I am sorry, but I do not understand your problem,

It is some thing like:

find \psi in rectangle \Omega=]0,A[\times]0,L[ such than
\nabla \phi = 0 in \Omega and \phi = f on line x=0 where f is a given function.

Dear professor Hecht

Thanks so much for your answer; Your understanding is correct. But:
\psi(y)=\int_0^y f(y)dy . where f(y) is indeed a data nodes [There is not a explicit relation to integrate and f(y) comes out of iteration on data]

What I think I need to do is:

  • Define new variable like \alpha where \alpha=\int_0^y f(y)dy.
  • In my weak form add the Dirichlet BC as …+ on(3,\psi=\alpha)+…

As we can see I need to calculate the a cumulative integral for each node,

The only integration in FreeFEM is int1D which returns the integral one whole boundary i.e.
\int_0^L f(y)dy, and returns one number as result.
I am wondering how can I calculate a cumulative integral (i.e. \int_0^y for each point, y \in [0, L], which returns results for all nodes)

You problem is not correct because, if \nabla\phi=0 then \phi is a constant, so f on border must be constant.

Dear Professor Hecht

Thanks so much for your response;
As I said an equation like \nabla \psi =0, not exactly this one;

The question is how to make a Dirichlet BC as:
\psi(y)=\int_0^y f(y) dy~~~~~~~~~~~\text{on}~x=0

I think I need to define a variable \alpha where \alpha=\int_0^y f(y)dy and in my weak form add

However I don’t know if there is any function defined in FreeFEM to calculate a cumulative integral, i.e., F(y)=\int_0^yf(y)dy~~~y \in [0,L]? The only function that I found is int1D which returns F(L)=\int_0^Lf(y)dy

A way to compute a cumulative integral here alpha , and you can use directly alpha as a BC on on

load "msh3"

meshL ThL= segment(10,[1,x*pi*2,0]);//  vertical segement 
fespace Pl(ThL,P0); // for f
fespace Vl(ThL,P1); // for alpha

Pl f = cos(y);
Vl alpha,aa;
Vl yy=y,ff=sin(y)+0.01; 
solve Pb(alpha,aa) = int1d(ThL) ( dy(alpha)*aa)-int1d(ThL) ( f*aa) +on(1,alpha=0);