Reputation: 1
I am solving the following problem: solving an advection-diffusion equation through the analytical solution. The standard problems work well, however when I compute the time integral for big simulation times or for Peclet numbers (celerity*distance/diffusion) that are very high I get overflow when I approach big times.
Here on the function tha I am solving:
def funct_adv(x, t, l, k, A0):
return A0 *np.exp((l/(2 * k))*(x-0.5*l*t ))
def funct_diff_integral(x, tend,tau, l,k, g_values,t_values,A0):
diff_t=max(tend-tau,1e-5)
denom= (diff_t)**(3/2)
arg=-(x**2)/(4*k*(diff_t))
x0=0
denom_adv=funct_adv(x0, tau, l, k, A0)
g_val = np.interp(tau, t_values, g_values)
return (g_val/denom_adv)*(np.exp(arg)/denom)
def integrate_diff(x,tend,l,k,A0,g_values,
t_values):
integral,_=quad_vec(lambda tau: funct_diff_integral(x, tend,tau, l,k, g_values,t_values,A0), 0, tend-eps)
coeff=x/np.sqrt(4*np.pi*k)
return coeff*integral
def funct_C_num(x, t, l, k, g_values, t_values, C0,A0):
A = funct_adv(x, t, l, k, A0)
B = integrate_diff(x,t,l,k,A0,g_values,t_values)
return A*B + C0
C_values_num = [funct_C_num(x, ti, lambda_ssc_sim, k_ssc_sim, g_values,t_values, C0,A0) for ti in t_values]
I would like possibly to know if there is a way to handle this situation still solving the dimentional equation ( thus using time in seconds ) and x in meters, or would be more useful to solve a non-dimensional version of my problem.
Of am I missing something on the numerics that could be imporved?
Upvotes: 0
Views: 11