Hello!
I am trying to solve a transport like equation that has an integral of u in the velocity term:
I am trying to write the loss function such that it includes the integral
which is the mean of u.
I wrote a function that aproximates the integral
def int(u, t):
#I calculate the mean of u with a riemmann sum
#preparing the numpy arrays for calculation
x, delta_x = np.linspace(-1,1,101, retstep=True)
u_values = u.eval(np.meshgrid(x, np.array([t_variable])))
#calculating the integral
mean = x*u_values*delta_x
integral = mean.sum()
return integral
But the problem is that it takes t as a numeric value and not as a variable object. So it raises all kinds of errors when I add it to my loss function. The following does not work.
aux = sn.sub(x,int(u,t))
L = sn.abs(sn.diff(u, t, order = 1) - sn.diff(sn.mul(u, aux), x, order=1) )
I understand that my int function should be of Functional type so that it can be used in the loss function
The question is how can I calculate this integral?
Hello! I am trying to solve a transport like equation that has an integral of u in the velocity term: I am trying to write the loss function such that it includes the integral which is the mean of u.
I wrote a function that aproximates the integral
But the problem is that it takes t as a numeric value and not as a variable object. So it raises all kinds of errors when I add it to my loss function. The following does not work.
I understand that my int function should be of Functional type so that it can be used in the loss function
The question is how can I calculate this integral?