Hello,
I am solving the transport equations of a system, to compute the temperature field in a rectangular domain. I am interested in the evolution of the evolution of the horizontally averaged temperature, \int_0^1 T(x,y)dx . Currently I am sampling the solution at each time step with the following approach:
def horizontal_average(T):
x = np.linspace(0,1,100)
y = np.linspace(0,1,100)
T_avg = np.zeros((len(y)))
for i in np.arange(len(y)):
for j in np.arange(len(x)):
T_avg[i] += T(x[j], y[i])/len(x)
return T_avg
This approach is very expensive, as it takes almost the same time to solve the transport equation (advection + diffusion + Darcy’s law) of the system at each iteration. I am looking for a faster way to calculate this average
Thank you