File hermes_utils.hxx#

Defines

HERMES_UTILS_H#

Functions

inline BoutReal floor(BoutReal value, BoutReal min)#
inline BoutReal softFloor(BoutReal value, BoutReal min)#

Apply a smoothly varying “soft” floor to the value The intention is to keep the RHS function differentiable

Note: This function cannot be used with min = 0!

template<typename T, typename = bout::utils::EnableIfField<T>>
inline T softFloor(const T &var, BoutReal f, const std::string &rgn = "RGN_ALL")#

Apply a soft floor value f to a field var. Any value lower than the floor is set to the floor.

Parameters:
  • var[in] Variable to apply floor to

  • f[in] The floor value. Must be > 0 (NOT zero)

  • rgn[in] The region to calculate the result over

template<typename T, typename = bout::utils::EnableIfField<T>>
inline T clamp(const T &var, BoutReal lo, BoutReal hi, const std::string &rgn = "RGN_ALL")#
BOUT_ENUM_CLASS(SpeciesType, electron, ion, neutral)#

Enum that identifies the type of a species: electron, ion, neutral.

inline SpeciesType identifySpeciesType(const std::string &species)#

Identify species name string as electron, ion or neutral.

template<typename T, typename = bout::utils::EnableIfField<T>>
Ind3D indexAt(const T &f, int x, int y, int z)#
inline bool containsAnySubstring(const std::string &mainString, const std::vector<std::string> &substrings)#

Function which returns true if any of a list of subtstrings is contained within string.

inline bool collisionSpeciesMatch(std::string input, const std::string &species1, const std::string &species2, const std::string &reaction, const std::string &mode)#

Takes a string representing a collision, e.g. d+_e_coll Splits it using underscores and finds species, e.g. d+ and e Does partial match against these, e.g. True if species1 = d+ or + and species2 = e Used across all processes that require collisions for identifying the right ones.