Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

finitse differences scheme/bug

finitse differences scheme/bug

Hello

I'm trying to simulate a simple finites differences scheme applied to the shallow water equation in 1 dimension(x) , where the discretization is only applied to the spatial coordinate x then I let modelica solving the whole system by using it's solvers.
the problem is that the program is runing indefinitly and it doesn't even  show an error message, which bring me to close OMEdit and restart it again.

So can someone please tell me what could be the cause of this kind of problem.


here is the code :

Code:

 

model SVDF

  /********Différences finies****************/
  import Modelica.SIunits;
  //nombre de pas(section)
  parameter Integer n = 32;
  //Longueur du canal
  parameter SIunits.Length L = 32000;

  constant Real g = 9.81;
 
  //vitesse
  SIunits.Velocity V[n + 1](start = fill(0, n + 1));
  //aire d'une section
  SIunits.Area S[n + 1](start = fill(20, n + 1));

protected
  //longueur d'une section
  parameter SIunits.Length dx = 32000 / n;
equation
  for i in 1:n loop
  V[i + 1] * S[i + 1] - V[i] * S[i] + dx * der(S[i]) = 0;
  dx * der(V[i] * S[i]) + V[i + 1] ^ 2 * S[i + 1] - V[i] ^ 2 * S[i] + 0.05 * g * (S[i + 1] ^ 2 - S[i] ^ 2) = 0;

  end for;
//CL
  S[n + 1] = 20;
  V[1] = 0;
end SVDF;

Thank you very much for your answer.

There are 0 guests and 0 other users also viewing this topic
You are here: