Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom refinement ops propagated to fluxes #1100

Merged
merged 4 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Current develop

### Added (new features/APIs/variables/...)
- [[PR 1100]](https://github.com/parthenon-hpc-lab/parthenon/pull/1100) Custom refinement ops propagated to fluxes
- [[PR 1090]](https://github.com/parthenon-hpc-lab/parthenon/pull/1090) SMR with swarms
- [[PR 1079]](https://github.com/parthenon-hpc-lab/parthenon/pull/1079) Address XDMF/Visit Issues
- [[PR 1084]](https://github.com/parthenon-hpc-lab/parthenon/pull/1084) Properly free swarm boundary MPI requests
Expand Down
7 changes: 7 additions & 0 deletions doc/sphinx/src/interface/refinement_operations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,10 @@ You must register both prolongation and restriction together. You may,
however, use the default Parthenon structs if desired. Then any variable
registered with this metadata object will use your custom prolongation
and restriction operations.

When a variable with custom operations is enrolled and marked
``Metadata::WithFluxes``, the resulting flux variables that are created will
also have the same custom operations enrolled. In general the custom operations
will need to be different for the variable and for its fluxes; these can be
distinguished inside the custom operations by referring to the
``TopologicalElement`` template parameter.
10 changes: 9 additions & 1 deletion src/interface/state_descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,15 @@ bool StateDescriptor::AddFieldImpl(const VarID &vid, const Metadata &m_in,
mFlags.push_back(Metadata::Edge);
else if (m.IsSet(Metadata::Edge))
mFlags.push_back(Metadata::Node);
Metadata mf(mFlags, m.Shape());

Metadata mf;
if (m.GetRefinementFunctions().label().size() > 0) {
// Propagate custom refinement ops to flux field
mf = Metadata(mFlags, m.Shape(), std::vector<std::string>(), std::string(),
m.GetRefinementFunctions());
} else {
mf = Metadata(mFlags, m.Shape());
}
auto fId = VarID{internal_fluxname + internal_varname_seperator + vid.base_name,
vid.sparse_id};
AddFieldImpl(fId, mf, control_vid);
Expand Down
Loading