Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Discretizing time derivative terms of PDE in the Modelica model

I am trying to use Modelica to discretize a PDE model, but I got stuck with how to discretize the time derivative terms.
As the following screenshot shows, it is a typical method for the heat conduction PDE model, which uses the der operator instead of discretizing the time derivative terms. enter image description here enter image description here

What I am trying to do is discretizing all the derivative terms in the equation, including the time derivative, but I am not sure how to express Q(t+Δt)-Q(t), cause I don't know if there is a mechanism in Modelica that allows me to use the values of a variable of different time points.

My question is:
Is it possible to do discretization on the time derivative terms?

enter image description here

like image 297
Jack Avatar asked Nov 01 '25 18:11

Jack


1 Answers

There is no simple support for it.

A simple possibility is to use der(Q)=(Q(t+Δt)-Q(t))/Δt; which basically gives the method-of-lines, https://en.wikipedia.org/wiki/Method_of_lines

To use that you have to rewrite the equations from Q(t+Δt)-Q(t)=-uΔt/Δx(Q(t,i+1)-Q(t,i)) to (Q(t+Δt)-Q(t))/Δt=-u(Q(t,i+1)-Q(t,i))//Δx, and replace left-hand-side by der(Q) and use a normal discretization in the x-direction.

If you really want it exactly discretized like in the text:

  • Do as above and use Euler with the specific step-size as integration method (or in more advanced cases use synchronous with solverMethod="ExplicitEuler").
  • Manually write when sample(Δt,Δt) then Q=pre(Q)+Δt/Δx*...
like image 187
Hans Olsson Avatar answered Nov 04 '25 21:11

Hans Olsson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!