Add a virtual PhaseFunctionBase class #6105
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist. Please read and check each box with an X. Delete any part not applicable. Ask on the forum if you need help with any step.
Introduction to the PR
In this pull request, I introduce a new class,
PhaseFunctionBase
, which serves as a pure virtual base class for different implementations of thePhaseFunction
class. My motivation for this design stems from the need to create aPhaseFunction
that returns discrete values (e.g., 0 or 1) based on a table lookup.To provide more context, I aim to reuse much of the existing structure from the
PhaseFunction
class originally implemented by @gassmoeller . For instance, the vector structure for storing phase function values will remain intact, and we will continue parsing the relevant data from the parameter file.The main changes involve overriding several key functions, specifically:
compute_value
: This will now perform a table lookup instead of using continuous functions.compute_derivative
: Since an analytical solution is not applicable in this case, we may adopt a perturbation-based approach, similar to how viscosity derivatives are computed in the material model.declare_parameters
andparse_parameters
: These will be reloaded to accommodate the changes in functionality.As you can see in the current format of the PR, the new class is purely virtual, which provides flexibility for future phase function implementations. However, I am unsure if making the base class purely virtual is the best approach for this problem. I would appreciate feedback on whether this is the right path forward.
Before your first pull request:
For all pull requests:
For new features/models or changes of existing features: