Search code examples
modelica

Modelica Mass/Energy/Momentum balance


I want to use models of the fluid library. Could anyone explain (I am new into modeling/simulation) what is the difference between: Formulation of mass/energy/momentum balance: steady-state, dynamic and inital guess initial fixed --> and what is the impact on inizialization time/computation time; when do I need wich one.

Thanks for your help!


Solution

  • Since you are new to the subject I'll skip the technical details and show you an example to illustrate the difference between the initialization methods.

    Suppose you want to study the temperature dynamics of a pipe, e.g. with the pipe model shown in the figure below:

    Model setup

    The model makes a step change to the inlet temperature at time t=15 and you want to see the step response of the outlet temperature.

    In the plots below I simulated the model with the four initialization methods.

    Temperature step response with different initializations

    The first plot shows the result of DynamicFreeInitial. Here I don't specifically set the initial value of the model states which means that I have to wait patiently for the initial transient to fade out before I can apply the step.

    In the second plot I use FixedInitial and set the initial temperature to a "good guess" value so that the initial transient time will be shorter (I know, I could have made a better guess).

    In the third plot I use SteadyStateInitial. The solver will calculate the state values that gives me zero transient time before the "actual simulation" starts. This means I can apply the step right from the beginning of the simulation.

    The fourth option SteadyState is not actually an initialization option. It sets all model derivatives to zeros which means that the dynamics are disabled and the simulation is steady state.

    In most cases you want to use the SteadyStateInitial so you don't have to wait for the initial transient to die out. However, in some cases that is not possible for numerical reasons that are beyond the scope of a simple explanation.

    You can download the model here: https://drive.google.com/file/d/0B8ojPn4YxnI9cjR4QTZ5UGRxT1E/view?usp=sharing