Fortran-FOSS-Programmers / WenOOF

WENO interpolation Object Oriented Fortran library
35 stars 17 forks source link

Implement non uniform grid spacing support #9

Closed szaghi closed 7 years ago

szaghi commented 9 years ago

Allow the usage of non uniform grid spacing, e.g. modify the interpolate method with something like

pure subroutine interpolate(self, S, stencil, location, interpolation, nodes, coefficients)
  class(weno_interpolator_upwind), intent(IN)  :: self 
  integer,                         intent(IN)  :: S                         
  real(R_P),                       intent(IN)  :: stencil(1:, 1 - S:)
  character(*),                    intent(IN)  :: location         
  real(R_P),                       intent(OUT) :: interpolation(1:)
  real(R_P),  optional,            intent(IN) :: nodes(1-S:)
  real(R_P),  optional,            intent(IN) :: coefficients(1-S:)
endsubroutine interpolate

where

For more details see [1]

[1] Essentially Non-Oscillatory and Weighted Essentially Non-Oscillatory Schemes for Hyperbolic Conservation Laws, Chi-Shu, Wang, 1997.

giacrossi commented 9 years ago

This could be a very very nice feature!!! Just a little question (maybe I'm working on the code...): how do you think the coefficients are stored in memory? As a one-dimensional array, so, for example, for the 3rd order reconstruction we have coefficients(4) and for the 5th order reconstruction coefficients(18)?

I think that nodes could be a one-dimensional array.

szaghi commented 9 years ago

@giacombum

The pseudo-code above depicted is slightly misleading. The nodes dummy argument should be a rank 1 array as the interpolation is 1D, while the reference to coefficients is really misleading because the polynomial coefficients that for the upwind-weno interpolator is a rank 3 array. The memory mapping of these dummy arguments must be taken into account by clients codes, WenOOF is unaware of that.

This is just an idea, when I (we?) will implement it, concrete issues will arise. The interpolation is now 1D (ND will be N-times 1D interpolation...) thus the nodes could be defined as vertex abscissa of cell-spacing with something like:

| cell 1    | cell 2  | cell 3 | cell 4 | cell 5            |  
|-----------|---------|--------|--------|-------------------|
|  h1       |   h2    |   h3   | h4     |        h5         |
|-----------|---------|--------|--------|-------------------|
|           |         |        |        |                   | 
v           v         v        v        v                   v 
x0          x1        x2       x3       x4                  x5 

Thus nodes could be real :: nodes(1:5) or real :: nodes(0:5) depending on if we use grid spacings or nodes abscissa.

For the coefficients the exact definition is delayed to the future implementation time.

See you soon.

giacrossi commented 8 years ago

Following this intresting work, I've tried to write a possible algorithm for a generalized one dimensional WENO interpolation, based on ADT:

szaghi commented 8 years ago

I have not access to the paper you are referencing to. Anyhow, sounds interesting. The crucial point is, obviously, the smoothness indicator algorithm. Go on.

giacrossi commented 7 years ago

@szaghi do you think this issue can be closed?

szaghi commented 7 years ago

yes.