二阶偏微分方程数值解遇到一些问题,求大佬看一下
mathematica吧
全部回复
仅看楼主
level 4
凭窗梦龙 楼主
pin = 100/10^3;
g = 58/10^6;
s = 100/10^6;
w = 300/10^6;
lamda = 46;
d = 10/10^6;
l = 200/10^6;
L := d + l + lc;
W := g + s/2 + w;
T0 = 300;
lc = 100/10^6;
ka = 10000000;
\[CapitalPhi]0 = pin/((2*g^2)/4);
sigmod[x_, a_] := 1/(E^(a*(-x)) + 1);
x1[x_] := sigmod[x - (lc - g/4), ka];
x2[x_] := sigmod[x - lc, ka];
y1[y_] := sigmod[y - w, ka];
y2[y_] := sigmod[y - (g + w), ka];
ux[x_] := x1[x] - x2[x];
uy[y_] := y1[y] - y2[y];
uz[x_, y_] := \[CapitalPhi]0*ux[x]*uy[y];
pdeSoln = NDSolveValue[{D[t[x, y], {x}, {x}] + D[t[x, y], {y}, {y}] + uz[x, y]/lamda == 0,
Derivative[1, 0][t][0, y] == 0, Derivative[0, 1][t][x, W] == 0, t[L, y] == T0,
t[x, 0] == T0}, t[x, y], {x, 0, L}, {y, 0, W}];
Plot3D[pdeSoln, {x, 0, L}, {y, 0, W}, PlotRange -> All, ColorFunction -> "DeepSeaColors"]
uz是个自己定义的热源函数,目标方程是一个二维稳态传热的傅里叶方程,然后运行报错如下
General::ivar: 0 is not a valid variable.
General::ivar: 51/125000 is not a valid variable.
NDSolveValue::dsvar: 0 cannot be used as a variable.
General::munfl: Exp[-1080.] is too small to represent as a normalized machine number; precision may be lost.
General::ivar: 0.` is not a valid variable.
General::ivar: 0.000408` is not a valid variable.
NDSolveValue::dsvar: 0.` cannot be used as a variable.
General::munfl: Exp[-1080.] is too small to represent as a normalized machine number; precision may be lost.
General::ivar: 0.` is not a valid variable.
General::stop: Further output of General::ivar will be suppressed during this calculation.
NDSolveValue::dsvar: 0.` cannot be used as a variable.
General::munfl: Exp[-1080.] is too small to represent as a normalized machine number; precision may be lost.
General::stop: Further output of General::munfl will be suppressed during this calculation.
NDSolveValue::dsvar: 0.` cannot be used as a variable.
General::stop: Further output of NDSolveValue::dsvar will be suppressed during this calculation.
望大佬指点一下
2018年10月11日 02点10分 1
level 9
2018年10月22日 08点10分 6
代码楼下
2018年10月22日 08点10分
level 9
2018年10月22日 08点10分 8
全被吞了,只能给个图片了。
2018年10月22日 08点10分
@逍遥诸葛亮 多谢大神
2018年10月22日 13点10分
吧务
level 15
稍微解释一下顶楼哪不对。首先大部分的报错应该是因为变量没清。这个在这里已经说得很多了,这里不重复:
https://tieba.baidu.com/p/5539694329
然后,即使刨去这部分不谈,NDSolve还是解不了,因为目前NDSolve只会用FiniteElement法解这个稳态问题,而FiniteElement目前无法直接识别第二类和第三类边界,用户必须要手动把这类边界改写成NeumannValue,楼上 @逍遥诸葛亮 就是这么干的——不过,
其实取值为0的NeumannValue是可以省略的,当
求解方法为FiniteElement时,NDSolve默认会在缺边界的地方使用为0的NeumannValue,并且,实际上,即使你把为0的NeumannValue给手动写上,
NDSolve也会在解析阶段把这个NeumannValue给拿掉……参看:
https://mathematica.stackexchange.com/questions/169895/dirichletcondition-in-ndsolve-causes-asymmetry-finite-element-method#comment446749_169895
(user21是NDSolve的FiniteElement方法的主要开发者。)
2018年11月03日 09点11分 9
1