BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
belfem::gasmodels::Statevals Class Reference

The per state property cache of a Gas. More...

#include <cl_GM_Statevals.hpp>

Public Member Functions

 Statevals ()=default
 ~Statevals ()=default
void update_Tp (const real T, const real p)
 update temperature and pressure
void update_Tv (const real T, const real v)
 update temperature and inverse density
void update_pv (const real p, const real v)
 update pressure and inverse density
void reset ()
 reset all flags of this state
bool test (const index_t aIndex) const
 test if a value is up do date
const realget (const index_t aIndex) const
 get a value of the state
void set (const index_t aIndex, const real aValue)
 set a value of the state

Detailed Description

The per state property cache of a Gas.

A thermodynamic state is fixed by ( T, p ), and the properties that follow from it are expensive - a real gas equation of state solves for v by Newton iteration before anything else can be evaluated. This class holds one value slot per property together with a bit that says whether the slot is valid. Changing the state clears every bit at once, so each property is computed at most once per state and callers may ask for them in any order.

Two consequences are easy to get wrong. A slot that was never written reads as its default rather than as an error, so a property must always be requested through its accessor and never read from the array directly. And anything that invalidates the state without clearing the bits - changing the mixture composition, for instance - leaves the cache holding values that belong to a gas that no longer exists; remix() therefore has to reset it.

Constructor & Destructor Documentation

◆ Statevals()

belfem::gasmodels::Statevals::Statevals ( )
default

◆ ~Statevals()

belfem::gasmodels::Statevals::~Statevals ( )
default

Member Function Documentation

◆ get()

const real & belfem::gasmodels::Statevals::get ( const index_t aIndex) const
inline

get a value of the state

◆ reset()

void belfem::gasmodels::Statevals::reset ( )
inline

reset all flags of this state

◆ set()

void belfem::gasmodels::Statevals::set ( const index_t aIndex,
const real aValue )
inline

set a value of the state

◆ test()

bool belfem::gasmodels::Statevals::test ( const index_t aIndex) const
inline

test if a value is up do date

◆ update_pv()

void belfem::gasmodels::Statevals::update_pv ( const real p,
const real v )
inline

update pressure and inverse density

◆ update_Tp()

void belfem::gasmodels::Statevals::update_Tp ( const real T,
const real p )
inline

update temperature and pressure

◆ update_Tv()

void belfem::gasmodels::Statevals::update_Tv ( const real T,
const real v )
inline

update temperature and inverse density


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