Skip to content

Time dependency for DiracSum and ElementStep#901

Open
kmokstad wants to merge 4 commits into
OPM:masterfrom
kmokstad:dirac-step
Open

Time dependency for DiracSum and ElementStep#901
kmokstad wants to merge 4 commits into
OPM:masterfrom
kmokstad:dirac-step

Conversation

@kmokstad

@kmokstad kmokstad commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

This should restore the functionality probably gone (although no tests for it) when moving these two FunctionSum sub-classes out from the Darcy app. Expressions in t (time) can now be specified as amplitude instead of a constant, and a SpaceTimeFunc object will then be created instead where the time function is a scalar expression function. Also setParam() can be used in case the function expressions contain parameters what can be set externally.

@kmokstad kmokstad changed the title Time dependency for DiracSum and Element Step Time dependency for DiracSum and ElementStep Jul 9, 2026
@kmokstad
kmokstad requested a review from Copilot July 9, 2026 14:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restores/extends time-dependent behavior for DiracSum and ElementSteps (moved out of the Darcy app) by allowing amplitudes to be specified as expressions in time t. It also wires setParam() through the involved function wrappers so external code can update parameters used inside expression functions.

Changes:

  • Allow DiracSum / ElementSteps to accept an amplitude string (constant or time-expression) and build SpaceTimeFunc where applicable.
  • Add/propagate setParam() support through ScalarFunc, ConstTimeFunc, SpaceTimeFunc, expression functions, and FunctionSum.
  • Refactor expression-function implementation to share parsing/evaluation state (ExpressionHolder) and unify parse error tracking (ExprEval::numError).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/Utility/Functions.h Makes ConstTimeFunc/SpaceTimeFunc own non-const subfunctions and forwards setParam() to them.
src/Utility/Functions.C Updates parsing logic to use unified expression error counter and non-const function pointers.
src/Utility/Function.h Adds ScalarFunc::setParam() to support externally-set expression parameters.
src/Utility/ExprFunctions.h Introduces ExpressionHolder, adds setParam() plumbing to expression functions, and refactors derivative handling.
src/Utility/ExprFunctions.C Implements ExpressionHolder, moves to ExprEval::numError, and updates evaluation/derivative code paths.
src/SIM/FunctionSum.h Adds FunctionSum::setParam() and RealFuncSum::addFuncComp() to support time-dependent amplitudes.
src/SIM/FunctionSum.C Implements parameter forwarding and time-expression amplitude handling for DiracSum via SpaceTimeFunc.
src/SIM/ElementSteps.h Extends constructor to accept a geometric tolerance parameter (eps).
src/SIM/ElementSteps.C Updates parsing to accept amplitude strings and route time-dependent amplitudes via SpaceTimeFunc.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/SIM/FunctionSum.C
Comment thread src/SIM/FunctionSum.C Outdated
Comment thread src/SIM/ElementSteps.C Outdated
Comment thread src/Utility/ExprFunctions.C
Added: Override setParam() method in FunctionSum.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Comment thread src/SIM/FunctionSum.C Outdated
Comment thread src/SIM/ElementSteps.C Outdated
Comment thread src/Utility/Functions.C

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Comment thread src/Utility/Functions.C
Comment thread src/SIM/FunctionSum.C
Comment thread src/SIM/ElementSteps.C
kmokstad added 3 commits July 10, 2026 14:06
class EvalFuncScalar. Also override setParam() in the classes
ConstTimeFunc and SpaceTimeFunc forwarding to their ScalarFunc
and RealFunc members (with const removed).
Added: Convenience function utl::isTimeExpression().
containing the ExprEval stuff that the two classes EvalFuncScalar and
EvalFuncSpatial have in common, do reduce code duplications, etc.
Add setParam() override for EvalFuncScalar.
Consider any string which not entirely can be converted to a
floating point value as expression, such that setParam() works
also if the expression is a user-defined constant parameter
with no time dependency.
@kmokstad

Copy link
Copy Markdown
Collaborator Author

jenkins build this with downstreams please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants