Skip to content

Commit

Permalink
omit analyzePattern for refactorization
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Dinkelbach <jdinkelbach@eonerc.rwth-aachen.de>
  • Loading branch information
dinkelbachjan authored and m-mirz committed Dec 3, 2021
1 parent bac4355 commit 06f8fa0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
7 changes: 7 additions & 0 deletions Include/dpsim/Simulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ namespace DPsim {
/// System list
CPS::SystemTopology mSystem;

/// Start time point to measure calculation time
std::chrono::time_point<std::chrono::steady_clock> mSimulationStartTimePoint;
/// End time point to measure calculation time
std::chrono::time_point<std::chrono::steady_clock> mSimulationEndTimePoint;
/// Measured calculation time for simulation
std::chrono::duration<double> mSimulationCalculationTime;

// #### Logging ####
/// Simulation log level
CPS::Logger::Level mLogLevel;
Expand Down
4 changes: 2 additions & 2 deletions Source/MNASolverEigenSparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ void MnaSolverEigenSparse<VarType>::recomputeSystemMatrix(Real time) {
for (auto comp : mMNAIntfVariableComps)
comp->mnaApplySystemMatrixStamp(mVariableSystemMatrix);

// Calculate factorization of current matrix
mLuFactorizationVariableSystemMatrix.analyzePattern(mVariableSystemMatrix);
// Refactorization of matrix assuming that structure remained
// constant by omitting analyzePattern
mLuFactorizationVariableSystemMatrix.factorize(mVariableSystemMatrix);
}

Expand Down
7 changes: 7 additions & 0 deletions Source/Simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,16 @@ void Simulation::start() {
mLog->info("Start simulation: {}", mName);
mLog->info("Time step: {:e}", mTimeStep);
mLog->info("Final time: {:e}", mFinalTime);

mSimulationStartTimePoint = std::chrono::steady_clock::now();
}

void Simulation::stop() {

mSimulationEndTimePoint = std::chrono::steady_clock::now();
mSimulationCalculationTime = mSimulationEndTimePoint-mSimulationStartTimePoint;
mLog->info("Simulation calculation time: {:.6f}", mSimulationCalculationTime.count());

mScheduler->stop();

for (auto ifm : mInterfaces)
Expand Down

0 comments on commit 06f8fa0

Please sign in to comment.