Skip to content

Commit

Permalink
improving analytic jacobian flags
Browse files Browse the repository at this point in the history
  • Loading branch information
Willi Braun committed Feb 14, 2016
1 parent 7589199 commit c343375
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Compiler/BackEnd/SymbolicJacobian.mo
Expand Up @@ -2324,7 +2324,7 @@ protected function checkForSymbolicJacobian
protected
Boolean b1, b2;
algorithm
if not Flags.isSet(Flags.NLS_ANALYTIC_JACOBIAN) then
if not Flags.isSet(Flags.FORCE_NLS_ANALYTIC_JACOBIAN) then
(b1, _) := BackendEquation.traverseExpsOfEquationList_WithStop(inResidualEqns, traverserhasEqnNonDiffParts, ({}, true, false));
(b2, _) := BackendEquation.traverseExpsOfEquationList_WithStop(inOtherEqns, traverserhasEqnNonDiffParts, ({}, true, false));
if not (b1 and b2) then
Expand Down Expand Up @@ -2393,7 +2393,7 @@ algorithm

case (BackendDAE.TORNSYSTEM(BackendDAE.TEARINGSET(tearingvars=iterationvarsInts, residualequations=residualequations, otherEqnVarTpl=otherEqnVarTpl), NONE(), linear=false, mixedSystem=mixedSystem), _, _, _)
equation
false = Flags.isSet(Flags.DISABLE_NLS_ANALYTIC_JACOBIAN);
true = Flags.isSet(Flags.NLS_ANALYTIC_JACOBIAN);

// generate jacobian name
name = "NLSJac" + intString(System.tmpTickIndex(Global.backendDAE_jacobianSeq));
Expand All @@ -2417,7 +2417,7 @@ algorithm
// dynamic tearing
case (BackendDAE.TORNSYSTEM(BackendDAE.TEARINGSET(tearingvars=iterationvarsInts, residualequations=residualequations, otherEqnVarTpl=otherEqnVarTpl), SOME(BackendDAE.TEARINGSET(tearingvars=iterationvarsInts2, residualequations=residualequations2, otherEqnVarTpl=otherEqnVarTpl2)), linear=b, mixedSystem=mixedSystem), _, _, _)
equation
true = (Flags.isSet(Flags.NLS_ANALYTIC_JACOBIAN) and not b) or b;
true = (not Flags.isSet(Flags.NLS_ANALYTIC_JACOBIAN) and not b) or b;

// Get Jacobian for strict tearing set

Expand Down Expand Up @@ -2465,7 +2465,7 @@ algorithm

case (BackendDAE.EQUATIONSYSTEM(eqns=residualequations, vars=iterationvarsInts, mixedSystem=mixedSystem), _, _, _)
equation
false = Flags.isSet(Flags.DISABLE_NLS_ANALYTIC_JACOBIAN);
true = Flags.isSet(Flags.NLS_ANALYTIC_JACOBIAN);
//generate jacobian name
name = "NLSJac" + intString(System.tmpTickIndex(Global.backendDAE_jacobianSeq));

Expand Down
12 changes: 6 additions & 6 deletions Compiler/Util/Flags.mo
Expand Up @@ -335,8 +335,8 @@ constant DebugFlag PEDANTIC = DEBUG_FLAG(84, "pedantic", false,
Util.gettext("Switch into pedantic debug-mode, to get much more feedback."));
constant DebugFlag SHOW_EQUATION_SOURCE = DEBUG_FLAG(85, "showEquationSource", false,
Util.gettext("Display the element source information in the dumped DAE for easier debugging."));
constant DebugFlag NLS_ANALYTIC_JACOBIAN = DEBUG_FLAG(86, "NLSanalyticJacobian", false,
Util.gettext("Enables analytical jacobian for all non-linear strong components."));
constant DebugFlag NLS_ANALYTIC_JACOBIAN = DEBUG_FLAG(86, "NLSanalyticJacobian", true,
Util.gettext("Enables analytical jacobian for non-linear strong components without user-defined function calls, for that see forceNLSanalyticJacobian"));
constant DebugFlag INLINE_SOLVER = DEBUG_FLAG(87, "inlineSolver", false,
Util.gettext("Generates code for inline solver."));
constant DebugFlag HPCOM = DEBUG_FLAG(88, "hpcom", false,
Expand Down Expand Up @@ -478,8 +478,8 @@ constant DebugFlag DEBUG_ALGLOOP_JACOBIAN = DEBUG_FLAG(154, "debugAlgebraicLoops
Util.gettext("Dumps debug output while creating symbolic jacobians for non-linear systems."));
constant DebugFlag DISABLE_JACSCC = DEBUG_FLAG(155, "disableJacsforSCC", false,
Util.gettext("Disables calculation of jacobians to detect if a SCC is linear or non-linear. By disabling all SCC will handled like non-linear."));
constant DebugFlag DISABLE_NLS_ANALYTIC_JACOBIAN = DEBUG_FLAG(156, "NLSanalyticJacobianDisable", false,
Util.gettext("Disables analytical jacobian for all non-linear strong components for the sake of performance."));
constant DebugFlag FORCE_NLS_ANALYTIC_JACOBIAN = DEBUG_FLAG(156, "forceNLSanalyticJacobian", false,
Util.gettext("Forces calculation analytical jacobian also for non-linear strong components with user-defined functions."));

// This is a list of all debug flags, to keep track of which flags are used. A
// flag can not be used unless it's in this list, and the list is checked at
Expand Down Expand Up @@ -642,7 +642,7 @@ constant list<DebugFlag> allDebugFlags = {
DUMP_EXCLUDED_EXP,
DEBUG_ALGLOOP_JACOBIAN,
DISABLE_JACSCC,
DISABLE_NLS_ANALYTIC_JACOBIAN
FORCE_NLS_ANALYTIC_JACOBIAN
};

public
Expand Down Expand Up @@ -811,7 +811,7 @@ constant ConfigFlag POST_OPT_MODULES = CONFIG_FLAG(16, "postOptModules",
("addScaledVars_inputs", Util.notrans("added var_norm = var/nominal, where var is input")),
("addTimeAsState", Util.gettext("Experimental feature: this replaces each occurrence of variable time with a new introduced state $time with equation der($time) = 1.0")),
("calculateStateSetsJacobians", Util.gettext("Generates analytical jacobian for dynamic state selection sets.")),
("calculateStrongComponentJacobians", Util.gettext("Generates analytical jacobian for torn linear and non-linear strong components. By default non-linear components with user-defined function calls are skipped. See also debug flags: NLSanalyticJacobian and NLSanalyticJacobianDisable")),
("calculateStrongComponentJacobians", Util.gettext("Generates analytical jacobian for torn linear and non-linear strong components. By default non-linear components with user-defined function calls are skipped. See also debug flags: NLSanalyticJacobian and forceNLSanalyticJacobian")),
("constantLinearSystem", Util.gettext("Evaluates constant linear systems (a*x+b*y=c; d*x+e*y=f; a,b,c,d,e,f are constants) at compile-time.")),
("countOperations", Util.gettext("Count the mathematical operations of the system.")),
("cseBinary", Util.gettext("Common Sub-expression Elimination")),
Expand Down

0 comments on commit c343375

Please sign in to comment.