modelDE_Usage

Example Usage of DE Blocks

Extends from Modelica.Icons.Example (Icon for runnable examples).

Information

Example usage of DE blocks. Bessel functions (J0, J1, Y1), spherical harmonics (Y1,1), and Hermite functions appear here. In all these examples, time is used essentially as a parametrization: the ramp sources run from time=0 to 1, and it is their outputs (*.y) that are used as the independent variable (x) for the DEs. Alteration of the times and limits of these ramp sources will also require adjustment of the 'dtdx' parameters of the DE blocks (Delta t / Delta x).

For the Bessel functions, examples of generating solely the functions J0(x) and J1(x) are shown. This is achieved by choosing the order in the DE blocks and the appropriate boundary conditions near the origin. The third Bessel example generates a combination of J1(x) and Y1(x) functions since the zeroed starting point of the integration is away from the origin (x=1). Integrating this example back toward the origin (next example to the right) reveals the divergence of the Y1(x) function.

The lower-left example is for the first non-polynomial spherical harmonic, Y1,1(x). Again, note the appropriate boundary conditions at x~-1 to achieve this.

The last two examples involve the lowest solutions to the DE for the quantum harmonic oscillator: psi0,1(x).

In all such examples, the resulting normalization will be different from that provided by the corresponding GSL functions. The overall normalizations here are controlled via initial values for the functions and their derivatives. Care must also be taken that enough steps are chosen to avoid discretization errors [e.g., slight deviations from expected behavior can be seen near the boundaries for Y1,1(x) and psi0(x)].

Parameters

TypeNameDefaultDescription
RealxJ10.0001
RealxJ25
RealxJ31
RealxY1-0.99999
RealxY20.99999
RealxP10
RealxP25

Components

TypeNameDefaultDescription
Modelica.Blocks.Sources.RampYlm_ramp
Modelica.Blocks.Sources.RampJnu_ramp
GNU_ScientificLibrary.Blocks.specfunc.DifferentialEquations.Bessel_Jnu_DEsbessel_J0_DEs
GNU_ScientificLibrary.Blocks.specfunc.DifferentialEquations.SphHarm_Ylm_DEssphHarm_Y11_DEs
GNU_ScientificLibrary.Blocks.specfunc.DifferentialEquations.Bessel_Jnu_DEsbessel_J1_DEs
Modelica.Blocks.Sources.RampJYnu_ramp
GNU_ScientificLibrary.Blocks.specfunc.DifferentialEquations.Bessel_Jnu_DEsbessel_JY1_DEs
GNU_ScientificLibrary.Blocks.specfunc.DifferentialEquations.Bessel_Jnu_DEsbessel_JY1_DEs1
Modelica.Blocks.Sources.RampJYnu_ramp1
Modelica.Blocks.Sources.Ramppsi_n_ramp
GNU_ScientificLibrary.Blocks.specfunc.DifferentialEquations.Hermite_psi_n_DEshermite_psi_0_DEs
GNU_ScientificLibrary.Blocks.specfunc.DifferentialEquations.Hermite_psi_n_DEshermite_psi_1_DEs