Skip to content

MATLAB Periodic Operators use non-standard grid size. #304

@jbrzensk

Description

@jbrzensk

The grad and div operators in the MATLAB source code have non-standard sizes for the periodic operators. This non-standard size operator is confusing for new users and makes multi-dimension operators harder to implement.

The standard grad and div have sizes (m+1,m+2) and (m+2, m+1) respectively in 1D. The same pattern goes for two and three dimensions, as well as the Laplacian which will have size (m+1, m+1).

The periodic grad and div have sizes (m,m+2) and (m+2, m), respectively. This cascades for two and three dimensions, as well as the Laplacian, which will have size (m,m).

Examples using periodic operators have non-mimetic grid sizes, with no explanation why. Here is an example where the boundary conditions are periodic in X and Dirichlet in Y. The grids have different constructions for the different dimensions.


yc = [0 dy/2:dy:1-dy/2 1]';

I think the use of different grids for different boundary conditions is very confusing, especially considering the already complicated nature of the mimetic grid.

I think this particular aspect was missed in the previous commit for the scalarBCs. But that's why there is GitHub. I know @mdumett did a lot of work to get the addScalarBC code initially merged, but I think the periodic operators should be the same size as the regular operators. While not ideal, it is the easiest for the user and maintains consistency.

That means a lot of the previous EXTRA code written for the different sizes will have to be redone or removed. There would no longer be a need for the divPeriodic and divNonPeriodic, and the grids would need to be redone for the affected examples.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions