Skip to content

Commit

Permalink
Add notes on vtk known bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Hongyang Zhou committed Jan 16, 2021
1 parent c92cf8d commit 3e31655
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions docs/src/man/log.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ Several issues worth noticing:
* 3D unformatted output as stored as it is.
* The simulation is typically done with multiple MPI processes. In the tree structure, each node only records the MPI process local block index. What makes it more complicated is that the local block indexes on a given MPI process may have skipped numbers because they are not in the physical simulation domain. This means that in order to get the true global block indexes, one needs to count how many blocks are used on all MPI processes with lower ranks, and also the order of the current node based on local block index on this MPI process.
* It would be pretty difficult to count the number of elements in the connectivity list. Appending to an array is a very expensive operation: counting the elements in the first loop, preallocating the array and then repeat the same computation to fill in the list results in over 1000 times speedup.
* The implementation in v0.2.3 inherits the bug from BATSRUS `ModWriteTecplot` that will generate duplicate voxel grid. For example, imagine a coarse block which is surrounded by refined blocks all around. On edge 8, the two refined face neighbor will both think they are in charge of writing the connectivity for the cells around the edge. This does not cause any serious issues as of now, so I don't fix it. Speaking of fixing that, there are two ways:
* `fillCellNeighbors!` not only deals with coarsened neighbors, but also the refined neighbors. This means that literally we need to implement the `message_pass_cell` completely. We still do a two-round process, write everything without checking, and in the end before IO remove the duplicate rows. This may be even faster then implementing some complicated writing rules to avoid duplicating.
* Polish the writing rules even further. This requires me to consider all possible cases. As a first step, for the above example case, neither of the two face neighbor should write the connectivity, but instead the edge neighbor should write.
* Many function names are inherited from BATL. I may consider rename them in the future if more general task is required.

### Ordering of connectivity

Expand Down
12 changes: 6 additions & 6 deletions src/vtk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ function getConnectivity(batl::Batl)

fillCellNeighbors!(batl, iCell_G, DiLevelNei_III, iNodeNei_III, nBlock_P)

# In ModWriteTecplot, the first three conditions are needed only for certain 2D cases.
# Check who is in charge of writing following the prescribed rules.
if DiLevelNei_III[3,3,2] < 0
iCell_G[end,end,:] .= 0
end
Expand Down Expand Up @@ -807,11 +807,7 @@ function getConnectivity(batl::Batl)
if any(iCell_G[i+1:i+2,j+1:j+2,k+1:k+2] .== 0)
continue
end
if iRound == 1
nElem += 1
else
iElem += 1
end
iRound == 1 ? nElem += 1 : iElem += 1
if iRound == 2
connectivity[:,iElem] = [
iCell_G[i+1,j+1,k+1],
Expand Down Expand Up @@ -840,6 +836,10 @@ function getConnectivity(batl::Batl)
end
end

# The current writing process will generate duplicate connectivity rows at
# edge cells between coarse and fine blocks. WriteTecplot module function
# has the same issue.
#return unique(connectivity, dims=2)
return connectivity
end

Expand Down

0 comments on commit 3e31655

Please sign in to comment.