← Documentation
ADS-IDAC Engine 5.0.0
ThermalHydraulicSolver Class Referenceabstract

Abstract interface for thermal-hydraulic solvers. More...

#include <ThermalHydraulicSolver.h>

Inheritance diagram for ThermalHydraulicSolver:
[legend]

Public Member Functions

virtual ~ThermalHydraulicSolver ()=default
 
virtual void runSequence (SolverCallback &cb)=0
 Run one complete simulation sequence. Blocks until the sequence completes. The solver calls back into cb at evaluation points during execution. More...
 
virtual double currentTime () const =0
 Current simulation time [s]. More...
 
virtual int stopFlag () const =0
 RELAP5 stop flag. 0=running, 3=normal end, 11=crash. More...
 
virtual bool isTerminateAll () const =0
 True if all simulation should terminate. More...
 
virtual void setTerminateAll (bool v)=0
 Set the terminate-all flag. More...
 
virtual void setBranchCount (int n)=0
 Set the number of branches generated at the current branching point. More...
 
virtual void setGenNode (bool v)=0
 Signal the solver to generate a restart checkpoint at this point. More...
 
virtual void setNewRestart (bool v)=0
 Set whether this is a fresh start (true) or a restart (false). More...
 
virtual void setInputDeck (const std::string &path)=0
 Set the input deck file path for the next sequence. More...
 
virtual std::vector< char > checkpoint ()=0
 Extract the solver's restart checkpoint as an opaque byte buffer. More...
 
virtual void restore (const std::vector< char > &data)=0
 Restore the solver's state from a buffer returned by checkpoint(). More...
 
virtual void setThermoCacheMode (int mode)=0
 Set thermodynamic table caching mode (RelapSolver; no-op for RestApiSolver). 2 forces a reload of the steam tables at every sequence; any other value (0 is the default) reuses the cached tables when the table set is unchanged. More...
 
virtual void setMembufMode (int mode)=0
 Set in-memory restart buffer mode (RelapSolver; no-op for RestApiSolver). 1=enabled, 0=disabled. The engine always passes 1. More...
 

Detailed Description

Abstract interface for thermal-hydraulic solvers.

Defines the contract for running simulation sequences, querying state, applying interventions, and managing checkpoints. Concrete implementations:

  • RelapSolver: wraps RELAP5/MOD3.3 Fortran code via r5pars_ struct
  • RestApiSolver: HTTP client of an external solver process (the mock solver); writes the responses into the same r5pars_ arrays

Both implementations keep their state in the process-global r5pars_ struct, so at most one solver object is meaningful per process, and none of the methods is thread-safe.

Definition at line 70 of file ThermalHydraulicSolver.h.

Constructor & Destructor Documentation

◆ ~ThermalHydraulicSolver()

virtual ThermalHydraulicSolver::~ThermalHydraulicSolver ( )
virtualdefault

Member Function Documentation

◆ checkpoint()

virtual std::vector< char > ThermalHydraulicSolver::checkpoint ( )
pure virtual

Extract the solver's restart checkpoint as an opaque byte buffer.

RelapSolver returns a copy of the accumulated RELAP5 restart buffer (every restart record the lineage has written). RestApiSolver returns a JSON map from restart count to server-side checkpoint id for the checkpoints taken during the current sequence.

Returns
The buffer, or an empty vector if no checkpoint data is available.

Implemented in RelapSolver, and RestApiSolver.

Referenced by AdsidacCallback::onBranchingPoint().

Here is the caller graph for this function:

◆ currentTime()

virtual double ThermalHydraulicSolver::currentTime ( ) const
pure virtual

Current simulation time [s].

Implemented in RelapSolver, and RestApiSolver.

◆ isTerminateAll()

virtual bool ThermalHydraulicSolver::isTerminateAll ( ) const
pure virtual

True if all simulation should terminate.

Implemented in RelapSolver, and RestApiSolver.

Referenced by AdsidacCallback::restartForNewSequence().

Here is the caller graph for this function:

◆ restore()

virtual void ThermalHydraulicSolver::restore ( const std::vector< char > &  data)
pure virtual

Restore the solver's state from a buffer returned by checkpoint().

An empty data is ignored. The restored state takes effect in the next runSequence(), which restarts at the restart count given on card 103 of indeck.i. RelapSolver loads the buffer into the Fortran restart buffer and calls std::abort() if the buffer lacks a complete restart record and no cached or on-disk base (restart_base.bin) can complete it. RestApiSolver only parses the map; a malformed buffer throws.

Implemented in RelapSolver, and RestApiSolver.

Referenced by AdsidacCallback::restartForNewSequence().

Here is the caller graph for this function:

◆ runSequence()

virtual void ThermalHydraulicSolver::runSequence ( SolverCallback &  cb)
pure virtual

Run one complete simulation sequence. Blocks until the sequence completes. The solver calls back into cb at evaluation points during execution.

Implemented in RelapSolver, and RestApiSolver.

◆ setBranchCount()

virtual void ThermalHydraulicSolver::setBranchCount ( int  n)
pure virtual

Set the number of branches generated at the current branching point.

Implemented in RelapSolver, and RestApiSolver.

◆ setGenNode()

virtual void ThermalHydraulicSolver::setGenNode ( bool  v)
pure virtual

Signal the solver to generate a restart checkpoint at this point.

Implemented in RelapSolver, and RestApiSolver.

◆ setInputDeck()

virtual void ThermalHydraulicSolver::setInputDeck ( const std::string &  path)
pure virtual

Set the input deck file path for the next sequence.

Implemented in RelapSolver, and RestApiSolver.

◆ setMembufMode()

virtual void ThermalHydraulicSolver::setMembufMode ( int  mode)
pure virtual

Set in-memory restart buffer mode (RelapSolver; no-op for RestApiSolver). 1=enabled, 0=disabled. The engine always passes 1.

Implemented in RelapSolver, and RestApiSolver.

◆ setNewRestart()

virtual void ThermalHydraulicSolver::setNewRestart ( bool  v)
pure virtual

Set whether this is a fresh start (true) or a restart (false).

Implemented in RelapSolver, and RestApiSolver.

◆ setTerminateAll()

virtual void ThermalHydraulicSolver::setTerminateAll ( bool  v)
pure virtual

Set the terminate-all flag.

Implemented in RelapSolver, and RestApiSolver.

Referenced by AdsidacCallback::initiationForRestart(), and AdsidacCallback::restartForNewSequence().

Here is the caller graph for this function:

◆ setThermoCacheMode()

virtual void ThermalHydraulicSolver::setThermoCacheMode ( int  mode)
pure virtual

Set thermodynamic table caching mode (RelapSolver; no-op for RestApiSolver). 2 forces a reload of the steam tables at every sequence; any other value (0 is the default) reuses the cached tables when the table set is unchanged.

Implemented in RelapSolver, and RestApiSolver.

◆ stopFlag()

virtual int ThermalHydraulicSolver::stopFlag ( ) const
pure virtual

RELAP5 stop flag. 0=running, 3=normal end, 11=crash.

Implemented in RelapSolver, and RestApiSolver.


The documentation for this class was generated from the following file: