Skip to content

Commit

Permalink
Add and fix some Dynamic simulation solvers parameters.
Browse files Browse the repository at this point in the history
Signed-off-by: Gautier Bureau <[email protected]>
  • Loading branch information
gautierbureau committed Nov 8, 2023
1 parent 0022dd9 commit 2935126
Show file tree
Hide file tree
Showing 3 changed files with 190 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,50 @@ public class IdaSolverInfos extends AbstractSolverInfos {
private double absAccuracy;

private double relAccuracy;

private double fnormtolAlg;

private double initialaddtolAlg;

private double scsteptolAlg;

private double mxnewtstepAlg;

private int msbsetAlg;

private int mxiterAlg;

private int printflAlg;

private double fnormtolAlgJ;

private double initialaddtolAlgJ;

private double scsteptolAlgJ;

private double mxnewtstepAlgJ;

private int msbsetAlgJ;

private int mxiterAlgJ;

private int printflAlgJ;

private double fnormtolAlgInit;

private double initialaddtolAlgInit;

private double scsteptolAlgInit;

private double mxnewtstepAlgInit;

private int msbsetAlgInit;

private int mxiterAlgInit;

private int printflAlgInit;

private int maximumNumberSlowStepIncrease;

private double minimalAcceptableStep;
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,95 @@
@Setter
public class SimSolverInfos extends AbstractSolverInfos {

public static final String H_MIN = "hMin";
public static final String H_MAX = "hMax";
public static final String K_REDUCE_STEP = "kReduceStep";

// Important note: must using @JsonProperty to precise property's name when serialize/deserialize
// fields which begin by a minuscule following by a majuscule, for example 'hMxxx', otherwise jackson
// mapper will serialize as 'hmxxx' by default
@JsonProperty("hMin")
@JsonProperty(H_MIN)
private double hMin;

@JsonProperty("hMax")
@JsonProperty(H_MAX)
private double hMax;

@JsonProperty("kReduceStep")
@JsonProperty(K_REDUCE_STEP)
private double kReduceStep;

@JsonProperty("nEff")
private int nEff;
private int maxNewtonTry;

@JsonProperty("nDeadband")
private int nDeadband;
private String linearSolverName;

private int maxRootRestart;
private double fnormtol;

private int maxNewtonTry;
private double initialaddtol;

private String linearSolverName;
private double scsteptol;

private double mxnewtstep;

private int msbset;

private int mxiter;

private int printfl;

private boolean optimizeAlgebraicResidualsEvaluations;

private boolean skipNRIfInitialGuessOK;

private boolean enableSilentZ;

private boolean optimizeReinitAlgebraicResidualsEvaluations;

private String minimumModeChangeTypeForAlgebraicRestoration;

private String minimumModeChangeTypeForAlgebraicRestorationInit;

private double fnormtolAlg;

private double initialaddtolAlg;

private double scsteptolAlg;

private double mxnewtstepAlg;

private int msbsetAlg;

private int mxiterAlg;

private int printflAlg;

private double fnormtolAlgJ;

private double initialaddtolAlgJ;

private double scsteptolAlgJ;

private double mxnewtstepAlgJ;

private int msbsetAlgJ;

private int mxiterAlgJ;

private int printflAlgJ;

private double fnormtolAlgInit;

private double initialaddtolAlgInit;

private double scsteptolAlgInit;

private double mxnewtstepAlgInit;

private int msbsetAlgInit;

private int mxiterAlgInit;

private int printflAlgInit;

private int maximumNumberSlowStepIncrease;

private boolean recalculateStep;
private double minimalAcceptableStep;
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,27 +92,82 @@ static DynamicSimulationParametersInfos fromEntity(DynamicSimulationParametersEn
static DynamicSimulationParametersInfos getDefaultDynamicSimulationParameters() {
// these parameters are taken from solver.par file in dynamic simulation server
IdaSolverInfos idaSolver = new IdaSolverInfos();
idaSolver.setId("1");
idaSolver.setId("IDA");
idaSolver.setType(SolverTypeInfos.IDA);
idaSolver.setOrder(1);
idaSolver.setInitStep(0.000001);
idaSolver.setMinStep(0.000001);
idaSolver.setOrder(2);
idaSolver.setInitStep(1.e-7);
idaSolver.setMinStep(1.e-7);
idaSolver.setMaxStep(10);
idaSolver.setAbsAccuracy(0.0001);
idaSolver.setRelAccuracy(0.0001);
idaSolver.setAbsAccuracy(1.e-4);
idaSolver.setRelAccuracy(1.e-4);
idaSolver.setFnormtolAlg(1.e-4);
idaSolver.setInitialaddtolAlg(1);
idaSolver.setScsteptolAlg(1.e-4);
idaSolver.setMxnewtstepAlg(10000);
idaSolver.setMsbsetAlg(5);
idaSolver.setMxiterAlg(30);
idaSolver.setPrintflAlg(0);
idaSolver.setFnormtolAlgJ(1.e-4);
idaSolver.setInitialaddtolAlgJ(1);
idaSolver.setScsteptolAlgJ(1.e-4);
idaSolver.setMxnewtstepAlgJ(10000);
idaSolver.setMsbsetAlgJ(1);
idaSolver.setMxiterAlgJ(50);
idaSolver.setPrintflAlgJ(0);
idaSolver.setFnormtolAlgInit(1.e-4);
idaSolver.setInitialaddtolAlgInit(1);
idaSolver.setScsteptolAlgInit(1.e-4);
idaSolver.setMxnewtstepAlgInit(10000);
idaSolver.setMsbsetAlgInit(1);
idaSolver.setMxiterAlgInit(50);
idaSolver.setPrintflAlgInit(0);
idaSolver.setMinimalAcceptableStep(1.e-8);
idaSolver.setMaximumNumberSlowStepIncrease(40);

SimSolverInfos simSolver = new SimSolverInfos();
simSolver.setId("3");
simSolver.setId("SIM");
simSolver.setType(SolverTypeInfos.SIM);
simSolver.setHMin(0.000001);
simSolver.setHMin(0.001);
simSolver.setHMax(1);
simSolver.setKReduceStep(0.5);
simSolver.setNEff(10);
simSolver.setNDeadband(2);
simSolver.setMaxRootRestart(3);
simSolver.setMaxNewtonTry(10);
simSolver.setLinearSolverName("KLU");
simSolver.setRecalculateStep(false);
simSolver.setFnormtol(1.e-3);
simSolver.setInitialaddtol(1);
simSolver.setScsteptol(1.e-3);
simSolver.setMxnewtstep(10000);
simSolver.setMsbset(0);
simSolver.setMxiter(15);
simSolver.setPrintfl(0);
simSolver.setOptimizeAlgebraicResidualsEvaluations(true);
simSolver.setSkipNRIfInitialGuessOK(true);
simSolver.setEnableSilentZ(true);
simSolver.setOptimizeReinitAlgebraicResidualsEvaluations(true);
simSolver.setMinimumModeChangeTypeForAlgebraicRestoration("ALGEBRAIC_J_UPDATE");
simSolver.setMinimumModeChangeTypeForAlgebraicRestorationInit("ALGEBRAIC_J_UPDATE");
simSolver.setFnormtolAlg(1.e-3);
simSolver.setInitialaddtolAlg(1);
simSolver.setScsteptolAlg(1.e-3);
simSolver.setMxnewtstepAlg(10000);
simSolver.setMsbsetAlg(5);
simSolver.setMxiterAlg(30);
simSolver.setPrintflAlg(0);
simSolver.setFnormtolAlgJ(1.e-3);
simSolver.setInitialaddtolAlgJ(1);
simSolver.setScsteptolAlgJ(1.e-3);
simSolver.setMxnewtstepAlgJ(10000);
simSolver.setMsbsetAlgJ(1);
simSolver.setMxiterAlgJ(50);
simSolver.setPrintflAlgJ(0);
simSolver.setFnormtolAlgInit(1.e-3);
simSolver.setInitialaddtolAlgInit(1);
simSolver.setScsteptolAlgInit(1.e-3);
simSolver.setMxnewtstepAlgInit(10000);
simSolver.setMsbsetAlgInit(1);
simSolver.setMxiterAlgInit(50);
simSolver.setPrintflAlgInit(0);
simSolver.setMinimalAcceptableStep(1.e-3);
simSolver.setMaximumNumberSlowStepIncrease(40);

List<SolverInfos> solvers = List.of(idaSolver, simSolver);

Expand Down

0 comments on commit 2935126

Please sign in to comment.