SWE

Main Class for Importing Simulation

To use this class, please first import the class with

from SWELib import SWE

SWE.simulation

Method to import simulation resulted by SimulWave.

swe = SWE()
swe.simulation(dir, chunked)

Parameters

  • dir: string

    directory of the simulation result file

  • chunked: boolean (optional)

    `TRUE` if simulation result is chunked

Returns

  • void


NOTES: From here to below, make sure to import the simulation first like in the example above SWE.simulation. From here on we'll be using 'swe.**' with imported simulation.


SWE.get_eta

Method to get wave amplitude.

swe.get_eta()

Parameters

  • void

Returns

  • res: number[][]

    2D or 3D array (according to simulation type done) of wave amplitude

SWE.get_computational_domain

Method to get simulation computational domain.

swe.get_computational_domain()

Parameters

  • void

Returns

  • res: dictionary

    dictionary of simulation computional domain

SWE.generate_animation

Method to generate animation from 1D wave simulation. With wave amplitude on the vertical axis and xx on the horizontal axis.

swe.generate_animation(y_lim, nt)

Parameters

  • y_lim: integer[]

    an array of integer that defined the interval of y axis (ex: [-1, 10])

  • nt: integer

    number of animation frame

Returns

  • res: matplotlib.animation.figure

    a matplotlib animation figure

SWE.generate_animation_2d

Method to generate animation from 2D wave simulation. With wave amplitude on the vertical axis and xx or yy (depending on the plane parameter) on the horizontal axis.

swe.generate_animation_2d(plane, at, z_lim, nt)

Parameters

  • plane: 'xz' or 'yz'

    generated animation axis plane

  • at: float

    generated animation axis plane point

  • y_lim: integer[]

    an array of integer that defined the interval of y axis (ex: [-1, 10])

  • nt: integer

    number of animation frame

Returns

  • res: matplotlib.animation.figure

    a matplotlib animation figure

SWE.plot_across_spatial

Method to generate wave plots across the spatial domain for 1D simulation at time tt, with wave amplitude on the vertical axis and xx on the horizontal axis.

swe.plot_across_spatial(t)

Parameters

  • t: float

    time to plot wave simulation across the spatial domain

Returns

  • res: matplotlib.figure

    a matplotlib figure

SWE.plot_across_spatial_2d

Method to generate wave plots across the spatial domain for 2D simulation at time tt, with wave amplitude on the vertical axis and xx or yy (depending on the plane parameter) on the horizontal axis.

swe.plot_across_spatial_2d(plane, at, t)

Parameters

  • plane: 'xz' or 'yz'

    generated plot axis plane

  • at: float

    generated plot axis plane point

  • t: float

    time to plot wave simulation across the spatial domain

Returns

  • res: matplotlib.figure

    a matplotlib figure

SWE.plot_across_time

Method to generate wave plots across the time domain for 1D simulation at point xx, with wave amplitude on the vertical axis and tt on the horizontal axis.

swe.plot_across_time(x)

Parameters

  • x: float

    point at x-axis to plot wave simulation across the time domain

Returns

  • res: matplotlib.figure

    a matplotlib figure

SWE.plot_across_time_2d

Method to generate wave plots across the spatial domain for 2D simulation at point (x,y)(x,y), with wave amplitude on the vertical axis and tt on the horizontal axis.

swe.plot_across_time_2d(x, y)

Parameters

  • x: float

    point at x axis to plot wave simulation across the time domain

  • y: float

    point at y axis to plot wave simulation across the time domain

Returns

  • res: matplotlib.figure

    a matplotlib figure

Last updated