Mercurial > repos > public > sbplib_julia
comparison src/Grids/curvilinear_grid.jl @ 1503:704a84eef8b6 feature/grids/curvilinear
Add tests for boundary_grid
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 16 Feb 2024 14:31:27 +0100 |
parents | a2dc80396808 |
children | 976f5784d7b9 |
comparison
equal
deleted
inserted
replaced
1502:a2dc80396808 | 1503:704a84eef8b6 |
---|---|
29 boundary_identifiers(g::CurvilinearGrid) = boundary_identifiers(g.logicalgrid) | 29 boundary_identifiers(g::CurvilinearGrid) = boundary_identifiers(g.logicalgrid) |
30 boundary_indices(g::CurvilinearGrid, id::TensorGridBoundary) = boundary_indices(g.logicalgrid, id) | 30 boundary_indices(g::CurvilinearGrid, id::TensorGridBoundary) = boundary_indices(g.logicalgrid, id) |
31 | 31 |
32 function boundary_grid(g::CurvilinearGrid, id::TensorGridBoundary) | 32 function boundary_grid(g::CurvilinearGrid, id::TensorGridBoundary) |
33 b_indices = boundary_indices(g.logicalgrid, id) | 33 b_indices = boundary_indices(g.logicalgrid, id) |
34 | |
35 # Calculate indices of needed jacobian combonents | |
36 D = ndims(g) | |
37 all_indices = SVector{D}(1:D) | |
38 free_variable_indices = deleteat(all_indices, grid_id(id)) | |
39 jacobian_components = (:, free_variable_indices) | |
40 | |
41 # Create grid function for boundary grid jacobian | |
42 boundary_jacobian = componentview((@view g.jacobian[b_indices...]) , jacobian_components...) | |
43 boundary_physicalcoordinates = @view g.physicalcoordinates[b_indices...] | |
44 | |
34 return CurvilinearGrid( | 45 return CurvilinearGrid( |
35 boundary_grid(g.logicalgrid, id), | 46 boundary_grid(g.logicalgrid, id), |
36 g.physicalcoordinates[b_indices...], | 47 boundary_physicalcoordinates, |
37 g.jacobian[b_indices...], | 48 boundary_jacobian, |
38 ) | 49 ) |
39 end | 50 end |
40 | 51 |
41 # Do we add a convenience function `curvilinear_grid`? It could help with | 52 # Do we add a convenience function `curvilinear_grid`? It could help with |
42 # creating the logical grid, evaluating functions and possibly calculating the | 53 # creating the logical grid, evaluating functions and possibly calculating the |