Discretizing PDE in space for use with modelica

戏子无情 提交于 2019-12-13 01:17:23

问题


I am currently doing a course called "Modeling of dynamic systems" and have been given the task of modeling a warm water tank in modelica with a distributed temperature description.

Most of the tasks have gone well, and my group is left with the task of introducing the heat flux due to buoyancy effects into the model. Here is where we get stuck.

the equation given is this: Given PDE

But how do we discretize this into something we can use in modelica?

The discretized version we ended up with was this:

(Qd_pp_b[k+1] - Qd_pp_b[k]) / h_dz = -K_b *(T[k+1] - 2 * T[k] + T[k-1]) / h_dz^2

where Qd_pp_b is the left-hand side variable, ie the heat flux, k is the current slice of the tank and T is the temperature in the slices.

Are we on the right path? or completely wrong?


回答1:


This doesn't seem to be a differential equation (as is) so this does not make sense without surrounding problem. For the second derivative you should always create auxiliary variables and for each partial derivative a separate equation. I added dummy values for parameters and dummy equations for T[k]. This can be simulated, is this about what you expected?

model test
  constant Integer n = 10;
  Real[n] Qd_pp_b;
  Real[n] dT;
  Real[n] T;
  parameter Real K_b = 1;
equation
    for k in 1:n loop
      der(Qd_pp_b[k]) = -K_b *der(dT[k]);
      der(T[k]) = dT[k];
      T[k] = sin(time+k);
    end for;
end test;


来源:https://stackoverflow.com/questions/58362001/discretizing-pde-in-space-for-use-with-modelica

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!