SPH
Public Member Functions | List of all members
EosMaterial Class Reference

Material holding equation of state. More...

#include <Materials.h>

Inheritance diagram for EosMaterial:
IMaterial Polymorphic SolidMaterial

Public Member Functions

 EosMaterial (const BodySettings &body, AutoPtr< IEos > &&eos)
 Creates the material by specifying an equation of state. More...
 
 EosMaterial (const BodySettings &body)
 Creates the material. More...
 
Pair< Floatevaluate (const Float rho, const Float u) const
 
const IEosgetEos () const
 Returns the equation of state. More...
 
virtual void create (Storage &storage, const MaterialInitialContext &context) override
 Create all quantities needed by the material. More...
 
virtual void initialize (IScheduler &scheduler, Storage &storage, const IndexSequence sequence) override
 Initialize all quantities and material parameters. More...
 
virtual void finalize (IScheduler &UNUSED(scheduler), Storage &UNUSED(storage), const IndexSequence UNUSED(sequence)) override
 
- Public Member Functions inherited from IMaterial
 IMaterial (const BodySettings &settings)
 
template<typename TValue >
INLINE IMaterialsetParam (const BodySettingsId paramIdx, TValue &&value)
 
template<typename TValue >
INLINE TValue getParam (const BodySettingsId paramIdx) const
 Returns a parameter associated with given particle. More...
 
INLINE const BodySettingsgetParams () const
 Returns settings containing material parameters. More...
 
void setRange (const QuantityId id, const Interval &range, const Float minimal)
 Sets the timestepping parameters of given quantity. More...
 
INLINE void setRange (const QuantityId id, const BodySettingsId rangeId, const BodySettingsId minimalId)
 Sets the timestepping parameters of given quantity. More...
 
INLINE Float minimal (const QuantityId id) const
 Returns the scale value of the quantity. More...
 
INLINE const Interval range (const QuantityId id) const
 Returns the range of allowed quantity values. More...
 
virtual void finalize (IScheduler &scheduler, Storage &storage, const IndexSequence sequence)=0
 Finalizes the material for the time step. More...
 
- Public Member Functions inherited from Polymorphic
virtual ~Polymorphic ()
 

Additional Inherited Members

- Protected Attributes inherited from IMaterial
BodySettings params
 Per-material parameters. More...
 
FlatMap< QuantityId, Floatminimals
 Minimal values used in timestepping, do not affect values of quantities themselves. More...
 
FlatMap< QuantityId, Intervalranges
 Allowed range of quantities. More...
 
- Static Protected Attributes inherited from IMaterial
static const Interval DEFAULT_RANGE = Interval::unbounded()
 Default values. More...
 
static const Float DEFAULT_MINIMAL = 0._f
 

Detailed Description

Material holding equation of state.

Pressure and sound speed are computed in initialize function, so the EoS does not have to be evaluated manually. If this is necessary for some reason (when setting pressure-dependent initial conditions or checking if we selected correct EoS, for example), functions evaluate and getEos can be used. This is not part of the IMaterial interface, so dynamic_cast have to be used to access it.

Definition at line 21 of file Materials.h.

Constructor & Destructor Documentation

◆ EosMaterial() [1/2]

NAMESPACE_SPH_BEGIN EosMaterial::EosMaterial ( const BodySettings body,
AutoPtr< IEos > &&  eos 
)

Creates the material by specifying an equation of state.

Equation of state must not be nullptr.

Definition at line 13 of file Materials.cpp.

◆ EosMaterial() [2/2]

EosMaterial::EosMaterial ( const BodySettings body)
explicit

Creates the material.

Equation of state is constructed from parameters in settings.

Definition at line 19 of file Materials.cpp.

Member Function Documentation

◆ create()

void EosMaterial::create ( Storage storage,
const MaterialInitialContext context 
)
overridevirtual

Create all quantities needed by the material.

Implements IMaterial.

Reimplemented in SolidMaterial.

Definition at line 30 of file Materials.cpp.

◆ evaluate()

Pair< Float > EosMaterial::evaluate ( const Float  rho,
const Float  u 
) const

Evaluate held equation of state.

Parameters
rhoDensity of particle in code units.
uSpecific energy of particle in code units
Returns
Computed pressure and sound speed as pair.

Definition at line 22 of file Materials.cpp.

◆ finalize()

virtual void EosMaterial::finalize ( IScheduler UNUSEDscheduler,
Storage UNUSEDstorage,
const IndexSequence   UNUSEDsequence 
)
inlineoverridevirtual

Definition at line 49 of file Materials.h.

◆ getEos()

const IEos & EosMaterial::getEos ( ) const

Returns the equation of state.

Definition at line 26 of file Materials.cpp.

◆ initialize()

void EosMaterial::initialize ( IScheduler scheduler,
Storage storage,
const IndexSequence  sequence 
)
overridevirtual

Initialize all quantities and material parameters.

Called once every step before loop.

Parameters
schedulerScheduler potentially used for parallelization
storageStorage containing the particles and materials
sequenceIndex sequence of the particles with this material
Todo:
now we can easily pass sequence into the EoS and iterate inside, to avoid calling virtual function (and we could also optimize with SSE)

Implements IMaterial.

Reimplemented in SolidMaterial.

Definition at line 50 of file Materials.cpp.


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