2023 年第八届数维杯数学建模挑战赛 A题详细思路

A 题 河流-地下水系统水体污染研究

\$\$frac{partial C}{partial t}+nablacdot(mathbf{v}C)=Dnabla^2C-lambda C+R\$\$

\$\$S=frac{K_dC}{1+bC}+frac{S_0bC}{1+bC}\$\$

\$\$R=frac{1}{1+rho_bfrac{dS}{dC}}\$\$

``````import numpy as np

# 对流作用模型
def convection_model(C, rho, u):
return dCdt

# 弥散作用模型
def dispersion_model(C, D):
return dCdt

# 吸附作用模型
q = q0 + K*np.trapz(F(C), C)
dCdt = -q*F(C)
return dCdt
``````

``````
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt

# 读取表4数据
data = np.array([[0, 5.78, 1, 0],
[0.5, 5.39, 0.93, 14],
[0.25, 3.85, 0.79, 28],
[0.13, 2.55, 0.53, 42],
[0.087, 1.64, 0.34, 56],
[0.054, 0.84, 0.17, 70],
[0.027, 0.25, 0.052, 84]])

# 定义生物降解速率常数和微生物浓度的拟合函数
def model(x, k, C):
return C * np.exp(-k * x)

# 初始化参数值
p0 = [0.01, 6]

# 拟合函数并输出结果
x = data[:, 3]
y = data[:, 1]
popt, pcov = curve_fit(model, x, y, p0=p0)
print('k_c =', popt[0])
print('微生物浓度分布:', model(x, *popt))

# 绘制拟合曲线
plt.scatter(x, y)
plt.plot(x, model(x, *popt), 'r-', label='fit: k_c=%5.3f' % tuple(popt))
plt.legend()
plt.show()

``````

THE END

)">