From 3e4db88fd01ba374b1f1e56ae227a6aa82e03915 Mon Sep 17 00:00:00 2001 From: Yaqi Wang Date: Wed, 7 Sep 2022 21:05:19 -0500 Subject: [PATCH 1/4] add the empty setup function for custom execute flags in SetupInterface #22006 --- framework/include/base/MooseFunctor.h | 15 ++++++ framework/include/interfaces/SetupInterface.h | 6 +++ framework/include/linesearches/LineSearch.h | 1 + framework/include/outputs/OutputWarehouse.h | 6 +++ framework/include/problems/DisplacedProblem.h | 1 + framework/include/problems/FEProblemBase.h | 1 + framework/include/problems/SubProblem.h | 1 + framework/include/systems/AuxiliarySystem.h | 1 + .../include/systems/NonlinearSystemBase.h | 1 + framework/include/systems/SystemBase.h | 1 + .../include/variables/VariableWarehouse.h | 5 ++ .../include/warehouses/MooseObjectWarehouse.h | 10 ++++ framework/src/outputs/OutputWarehouse.C | 7 +++ framework/src/problems/DisplacedProblem.C | 9 ++++ framework/src/problems/FEProblemBase.C | 39 ++++++++++++++ framework/src/problems/SubProblem.C | 8 +++ framework/src/systems/AuxiliarySystem.C | 18 +++++++ framework/src/systems/NonlinearSystemBase.C | 54 +++++++++++++++++++ framework/src/systems/SystemBase.C | 7 +++ framework/src/variables/VariableWarehouse.C | 7 +++ 20 files changed, 198 insertions(+) diff --git a/framework/include/base/MooseFunctor.h b/framework/include/base/MooseFunctor.h index 3d5fe79b1cda..e27254e973f3 100644 --- a/framework/include/base/MooseFunctor.h +++ b/framework/include/base/MooseFunctor.h @@ -342,6 +342,7 @@ class FunctorBase virtual void residualSetup(); virtual void jacobianSetup(); virtual void timestepSetup(); + virtual void customSetup(const ExecFlagType & exec_type); /** * Set how often to clear the functor evaluation cache @@ -868,6 +869,14 @@ FunctorBase::jacobianSetup() clearCacheData(); } +template +void +FunctorBase::customSetup(const ExecFlagType & exec_type) +{ + if (_clearance_schedule.count(exec_type)) + clearCacheData(); +} + template typename FunctorBase::GradientType FunctorBase::gradient(const ElemArg & elem, const unsigned int state) const @@ -983,6 +992,7 @@ class FunctorEnvelopeBase virtual void timestepSetup() = 0; virtual void residualSetup() = 0; virtual void jacobianSetup() = 0; + virtual void customSetup(const ExecFlagType & /*exec_type*/) = 0; virtual bool wrapsNull() const = 0; virtual std::string returnType() const = 0; virtual bool isConstant() const = 0; @@ -1086,6 +1096,11 @@ class FunctorEnvelope final : public FunctorBase, public FunctorEnvelopeBase if (_owned) _owned->timestepSetup(); } + void customSetup(const ExecFlagType & exec_type) override + { + if (_owned) + _owned->customSetup(exec_type); + } void residualSetup() override { if (_owned) diff --git a/framework/include/interfaces/SetupInterface.h b/framework/include/interfaces/SetupInterface.h index 7f55417644e4..2335c95e3041 100644 --- a/framework/include/interfaces/SetupInterface.h +++ b/framework/include/interfaces/SetupInterface.h @@ -54,6 +54,12 @@ class SetupInterface */ virtual void subdomainSetup(); + /** + * Gets called in FEProblemBase::execute() for execute flags other than initial, timestep_begin, + * nonlinear, linear and subdomain + */ + virtual void customSetup(const ExecFlagType & /*exec_type*/) {} + /** * Return the execute on MultiMooseEnum for this object. */ diff --git a/framework/include/linesearches/LineSearch.h b/framework/include/linesearches/LineSearch.h index c89b4badac65..24471b35274b 100644 --- a/framework/include/linesearches/LineSearch.h +++ b/framework/include/linesearches/LineSearch.h @@ -35,6 +35,7 @@ class LineSearch : public MooseObject virtual void lineSearch() { mooseError("You must implement a line-search method."); } virtual void timestepSetup() {} + virtual void customSetup(const ExecFlagType & /*exec_type*/) {} virtual void initialSetup() {} protected: diff --git a/framework/include/outputs/OutputWarehouse.h b/framework/include/outputs/OutputWarehouse.h index 70233d874717..e1168c1383cb 100644 --- a/framework/include/outputs/OutputWarehouse.h +++ b/framework/include/outputs/OutputWarehouse.h @@ -264,6 +264,12 @@ class OutputWarehouse : protected PerfGraphInterface */ void timestepSetup(); + /** + * Calls the setup function for each of the output objects + * @see FEProblemBase::customSetup(const ExecFlagType & exec_type) + */ + void customSetup(const ExecFlagType & exec_type); + /** * Calls the jacobianSetup function for each of the output objects * @see FEProblemBase::computeJacobian diff --git a/framework/include/problems/DisplacedProblem.h b/framework/include/problems/DisplacedProblem.h index b6d48dedad88..efdecf6cfad0 100644 --- a/framework/include/problems/DisplacedProblem.h +++ b/framework/include/problems/DisplacedProblem.h @@ -339,6 +339,7 @@ class DisplacedProblem : public SubProblem void initialSetup() override; void timestepSetup() override; + void customSetup(const ExecFlagType & exec_type) override; using SubProblem::haveADObjects; void haveADObjects(bool have_ad_objects) override; diff --git a/framework/include/problems/FEProblemBase.h b/framework/include/problems/FEProblemBase.h index d3b267d5f741..7809a2fbb496 100644 --- a/framework/include/problems/FEProblemBase.h +++ b/framework/include/problems/FEProblemBase.h @@ -346,6 +346,7 @@ class FEProblemBase : public SubProblem, public Restartable void initialSetup() override; void timestepSetup() override; + void customSetup(const ExecFlagType & exec_type) override; void residualSetup() override; void jacobianSetup() override; diff --git a/framework/include/problems/SubProblem.h b/framework/include/problems/SubProblem.h index 28f5945427c2..d26bba708b2a 100644 --- a/framework/include/problems/SubProblem.h +++ b/framework/include/problems/SubProblem.h @@ -828,6 +828,7 @@ class SubProblem : public Problem virtual void initialSetup(); virtual void timestepSetup(); + virtual void customSetup(const ExecFlagType & exec_type); virtual void residualSetup(); virtual void jacobianSetup(); diff --git a/framework/include/systems/AuxiliarySystem.h b/framework/include/systems/AuxiliarySystem.h index f58754efa35b..62bb2b525431 100644 --- a/framework/include/systems/AuxiliarySystem.h +++ b/framework/include/systems/AuxiliarySystem.h @@ -46,6 +46,7 @@ class AuxiliarySystem : public SystemBase, public PerfGraphInterface virtual void initialSetup() override; virtual void timestepSetup() override; + virtual void customSetup(const ExecFlagType & exec_type) override; virtual void subdomainSetup() override; virtual void residualSetup() override; virtual void jacobianSetup() override; diff --git a/framework/include/systems/NonlinearSystemBase.h b/framework/include/systems/NonlinearSystemBase.h index c58d31d26ee9..d8450dc0d9af 100644 --- a/framework/include/systems/NonlinearSystemBase.h +++ b/framework/include/systems/NonlinearSystemBase.h @@ -99,6 +99,7 @@ class NonlinearSystemBase : public SystemBase, public PerfGraphInterface // Setup Functions //// virtual void initialSetup() override; virtual void timestepSetup() override; + virtual void customSetup(const ExecFlagType & exec_type) override; virtual void residualSetup() override; virtual void jacobianSetup() override; diff --git a/framework/include/systems/SystemBase.h b/framework/include/systems/SystemBase.h index ef5b6c259689..677474d53bac 100644 --- a/framework/include/systems/SystemBase.h +++ b/framework/include/systems/SystemBase.h @@ -879,6 +879,7 @@ class SystemBase : public libMesh::ParallelObject, public ConsoleStreamInterface /// Setup Functions virtual void initialSetup(); virtual void timestepSetup(); + virtual void customSetup(const ExecFlagType & exec_type); virtual void subdomainSetup(); virtual void residualSetup(); virtual void jacobianSetup(); diff --git a/framework/include/variables/VariableWarehouse.h b/framework/include/variables/VariableWarehouse.h index f3ca25fce9b3..f8640f54f93c 100644 --- a/framework/include/variables/VariableWarehouse.h +++ b/framework/include/variables/VariableWarehouse.h @@ -171,6 +171,11 @@ class VariableWarehouse */ void timestepSetup(); + /** + * Call setup on a particular execute flag for all variables + */ + void customSetup(const ExecFlagType & exec_type); + /** * Call subdomainSetup for all variables */ diff --git a/framework/include/warehouses/MooseObjectWarehouse.h b/framework/include/warehouses/MooseObjectWarehouse.h index 96c5e5bf9ccd..be17c528ba43 100644 --- a/framework/include/warehouses/MooseObjectWarehouse.h +++ b/framework/include/warehouses/MooseObjectWarehouse.h @@ -53,6 +53,7 @@ class MooseObjectWarehouse : public MooseObjectWarehouseBase */ virtual void initialSetup(THREAD_ID tid = 0) const; virtual void timestepSetup(THREAD_ID tid = 0) const; + virtual void customSetup(const ExecFlagType & exec_type, THREAD_ID tid = 0) const; virtual void subdomainSetup(THREAD_ID tid = 0) const; virtual void subdomainSetup(SubdomainID id, THREAD_ID tid = 0) const; virtual void jacobianSetup(THREAD_ID tid = 0) const; @@ -163,6 +164,15 @@ MooseObjectWarehouse::timestepSetup(THREAD_ID tid /* = 0*/) const object->timestepSetup(); } +template +void +MooseObjectWarehouse::customSetup(const ExecFlagType & exec_type, THREAD_ID tid /* = 0*/) const +{ + checkThreadID(tid); + for (const auto & object : _active_objects[tid]) + object->customSetup(exec_type); +} + template void MooseObjectWarehouse::subdomainSetup(SubdomainID id, THREAD_ID tid /* = 0*/) const diff --git a/framework/src/outputs/OutputWarehouse.C b/framework/src/outputs/OutputWarehouse.C index 33b3000dc05f..653be7f9dfb9 100644 --- a/framework/src/outputs/OutputWarehouse.C +++ b/framework/src/outputs/OutputWarehouse.C @@ -61,6 +61,13 @@ OutputWarehouse::timestepSetup() obj->timestepSetup(); } +void +OutputWarehouse::customSetup(const ExecFlagType & exec_type) +{ + for (const auto & obj : _all_objects) + obj->customSetup(exec_type); +} + void OutputWarehouse::solveSetup() { diff --git a/framework/src/problems/DisplacedProblem.C b/framework/src/problems/DisplacedProblem.C index 793c00cace41..dfc63bc087da 100644 --- a/framework/src/problems/DisplacedProblem.C +++ b/framework/src/problems/DisplacedProblem.C @@ -1152,6 +1152,15 @@ DisplacedProblem::timestepSetup() _displaced_aux.timestepSetup(); } +void +DisplacedProblem::customSetup(const ExecFlagType & exec_type) +{ + SubProblem::customSetup(exec_type); + + _displaced_nl.customSetup(exec_type); + _displaced_aux.customSetup(exec_type); +} + void DisplacedProblem::haveADObjects(const bool have_ad_objects) { diff --git a/framework/src/problems/FEProblemBase.C b/framework/src/problems/FEProblemBase.C index b3234ec19b3a..cfdd1bef8f64 100644 --- a/framework/src/problems/FEProblemBase.C +++ b/framework/src/problems/FEProblemBase.C @@ -3773,6 +3773,42 @@ FEProblemBase::executeAllObjects(const ExecFlagType & /*exec_type*/) { } +void +FEProblemBase::customSetup(const ExecFlagType & exec_type) +{ + SubProblem::customSetup(exec_type); + + if (_line_search) + _line_search->customSetup(exec_type); + + unsigned int n_threads = libMesh::n_threads(); + for (THREAD_ID tid = 0; tid < n_threads; tid++) + { + _all_materials.customSetup(exec_type, tid); + _functions.customSetup(exec_type, tid); + } + + _aux->customSetup(exec_type); + _nl->customSetup(exec_type); + + if (_displaced_problem) + _displaced_problem->customSetup(exec_type); + + for (THREAD_ID tid = 0; tid < n_threads; tid++) + { + _internal_side_indicators.customSetup(exec_type, tid); + _indicators.customSetup(exec_type, tid); + _markers.customSetup(exec_type, tid); + } + + std::vector userobjs; + theWarehouse().query().condition("UserObject").queryIntoUnsorted(userobjs); + for (auto obj : userobjs) + obj->customSetup(exec_type); + + _app.getOutputWarehouse().customSetup(exec_type); +} + void FEProblemBase::execute(const ExecFlagType & exec_type) { @@ -3782,6 +3818,9 @@ FEProblemBase::execute(const ExecFlagType & exec_type) if (exec_type != EXEC_INITIAL) executeControls(exec_type); + // intentially call this after executing controls because the setups may rely on the controls + customSetup(exec_type); + // Samplers; EXEC_INITIAL is not called because the Sampler::init() method that is called after // construction makes the first Sampler::execute() call. This ensures that the random number // generator object is the correct state prior to any other object (e.g., Transfers) attempts to diff --git a/framework/src/problems/SubProblem.C b/framework/src/problems/SubProblem.C index eb12373bca78..2b2775dc9d07 100644 --- a/framework/src/problems/SubProblem.C +++ b/framework/src/problems/SubProblem.C @@ -1014,6 +1014,14 @@ SubProblem::timestepSetup() pr.second->timestepSetup(); } +void +SubProblem::customSetup(const ExecFlagType & exec_type) +{ + for (auto & map : _functors) + for (auto & pr : map) + pr.second->customSetup(exec_type); +} + void SubProblem::residualSetup() { diff --git a/framework/src/systems/AuxiliarySystem.C b/framework/src/systems/AuxiliarySystem.C index 344b76b4f84b..5fdb97c3c8b0 100644 --- a/framework/src/systems/AuxiliarySystem.C +++ b/framework/src/systems/AuxiliarySystem.C @@ -138,6 +138,24 @@ AuxiliarySystem::timestepSetup() } } +void +AuxiliarySystem::customSetup(const ExecFlagType & exec_type) +{ + SystemBase::customSetup(exec_type); + + for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++) + { + _aux_scalar_storage.customSetup(exec_type, tid); + _nodal_aux_storage.customSetup(exec_type, tid); + _mortar_nodal_aux_storage.customSetup(exec_type, tid); + _nodal_vec_aux_storage.customSetup(exec_type, tid); + _nodal_array_aux_storage.customSetup(exec_type, tid); + _elemental_aux_storage.customSetup(exec_type, tid); + _elemental_vec_aux_storage.customSetup(exec_type, tid); + _elemental_array_aux_storage.customSetup(exec_type, tid); + } +} + void AuxiliarySystem::subdomainSetup() { diff --git a/framework/src/systems/NonlinearSystemBase.C b/framework/src/systems/NonlinearSystemBase.C index 4d6b06d6ccb5..9adab97d3c77 100644 --- a/framework/src/systems/NonlinearSystemBase.C +++ b/framework/src/systems/NonlinearSystemBase.C @@ -387,6 +387,60 @@ NonlinearSystemBase::timestepSetup() _nodal_bcs.timestepSetup(); } +void +NonlinearSystemBase::customSetup(const ExecFlagType & exec_type) +{ + SystemBase::customSetup(exec_type); + + for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++) + { + _kernels.customSetup(exec_type, tid); + _nodal_kernels.customSetup(exec_type, tid); + _dirac_kernels.customSetup(exec_type, tid); + if (_doing_dg) + _dg_kernels.customSetup(exec_type, tid); + _interface_kernels.customSetup(exec_type, tid); + _element_dampers.customSetup(exec_type, tid); + _nodal_dampers.customSetup(exec_type, tid); + _integrated_bcs.customSetup(exec_type, tid); + + if (_fe_problem.haveFV()) + { + std::vector bcs; + _fe_problem.theWarehouse() + .query() + .template condition("FVFluxBC") + .template condition(tid) + .queryInto(bcs); + + std::vector iks; + _fe_problem.theWarehouse() + .query() + .template condition("FVInterfaceKernel") + .template condition(tid) + .queryInto(iks); + + std::vector kernels; + _fe_problem.theWarehouse() + .query() + .template condition("FVFluxKernel") + .template condition(tid) + .queryInto(kernels); + + for (auto * bc : bcs) + bc->customSetup(exec_type); + for (auto * ik : iks) + ik->customSetup(exec_type); + for (auto * kernel : kernels) + kernel->customSetup(exec_type); + } + } + _scalar_kernels.customSetup(exec_type); + _constraints.customSetup(exec_type); + _general_dampers.customSetup(exec_type); + _nodal_bcs.customSetup(exec_type); +} + void NonlinearSystemBase::setDecomposition(const std::vector & splits) { diff --git a/framework/src/systems/SystemBase.C b/framework/src/systems/SystemBase.C index f5522a7f50df..0226638ca7a5 100644 --- a/framework/src/systems/SystemBase.C +++ b/framework/src/systems/SystemBase.C @@ -1564,6 +1564,13 @@ SystemBase::timestepSetup() _vars[tid].timestepSetup(); } +void +SystemBase::customSetup(const ExecFlagType & exec_type) +{ + for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++) + _vars[tid].customSetup(exec_type); +} + void SystemBase::subdomainSetup() { diff --git a/framework/src/variables/VariableWarehouse.C b/framework/src/variables/VariableWarehouse.C index 314162e4abcc..d245dd6a4e60 100644 --- a/framework/src/variables/VariableWarehouse.C +++ b/framework/src/variables/VariableWarehouse.C @@ -258,6 +258,13 @@ VariableWarehouse::timestepSetup() pair.second->timestepSetup(); } +void +VariableWarehouse::customSetup(const ExecFlagType & exec_type) +{ + for (auto & pair : _all_objects) + pair.second->customSetup(exec_type); +} + void VariableWarehouse::subdomainSetup() { From 6184c4ab56fe3c4081aaec84c93e315720dfd7bf Mon Sep 17 00:00:00 2001 From: Yaqi Wang Date: Wed, 7 Sep 2022 21:15:51 -0500 Subject: [PATCH 2/4] use the new setup function for a testing postprocessor (a better implementation) #22006 --- test/include/postprocessors/TestPostprocessor.h | 8 +++++--- test/src/postprocessors/TestPostprocessor.C | 10 +++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/test/include/postprocessors/TestPostprocessor.h b/test/include/postprocessors/TestPostprocessor.h index 00794885fcde..3cb6304d44f1 100644 --- a/test/include/postprocessors/TestPostprocessor.h +++ b/test/include/postprocessors/TestPostprocessor.h @@ -32,15 +32,17 @@ class TestPostprocessor : public GeneralPostprocessor * These methods are intentionally empty */ virtual ~TestPostprocessor(){}; - virtual void initialize(){}; - virtual void execute(){}; + virtual void initialize() override {} + virtual void execute() override {} ///@} + virtual void customSetup(const ExecFlagType & exec_type) override; + /** * Returns the postprocessor depending on the 'test_type' parameter * @return The postprocessor value */ - virtual Real getValue(); + virtual Real getValue() override; private: /// Type of testing action to perform diff --git a/test/src/postprocessors/TestPostprocessor.C b/test/src/postprocessors/TestPostprocessor.C index 00d8f10fd744..f3ddd26119ab 100644 --- a/test/src/postprocessors/TestPostprocessor.C +++ b/test/src/postprocessors/TestPostprocessor.C @@ -42,6 +42,13 @@ TestPostprocessor::TestPostprocessor(const InputParameters & parameters) _execute_count = 0; } +void +TestPostprocessor::customSetup(const ExecFlagType & exec_type) +{ + if (exec_type == EXEC_JUST_GO) + _console << "Flag Name: " << EXEC_JUST_GO << std::endl; +} + Real TestPostprocessor::getValue() { @@ -63,10 +70,7 @@ TestPostprocessor::getValue() return _report_old; else if (_test_type == "custom_execute_on") - { - _console << "Flag Name: " << EXEC_JUST_GO << std::endl; return ++_execute_count; - } // This should not be attainable else { From 2f5c0e649bd7640f1b810a5348369579b65c14ee Mon Sep 17 00:00:00 2001 From: Yaqi Wang Date: Thu, 8 Sep 2022 21:02:50 -0500 Subject: [PATCH 3/4] do not call setup in execute for several flags for now because we have special setup functions for those flags in SetupInterface #22006 --- framework/src/problems/FEProblemBase.C | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/framework/src/problems/FEProblemBase.C b/framework/src/problems/FEProblemBase.C index cfdd1bef8f64..a21e90e83f92 100644 --- a/framework/src/problems/FEProblemBase.C +++ b/framework/src/problems/FEProblemBase.C @@ -3819,7 +3819,11 @@ FEProblemBase::execute(const ExecFlagType & exec_type) executeControls(exec_type); // intentially call this after executing controls because the setups may rely on the controls - customSetup(exec_type); + // FIXME: we skip the following flags because they have dedicated setup functions in + // SetupInterface and it may not be appropriate to call them here. + if (!(exec_type == EXEC_INITIAL || exec_type == EXEC_TIMESTEP_BEGIN || + exec_type == EXEC_SUBDOMAIN || exec_type == EXEC_NONLINEAR || exec_type == EXEC_LINEAR)) + customSetup(exec_type); // Samplers; EXEC_INITIAL is not called because the Sampler::init() method that is called after // construction makes the first Sampler::execute() call. This ensures that the random number From 47bf740f71c01ef895e72b00d978c89da9689af4 Mon Sep 17 00:00:00 2001 From: Yaqi Wang Date: Thu, 8 Sep 2022 22:35:35 -0500 Subject: [PATCH 4/4] add documentation for this new setup function in SetupInterface #22006 --- .../source/interfaces/SetupInterface.md | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/framework/doc/content/source/interfaces/SetupInterface.md b/framework/doc/content/source/interfaces/SetupInterface.md index f693c054ec32..ab20274636d6 100644 --- a/framework/doc/content/source/interfaces/SetupInterface.md +++ b/framework/doc/content/source/interfaces/SetupInterface.md @@ -43,6 +43,20 @@ complete list of execution flags is provided by MOOSE are listed in the "registe !listing framework/src/base/MooseApp.C start=MooseApp::registerExecFlags() end=void +The default value of "execute_on" is *linear* for most of MOOSE objects with the exception of: + +- The auxiliary kernels have the default value of *linear* and *timestep_end*. +- The postprocessors have default value of *timestep_end*. +- The controls have default value of *initial* and *timestep_end*. +- The multi-apps have default value of *timestep_begin*. +- The user objects have default value of *timestep_end*. +- The outputs have default value of *initial* and *timestep_end*. +- The default value for a transfer is set to be the same as the execute_on value of its corresponding sub-application. + +Several objects in the framework have custom or selected default "execute_on". +The default value for all objects including objects in MOOSE modules and MOOSE-based +applications can be found in their parameter list. + ## Modifying Execute On When creating objects that inherit from SetupInterface it is possible to set, add, or remove @@ -75,8 +89,8 @@ The SetupInterface includes virtual methods that correspond to the primary execu with MOOSE, these methods are listed in the header as shown here. !listing framework/include/interfaces/SetupInterface.h - start=~SetupInterface() - end=subdomainSetup + start=static InputParameters validParams() + end=customSetup include-end=True include-start=False strip-leading-whitespace=True @@ -89,6 +103,14 @@ A few of the methods were created prior to the execute flags, thus the names do they remain as is to keep the API consistent: the "jacobianSetup" methods is called prior to the "NONLINEAR" execute flag and the "residualSetup" is called prior to the "LINEAR" execute flag. +There is also a generic setup function "customSetup" that takes an execute flag as the argument. +This function is called by MOOSE when performing evaluations of objects on the custom execute flags +in [Creating Custom Execute Flags](#creating-custom-execute-flags). + +!alert warning title=Note on the "customSetup" function +This function is not called on *initial*, *timestep_begin*, *subdomain*, *nonlinear* and *linear*. +Setup operations for those execute flags should be implemented in *initialSetup*, *timestepSetup*, +*subdomainSetup*, *jacobianSetup* and *residualSetup* functions respectively. ## Creating Custom Execute Flags