- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 OpenModelica 对边界条件 u(0,t)=t^2 和 u_x(0,t)=0 的非常简单的偏微分方程 du/dx=du/dt 进行数值求解。我写了下面的代码:
model pdetest_1
parameter Real L=1;
parameter Integer N=100;
parameter Real dx=L/(N-1);
parameter Real[N] x=array(i*dx for i in 0:N-1);
Real u[N],ux[N];
initial equation
for i in 1:N loop
u[i]=0;
end for;
equation
u[1]=(time)^2;
ux[1]=0;
for i in 2:N loop
u[i]=u[i-1]+dx*ux[i-1];
der(u[i])=ux[i];
end for;
end pdetest_1;
它确实可以编译,但没有完成模拟并退出,并出现以下错误:
Blocstdout | OMEditInfo |
C:/Users/.../AppData/Local/Temp/OpenModelica/OMEdit/pdetest_1.exe -port=50450 -logFormat=xmltcp -override=startTime=0,stopTime=1,stepSize=0.002,tolerance=1e-6,solver=dassl,outputFormat=mat,variableFilter=.* -r=pdetest_1_res.mat -jacobian=coloredNumerical -w -lv=LOG_STATS
kquote LOG_INIT | error |The initialization problem is inconsistent due to the following equation: 0 != 0.000204061 = u[4]
stdout | warning |Error in initialization. Storing results and exiting.
stdout | error |
Use -lv=LOG_INIT -w for more information.Simulation process failed. Exited with code -1.
如果您能帮助我了解问题所在以及如何解决它,我将不胜感激?
最佳答案
好吧,首先,看到 Modelica 社区对这个话题如此 NumPy ,我感到非常难过。 SO 或 OpenModelica 论坛中有许多与 PDE 相关的问题,但没有多少有正确的答案。我决定做this Github repo收集我可以在互联网上找到的所有相关 Material ,这样至少其他人就不必四处寻找可行的示例。
但是关于上面的代码。代码几乎没问题,问题在于问题的物理原理。 I asked the question in computational science and got a very good answer .
工作代码是:
model pdetest_1
parameter Real L = 1;
parameter Integer N = 100;
parameter Real dx = L / (N - 1);
parameter Real c = 1;
Real u[N], ux[N];
initial equation
for i in 1:N loop
u[i] = 0;
end for;
equation
if c>0 then
u[N] = time ^ 2;
ux[N] = 0;
for i in 1:N-1 loop
u[i] = u[i + 1] - dx * ux[i];
der(u[i]) = c*ux[i];
end for;
else
u[1] = time ^ 2;
ux[1] = 0;
for i in 2:N loop
u[i] = u[i - 1] + dx * ux[i];
der(u[i]) = c*ux[i];
end for;
end if;
end pdetest_1;
我使用了this presentation by Jan Silar中的代码来解决问题。我还在 the example 4 of the said github repo 中提到了代码.
关于modelica - OpenModelica 解决 PDE 初始化错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45496863/
是否有任何详细文档介绍 OpenModelica 中的“Simulation Setp”>“Simulation Flags”中的所有选项的作用? OpenModelica 文档确实给出了一些标志的简
我正在使用 PowerSystem 库来玩 OpenModelica,并发现了一些奇怪的东西。 为了充分掌握 block 类的方程约束是什么,我总是单独打开每个 block 并实例化它,以获得扁平模型
所以我是 OpenModelica 的新手。我有一些使用 LMS Amesim 的经验。我使用 OM 创建了我的第一个简单模型,并在 OMeditor 中对其进行了模拟。 当我切换到绘图窗口时,没有要
我注意到在 OpenModelica 仿真设置中有几种可用的集成方法。我不知道这些是什么。我能得到一些关于这些的信息吗?如果改变积分方法,结果的质量是否会发生变化? 最佳答案 关于 OpenModel
我相信我的问题在某种程度上与 this previous question 有关但我无法根据他们的建议解决我的问题。 这是一个最小的非工作示例。我有一个简单的电路,里面有一个换向开关(在 openMo
我想用这些单位创建一个变量:((rad/s)/((N/m)^0.5)) 我尝试了很多设置,但还是不行。 这是我最后一次尝试: Real Cap_fact (quantity = "Capacity
我想对一个封闭的液压循环进行建模,可以在 Modelica 标准库/流体/示例/加热系统中找到该循环。对于供暖系统以及我的(简约)示例,我遇到了同样的问题:系统是超定的。在接下来的讲座中,您可以发现加
今天,在 Ubuntu 12.10 中安装了 OpenModelica,我在模拟中运行了其中一个示例。第一次效果很好。然后我关闭了 OpenModelica 编辑器中的 Plotting Variab
我正在考虑使用 Dymola (dymosim.exe) 或 OpenModelica (model_name.exe) 生成的可执行文件对同一模型进行参数模拟。我想知道,这两个.exe文件和相关的输
我已经设置了一个 docker 镜像并在其上安装了 ubuntu。您能告诉我如何在 ubuntu 中将 Openmodelica 安装到该 docker 镜像吗? 例如,如果我想在这个 docker
看起来像是新的 OpenModelica 编译器前端的问题。我在 windows-7 64 位操作系统上使用 openmodelica 1.14 的正式发行版本。 package Test1_14
我正在尝试使用 OpenModelica 对边界条件 u(0,t)=t^2 和 u_x(0,t)=0 的非常简单的偏微分方程 du/dx=du/dt 进行数值求解。我写了下面的代码: model pd
Dymola 中有一个选项“保存模型中的起始值”,它允许重复使用这些参数以调整模拟。 我在 OpenModelica 中寻找类似的可能性,但到目前为止我无法弄清楚。特别是,我正在用 ThermoSys
当我模拟下面的模型时,我得到了标记为 $STATESET1 的附加变量,这些变量显然是自动生成的。 从用户的角度,这些变量的目的是什么?通常我只对解决方案感兴趣,而不对特定求解器实现它的具体策略感兴趣
有人已经在 Ubuntu 19.10 上安装了 OpenModelica 吗? 似乎存储库链接不起作用。 最佳答案 来自 OpenModelica installation instructions你
我正在尝试使用 OMPython 在 OpenModelica 中运行参数扫描。假设我有一个属于库 my_library 的 Modelica 模型 my_model.mo。该模型有两个参数:a 和
我们正在使用一个生成 C 代码的工具。例如,C 代码可以用于逻辑:“如果传感器被激活,则打开 LED 灯泡”。代码可以保存到可以从外部调用的函数中。将这种外部 C 代码嵌入到 Modelica 模型的
流变模型通常使用三个(或四个)基本元素构建,它们是: Spring (例如存在于 Modelica.Mechanics.Translational.Components 中)。其方程为f = c *
我是 OpenModelica 的新手,我对“BouncingBall.mo”的代码有一些疑问,该代码作为示例代码随软件一起分发。 1) 和有什么区别'何时' 和 “如果” ? 2)变量的用途是什么'
我在 OpenModelica 中创建了一个模型,该模型使用插值表组装状态空间矩阵。矩阵是使用一个表创建的,该表接受一个输入和 39 个输出(13 个特征值、13 个系统输入和 13 个系统输出)。我
我是一名优秀的程序员,十分优秀!