Derivatives

Storing various derivatives for the purpose of importing them into the partial derivative equations in another scrcipt.

Bram Lagerweij COHMAS Mechanical Engineering KAUST 2021

derivative.Dx(dof, dx, bc='periodic')

Return the central differences matrix for the first derivatie. That is the matrix \(D_{x}\) represents the central difference approximation of \(\partial_{x}\) in 1D axis systems.

Parameters
  • dof (int) – Number of spacial degrees of freedom.

  • dx (float) – Spacial step size.

  • bc (string, optional) – The type of boundary condition to be used. The default is ‘periodic’.

Raises

ValueError – Is raised when the requested boundary condition is not implemented.

Returns

The central difference approximation of the first derivative.

Return type

matrix (sparse csr format)

derivative.Dxx(dof, dx, bc='periodic')

Return the central differences matrix for the second derivatie. That is the matrix \(D_{xx}\) represents the central difference approximation of \(\partial_{xx}\) in 1D axis systems.

Parameters
  • dof (int) – Number of spacial degrees of freedom.

  • dx (float) – Spacial step size.

  • bc (string, optional) – The type of boundary condition to be used. The default is ‘periodic’.

Raises

ValueError – Is raised when the requested boundary condition is not implemented.

Returns

The central difference approximation of the first derivative.

Return type

matrix (sparse csr format)