11#ifndef CL_FEM_CONTROLLER_HPP
12#define CL_FEM_CONTROLLER_HPP
41 Kernel * mKernel = nullptr ;
43 Mesh * mMesh = nullptr ;
44 Kernel * mKernel2 = nullptr ;
46 Mesh * mMesh2 = nullptr ;
65 uint mRunningTimeStep = 0 ;
66 uint mMeshTimeStep = 1 ;
78 uint mMinNumIterations = 2 ;
79 uint mMaxNumIterations = 100 ;
80 uint mIterationTarget = 20 ;
89 uint mDivergenceStrikes = 0 ;
101 uint mStallWindow = 5 ;
102 real mStallBand = 0.2 ;
110 uint mWatchdogWindow = 30 ;
111 uint mWatchdogWindow2 = 30 ;
122 uint mMinNumIterations2 = 2 ;
123 uint mMaxNumIterations2 = 100 ;
124 uint mIterationTarget2 = 20 ;
126 uint mMaxNumIterationsDiv = 10 ;
127 uint mNumIterationsDiv = 0;
137 bool mComputeConditioning = false ;
138 bool mComputeConditioning2 = false ;
146 bool mMumpsErrorAnalysis = false ;
147 bool mMumpsErrorAnalysis2 = false ;
151 bool mThermalDiagnosticsChecked = false ;
157 bool mParamsSet = false ;
167 real mOmegaNoiseBand = 0.05 ;
191 uint mNewtonTrustStreak = 0 ;
193 real mEpsilonSwitch = 1e-4 ;
194 real mRelativeEpsilonTarget = 1e-6 ;
199 real mAbsoluteEpsilonTarget = 0.0 ;
201 real mEpsilonSwitch2 = 1e-3 ;
202 real mRelativeEpsilonTarget2 = 1e-6 ;
203 real mAbsoluteEpsilonTarget2 = 0.0 ;
217 bool mThermalFrozen = false ;
220 bool mAdaptTimestep = true ;
221 real mSaveEvery = 0.0 ;
222 bool mLastSave = false ;
227 real mOmegaNewton = 1.0 ;
228 real mOmegaPicard = 1.0 ;
229 real mOmegaNewton2 = 1.0 ;
230 real mOmegaPicard2 = 1.0 ;
231 bool mJustPicard = false ;
232 bool mJustPicard2 = false ;
236 uint mThermalFlipCount = 0 ;
242 uint mAndersonDepth = 0 ;
243 uint mAndersonDepth2 = 0 ;
250 uint mAndersonCommits = 0 ;
251 uint mAndersonCommits2 = 0 ;
259 bool mForceNewton = false ;
260 bool mNewtonEscalated = false ;
269 bool mForceNewton2 = false ;
270 bool mNewtonEscalated2 = false ;
280 real mOmegaMin = 0.001 ;
281 real mOmegaMax = 1.0 ;
282 real mOmegaMin2 = 0.1 ;
283 real mOmegaMax2 = 1.0 ;
287 Timer * mTimer = nullptr ;
313 uint mThermalFlatCount = 0 ;
314 bool mThermalStalled = false ;
322 bool mMagneticHitTarget = false ;
329 bool mMagBodyRanLastTrip = true ;
331 bool mTripExit = false ;
337 uint mBestEpsilonIteration = 0 ;
338 uint mBestEpsilonIteration2 = 0 ;
344 uint mSolverFailCount = 0 ;
350 bool mUseLegacyTimestepControl = false ;
358 real mCtrlKp = 0.15 ;
359 real mCtrlKi = 0.30 ;
366 real mCtrlErr0 = 1.0 ;
367 real mCtrlErr1 = 1.0 ;
368 real mCtrlErr2 = 1.0 ;
376 uint mPostFailureHold = 0 ;
377 uint mPostFailureHoldSteps = 2 ;
384 uint mFloorRetries = 0 ;
385 uint mFloorEscalationCap = 4 ;
394 uint mMaxFloorRetries = 20 ;
399 enum class ResetReason
415 bool mStallSuspended = false ;
419 uint mMaxNumIterationsDeck = 100 ;
420 uint mMaxNumIterations2Deck = 100 ;
421 uint mWatchdogWindowDeck = 30 ;
422 uint mWatchdogWindow2Deck = 30 ;
429 bool mAllowRestart = true ;
432 uint mIteration = 0 ;
433 uint mIteration2 = 0 ;
434 uint mIterationTime = 0 ;
435 uint mIteration0 = 0 ;
436 uint mIteration02 = 0 ;
437 uint mEigenAnalysisTime = 0 ;
438 uint mPostprocesingTime = 0 ;
465 real mDeltaTimeMin = 1e-10 ;
466 bool mReset = false ;
467 bool mResetThermal = false ;
468 bool mFirstFlip = false ;
469 bool mFirstFlip2 = false ;
471 bool mIsFullyCoupled = true ;
472 real mCouplingFactor = 1 ;
475 Cell < PhysicalBoundaryCondition * > mCircuitCurrentBCs ;
476 Cell < PhysicalBoundaryCondition * > mCircuitVoltageBCs ;
480 bool mFirstIVSave = true ;
494 real mLastJJcMax = 0. ;
500 bool mBoxSectionOpen = false ;
506 bool mPostProcessed = false ;
541 finalize(
const bool aPostProcess =
true );
563 save(
const std::string & aFilename );
566 save_IV(
const std::string & aFilename );
628 impose_voltage_bcs();
636 dump_system_if_requested(
DofManager * aDofMgr,
643 int mDumpCountMagnetic = 0 ;
644 int mDumpCountThermal = 0 ;
651 magnetic_stagnation_forces_reset();
666 watchdog_magnetic(
const real aOmega );
669 watchdog_thermal(
const real aOmega );
675 void anderson_commit_magnetic();
676 void anderson_discard_magnetic();
677 void anderson_clear_magnetic();
678 void anderson_commit_thermal();
679 void anderson_clear_thermal();
688 try_escalate_to_newton();
695 try_escalate_thermal_to_newton();
698 reset_timestep(
const ResetReason aReason );
707 compute_circuit_current() ;
710 compute_conditioning();
727 arm_conditioning_magnetic();
730 arm_conditioning_thermal();
733 capture_conditioning_magnetic();
736 capture_conditioning_thermal();
743 setup_thermal_eigen();
751 check_magnetic_diagnostics();
755 check_thermal_diagnostics();
776 check_iterative_solver_headroom(
778 const real aNonlinTol,
779 const char * aFieldName )
const ;
794 check_compression_headroom(
796 const real aNonlinTol,
797 const char * aFieldName )
const ;
809 synchronize_history_fields(
812 const uint aStepCount,
813 const string & aPath,
814 const char * aEquationName );
824 print_line_magnetic(
const real aEpsilon,
const real aOmega );
827 print_line_thermal(
const real aEpsilon,
const real aOmega );
836 print_thermal_stall_warning();
858 print_physics_stats();
893 return mTimeStepping;
Definition cl_Circuit.hpp:20
Top-level container for all mesh entities.
Definition cl_Mesh.hpp:60
High-resolution wall-clock timing.
Definition cl_Timer.hpp:28
void create_iv_names()
names the I/U pair of every abstract dof: after the deck label of the terminal condition that drives ...
Definition cl_FEM_Controller.cpp:4028
void solve_thermal()
Definition cl_FEM_Controller.cpp:2037
EulerMethod euler_method() const
Definition cl_FEM_Controller.hpp:891
void set_circuit(Circuit *aCircuit)
Definition cl_FEM_Controller.cpp:5060
Kernel * thermal_kernel()
Definition cl_FEM_Controller.hpp:884
const real & time() const
Definition cl_FEM_Controller.cpp:143
bool is_fullycoupled() const
Definition cl_FEM_Controller.cpp:3986
void save_IV(const std::string &aFilename)
Definition cl_FEM_Controller.cpp:4119
void save(const std::string &aFilename)
Definition cl_FEM_Controller.cpp:3998
void solve_magnetic()
Definition cl_FEM_Controller.cpp:2016
bool reset() const
Definition cl_FEM_Controller.cpp:3992
Controller(Kernel *aKernel, Kernel *aKernel2=nullptr)
Definition cl_FEM_Controller.cpp:76
const real & time_thermal() const
Definition cl_FEM_Controller.cpp:149
real simulation_time() const
Definition cl_FEM_Controller.cpp:5030
void initialize_magnetic()
Definition cl_FEM_Controller.cpp:320
void set_params(const input::Section *aSection)
Definition cl_FEM_Controller.cpp:4226
void save_memdump(const string &aPath)
Definition cl_FEM_Controller.cpp:5156
void set_thermal_kernel(Kernel *aKernel)
Definition cl_FEM_Controller.cpp:4967
void initialize_thermal()
Definition cl_FEM_Controller.cpp:422
bool solve_circuit()
Definition cl_FEM_Controller.cpp:2523
Kernel * kernel()
Definition cl_FEM_Controller.hpp:877
real epsilon() const
Definition cl_FEM_Controller.cpp:155
uint iteration() const
Definition cl_FEM_Controller.cpp:161
void initialize_timestep()
Definition cl_FEM_Controller.cpp:167
Circuit * circuit()
Definition cl_FEM_Controller.hpp:870
void load_memdump(const string &aPath)
Definition cl_FEM_Controller.cpp:5245
void finalize(const bool aPostProcess=true)
Definition cl_FEM_Controller.cpp:3028
void solve_coupled()
Definition cl_FEM_Controller.cpp:950
Main workhorse: DOF management, assembly coordination and the solver interface.
Definition cl_FEM_DofManager.hpp:52
Base class for transient problems.
Definition cl_IWG_Timestep.hpp:33
Top-level orchestrator.
Definition cl_FEM_Kernel.hpp:56
Definition cl_IFB_LINE3.hpp:21
SolverAlgorithm
Definition en_FEM_SolverAlgorithm.hpp:20
@ Picard
Definition en_FEM_SolverAlgorithm.hpp:23
USER GUIDES:
Definition cl_Capacitor.cpp:16
EulerMethod
Definition en_SolverEnums.hpp:47
@ BackwardDifference1
Definition en_SolverEnums.hpp:52
unsigned int uint
Definition typedefs.hpp:30
int proc_t
Definition commtypes.hpp:29
double real
Definition typedefs.hpp:36
#define BELFEM_REAL_MAX
Definition typedefs.hpp:80
#define BELFEM_QUIET_NAN
Definition typedefs.hpp:86