Feellgood
|
Container for all the settings provided by the user, with conversions to/from YAML. More...
#include <feellgoodSettings.h>
Public Member Functions | |
Settings () | |
void | toYaml (void) |
std::string | evolMetadata (std::string realWorldTime) const |
std::string | solMetadata (double t, std::string columnsTitle) const |
void | read (YAML::Node) |
bool | read (std::string filename) |
int | getPrecision (void) const |
std::string | getFileDisplayName (void) const |
void | setFileDisplayName (std::string _s) |
void | setPbName (std::string str) |
std::string | getPbName (void) const |
void | setSimName (std::string str) |
std::string | getSimName (void) const |
void | setScale (const double s) |
double | getScale (void) const |
void | set_MAXITER (int i) |
int | findTetraRegionIdx (const std::string name) const |
int | findFacetteRegionIdx (const std::string name) const |
Eigen::Vector3d | getMagnetization (const Eigen::Ref< Eigen::Vector3d > p) const |
Eigen::Vector3d | getField (const double t_val) const |
field_exprType | getFieldType (void) const |
Eigen::Vector3d | getFieldSpace (const Eigen::Ref< Eigen::Vector3d > p) const |
double | getFieldTime (const double t_val) const |
Static Public Member Functions | |
static void | dumpDefaults () |
Public Attributes | |
bool | withTsv |
int | verbose |
double | time_step |
int | save_period |
bool | recenter |
Nodes::index | recentering_direction |
double | threshold |
int | solverNbTh |
int | scalfmmNbTh |
STT | p_stt |
bool | stt_flag |
std::string | sMx |
std::string | sMy |
std::string | sMz |
std::string | sM |
std::string | sBx |
std::string | sBy |
std::string | sBz |
std::string | sB |
std::string | sB_space |
std::string | sB_time |
std::string | restoreFileName |
double | initial_time = NAN |
double | DUMAX |
double | TOL |
int | MAXITER |
double | ILU_tol |
int | ILU_fill_factor |
std::vector< Tetra::prm > | paramTetra |
std::vector< Facette::prm > | paramFacette |
std::string | r_path_output_dir |
std::vector< std::string > | evol_columns |
double | tf |
double | dt_min |
double | dt_max |
Private Attributes | |
int | precision |
std::string | fileDisplayName |
double | _scale |
std::string | simName |
std::string | pbName |
ExpressionParser | mag_parser |
field_exprType | field_type |
ExpressionParser | field_parser |
ExpressionParser | field_time_parser |
ExpressionParser | field_space_parser |
Container for all the settings provided by the user, with conversions to/from YAML.
This class stores all the settings the user provides in their YAML configuration file. In addition to storing the settings, the class can convert them to and from YAML text:
The default settings are provided in the source file default-settings.yml. During the build, the contents of this file is embedded into the executable as a character array. This class' constructor initializes the settings by parsing this embedded document.
Javascript expressions (initial magnetization and applied field) are stored both in source form (sM* and sB* members) and as private ExpressionParser instances. This class provides methods for evaluating those expressions: getMagnetization(), getField(), getFieldSpace() and getFieldTime(). All these methods temporarily modify their corresponding ExpressionParser instances, it is thus not safe to call them from multiple threads simultaneously.
Settings::Settings | ( | ) |
Constructor. The default values for data members are defined in the source file default-settings.yml. A cmake rule invokes the linker ld
in order to convert this file to an object file which stores the original file's contents as a (not NUL-terminated) character array. This constructor calls read(YAML::Load(...))
on this embedded document in order to initialize all data members.
|
static |
Print to stdout the embedded YAML document defining the default settings.
std::string Settings::evolMetadata | ( | std::string | realWorldTime | ) | const |
build a metadata string for .evol file
|
inline |
[in] | name |
|
inline |
[in] | name |
|
inline |
Evaluate the applied field as a function of time. This is allowed only if field_type is RtoR3
. This method is not thread safe.
|
inline |
Evaluate the “spatial” part of the applied field, which is a position-dependent vector. This is allowed only if field_type is R4toR3
. This method is not thread safe.
|
inline |
Evaluate the “time” part of the applied field, which is a time-dependent scalar. This is allowed only if field_type is R4toR3
. This method is not thread safe.
|
inline |
Returns the field type, which can be either RtoR3
(vector function of time) or R4toR3
(product of a time-dependent scalar and a position-dependent vector).
|
inline |
getter for fileDisplayName
|
inline |
Evaluate the initial magnetization vector as a function of the position vector. This method is not thread safe.
|
inline |
getter for problem file name
|
inline |
returns numeric precision for .sol output text files
|
inline |
getter for geometrical scaling factor for physical coordinates of the mesh
|
inline |
getter for output file name
bool Settings::read | ( | std::string | filename | ) |
read settings from a YAML file. Returns true if a non-empty configuration is found.
void Settings::read | ( | YAML::Node | yaml | ) |
read settings from a parsed YAML document
|
inline |
maximum number of iterations setter for bicgstab
|
inline |
setter for fileDisplayName
|
inline |
setter for .msh file name
|
inline |
setter for geometrical scaling factor for physical coordinates of the mesh
|
inline |
setter for .sol output file name
std::string Settings::solMetadata | ( | double | t, |
std::string | columnsTitle | ||
) | const |
build a metadata string for .sol text files
void Settings::toYaml | ( | void | ) |
Serialize these settings as a YAML document, and print them to stdout.
|
private |
scaling factor from gmsh files to feellgood
double Settings::dt_max |
maximal time step
double Settings::dt_min |
minimal time step
double Settings::DUMAX |
maximum value for du step
std::vector<std::string> Settings::evol_columns |
contain the value names of the columns the user want in .evol file
|
private |
parser for the time dependant applied field expressions R->R³
|
private |
parser for the field space dependant vector expressions
|
private |
parser for the field time dependant scalar expression
|
private |
applied field might be either expression defined (t) -> (Bx(t),By(t),Bz(t)) or a couple of math expressions (t) -> A(t) and (x,y,z) -> (fx(x,y,z),fy(x,y,z),fz(x,y,z)) with B(x,y,z,t) = A(t) * (fx(x,y,z),fy(x,y,z),fz(x,y,z))
|
private |
parameters file name : either a yaml file or standard input
int Settings::ILU_fill_factor |
ILU preconditioner filling factor https://eigen.tuxfamily.org/dox/classEigen_1_1IncompleteLUT.html
double Settings::ILU_tol |
ILU preconditioner dropping tolerance https://eigen.tuxfamily.org/dox/classEigen_1_1IncompleteLUT.html
double Settings::initial_time = NAN |
initial time for the simulation, if defined in the settings file, NAN otherwise
|
private |
parser for the magnetization expressions R³->R³
int Settings::MAXITER |
maximum number of iteration for biconjugate gradient algorithm
STT Settings::p_stt |
spin transfert torque parameters
std::vector<Facette::prm> Settings::paramFacette |
this vector contains the material parameters for all regions for all the facettes
std::vector<Tetra::prm> Settings::paramTetra |
this vector contains the material parameters for all regions for all the tetrahedrons
|
private |
mesh file, gmsh file format
|
private |
numeric precision for .sol output text files
std::string Settings::r_path_output_dir |
relative path for output files (to be implemented)
bool Settings::recenter |
to recenter magnetization distribution or not
Nodes::index Settings::recentering_direction |
recentering direction, should be IDX_X|IDX_Y|IDX_Z
std::string Settings::restoreFileName |
input file name for continuing a calculation (sol.in)
int Settings::save_period |
magnetic configuration saved every save_period time steps
std::string Settings::sB |
string for a JavaScript function defining B, alternative to (sBx, sBy, sBz)
std::string Settings::sB_space |
string for a JavaScript function defining B space: (x,y,z)->[,,]
std::string Settings::sB_time |
string for a JavaScript function defining B time, (t) -> real
std::string Settings::sBx |
string for analytical definition of Bx
std::string Settings::sBy |
string for analytical definition of By
std::string Settings::sBz |
string for analytical definition of Bz
int Settings::scalfmmNbTh |
nb of threads for the computation of the demag field with scalfmm
|
private |
simulation name
std::string Settings::sM |
string for a JavaScript function defining M, alternative to (sMx, sMy, sMz)
std::string Settings::sMx |
string for analytical definition of Mx
std::string Settings::sMy |
string for analytical definition of My
std::string Settings::sMz |
string for analytical definition of Mz
int Settings::solverNbTh |
nb of threads for the finite element solver
bool Settings::stt_flag |
if spin transfer torque p_stt is fully initialized and boundary conditions ok, stt_flag is set to true
double Settings::tf |
final integration time
double Settings::threshold |
threshold value to recenter or not versus avg(M_recentering_direction)
double Settings::time_step |
energy saved every time_step
double Settings::TOL |
solver tolerance (eigen bicgstab)
int Settings::verbose |
verbosity level, defaults to zero
bool Settings::withTsv |
boolean flag to mention if you want output in txt tsv file format