World Builder  1.1.0-pre
A geodynamic initial conditions generator
WorldBuilder::World Class Reference

#include <world.h>

Collaboration diagram for WorldBuilder::World:

Public Member Functions

 World (std::string filename, bool has_output_dir=false, const std::string &output_dir="", unsigned long random_number_seed=1, const bool limit_debug_consistency_checks=true)
 
 ~World ()
 
void parse_entries (Parameters &prm)
 
unsigned int properties_output_size (const std::vector< std::array< unsigned int, 3 >> &properties) const
 
std::vector< double > properties (const std::array< double, 2 > &point, const double depth, const std::vector< std::array< unsigned int, 3 >> &properties) const
 
std::vector< double > properties (const std::array< double, 3 > &point, const double depth, const std::vector< std::array< unsigned int, 3 >> &properties) const
 
double temperature (const std::array< double, 2 > &point, const double depth) const
 
double temperature (const std::array< double, 3 > &point, const double depth) const
 
double temperature (const std::array< double, 2 > &point, const double depth, const double gravity_norm) const
 
double temperature (const std::array< double, 3 > &point, const double depth, const double gravity_norm) const
 
double composition (const std::array< double, 2 > &point, const double depth, const unsigned int composition_number) const
 
double composition (const std::array< double, 3 > &point, const double depth, const unsigned int composition_number) const
 
WorldBuilder::grains grains (const std::array< double, 2 > &point, const double depth, const unsigned int composition_number, size_t number_of_grains) const
 
WorldBuilder::grains grains (const std::array< double, 3 > &point, const double depth, const unsigned int composition_number, size_t number_of_grains) const
 
Objects::PlaneDistances distance_to_plane (const std::array< double, 3 > &point, const double depth, const std::string &name) const
 
std::mt19937 & get_random_number_engine ()
 

Static Public Member Functions

static void declare_entries (Parameters &prm)
 

Public Attributes

int MPI_RANK
 
int MPI_SIZE
 
Parameters parameters
 
std::vector< Point< 2 > > cross_section
 
Point< 2 > surface_coord_conversions
 
double potential_mantle_temperature
 
double surface_temperature
 
bool force_surface_temperature
 
double thermal_expansion_coefficient
 
double specific_heat
 
double thermal_diffusivity
 
double maximum_distance_between_coordinates
 
std::string interpolation
 
std::vector< std::string > feature_tags
 

Private Attributes

unsigned int dim
 
std::mt19937 random_number_engine
 
bool limit_debug_consistency_checks
 

Detailed Description

Definition at line 41 of file world.h.

Constructor & Destructor Documentation

◆ World()

WorldBuilder::World::World ( std::string  filename,
bool  has_output_dir = false,
const std::string &  output_dir = "",
unsigned long  random_number_seed = 1,
const bool  limit_debug_consistency_checks = true 
)

Constructor. This constructor requires the parameter filename. Other parameters are optional.

Parameters
filenamea string with the location of the world builder file to initialize the world.
has_output_dira bool indicating whether the world builder is allowed to write out information to a directly.
output_dira string with the location of the directory where the world builder is allowed to write information to if it is allowed by the bool has_output_dir.
random_number_seeda double containing a seed for the random number generator. The world builder uses a deterministic random number generator for some plugins. This is a deterministic random number generator on prorpose because even though you might want to use random numbers to initialize some fields, the result should be reproducible. Note that when the world builder is used in for example MPI programs you should supply the world builder created each MPI process a different seed. You can use the MPI RANK for this (seed is seed + MPI_RANK). Because the generator is deterministic (known and documented algorithm), we can test the results and they should be the same even for different compilers and machines.

Definition at line 57 of file world.cc.

Here is the call graph for this function:

◆ ~World()

WorldBuilder::World::~World ( )
default

Destructor

Here is the caller graph for this function:

Member Function Documentation

◆ composition() [1/2]

double WorldBuilder::World::composition ( const std::array< double, 2 > &  point,
const double  depth,
const unsigned int  composition_number 
) const

Returns the composition value based on a 2d Cartesian point, the depth in the model at that point and the gravity norm at that point.

Definition at line 520 of file world.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ composition() [2/2]

double WorldBuilder::World::composition ( const std::array< double, 3 > &  point,
const double  depth,
const unsigned int  composition_number 
) const

Returns the composition value based on a 3d Cartesian point, the depth in the model at that point and the gravity norm at that point.

Definition at line 528 of file world.cc.

Here is the call graph for this function:

◆ declare_entries()

void WorldBuilder::World::declare_entries ( Parameters prm)
static

Describe what the world builder file should look like

Definition at line 105 of file world.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ distance_to_plane()

Objects::PlaneDistances WorldBuilder::World::distance_to_plane ( const std::array< double, 3 > &  point,
const double  depth,
const std::string &  name 
) const

Returns a PlaneDistances object that has the distance from and along a feature plane, calculated from the coordinates and the depth of the point.

Parameters
pointthe coordinates in the cartesian geometry
depththe depth of the point
namethe name of the feature (i.e. the string provided to the key word "name" in the wb file)

Definition at line 562 of file world.cc.

Here is the call graph for this function:

◆ get_random_number_engine()

std::mt19937 & WorldBuilder::World::get_random_number_engine ( )

Return a reference to the mt19937 random number. The seed is provided to the world builder at construction.

Definition at line 556 of file world.cc.

Here is the caller graph for this function:

◆ grains() [1/2]

WorldBuilder::grains WorldBuilder::World::grains ( const std::array< double, 2 > &  point,
const double  depth,
const unsigned int  composition_number,
size_t  number_of_grains 
) const

Returns the grain orientations and sizes based on a 2d Cartesian point, the depth in the model at that point and the gravity norm at that point.

Definition at line 538 of file world.cc.

Here is the call graph for this function:

◆ grains() [2/2]

WorldBuilder::grains WorldBuilder::World::grains ( const std::array< double, 3 > &  point,
const double  depth,
const unsigned int  composition_number,
size_t  number_of_grains 
) const

Returns the grain orientations and sizes based on a 3d Cartesian point, the depth in the model at that point and the gravity norm at that point.

Definition at line 547 of file world.cc.

Here is the call graph for this function:

◆ parse_entries()

void WorldBuilder::World::parse_entries ( Parameters prm)

read in the world builder file

First load the major version number in the file and check the major version number of the program.

Secondly load the coordinate system parameters.

Thirdly load the gravity model parameters.

pre-compute stuff for the cross section

Temperature parameters.

Model discretization parameters

Local random number seed parameter

Now load the features. Some features use for example temperature values, so it is important that this is parsed the last.

Definition at line 158 of file world.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ properties() [1/2]

std::vector< double > WorldBuilder::World::properties ( const std::array< double, 2 > &  point,
const double  depth,
const std::vector< std::array< unsigned int, 3 >> &  properties 
) const

Returns different values at a single point in one go stored in a vector of doubles.

The properties input decides what each entry means, and the output is generated in the same order as the properties input. The properties input consists of a 3D array, where the first entry identifies the property and the last two entries provide extra information about that property.

Temperature is identified by 1 and no extra information is needed. So temperature input usually looks like {1,0,0}. A temperature query prodoces one entry in the output vector.

Composition is identified by 2. This produces one value in the output. The second entry identifies the composition number and the third number is not used. So a composition query asking about composition 1 looks like this: {2,1,0}. A composition query prodoces one entry in the output vector.

Grains are identified by 3. The second entry is the grain composition number and the third entry is the number of grains. A query about the grains, where it asks about composition 1 (for example enstatite) and 500 grains, looks like this: {3,1,500}. A composition query prodoces n_grains*10 entries in the output vector. The first n_grains entries are the sizes of all the grains, and the other 9 entries are sets of rotation matrices. The rotation matrix entries are ordered [0][0],[0][1],[0][2],[1][0],[1][1],etc.

The tag is identified by 4 and no extra information is needed. So the tag input usually looks like {4,0,0}. A tag query produces one entry in the output vector, representing the index of the tag of the last/dominant feature.

The velocity is identified by 5 and no extra information is needed. So the tag input usually looks like {5,0,0}. A tag query produces three entry in the output vector, representing the x, y and z velocity, even in 2D. In 2D the velocies are projected on the 2D plane, and the 3rd velocity element will be zero.

Definition at line 315 of file world.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ properties() [2/2]

std::vector< double > WorldBuilder::World::properties ( const std::array< double, 3 > &  point,
const double  depth,
const std::vector< std::array< unsigned int, 3 >> &  properties 
) const

Returns different values at a single point in one go stored in a vector of doubles.

The properties input decides what each entry means, and the output is generated in the same order as the properties input. The properties input consists of a 3D array, where the first entry identifies the property and the last two entries provide extra information about that property.

Temperature is identified by 1 and no extra information is needed. So temperature input usually looks like {1,0,0}. A temperature query prodoces one entry in the output vector.

Composition is identified by 2. This produces one value in the output. The second entry identifies the composition number and the third number is not used. So a composition query asking about composition 1 looks like this: {2,1,0}. A composition query prodoces one entry in the output vector.

Grains are identified by 3. The second entry is the grain composition number and the third entry is the number of grains. A query about the grains, where it asks about composition 1 (for example enstatite) and 500 grains, looks like this: {3,1,500}. A composition query prodoces n_grains*10 entries in the output vector. The first n_grains entries are the sizes of all the grains, and the other 9 entries are sets of rotation matrices. The rotation matrix entries are ordered [0][0],[0][1],[0][2],[1][0],[1][1],etc.

The tag is identified by 4 and no extra information is needed. So the tag input usually looks like {4,0,0}. A tag query produces one entry in the output vector, representing the index of the tag of the last/dominant feature.

The velocity is identified by 5 and no extra information is needed. So the tag input usually looks like {5,0,0}. A tag query produces three entry in the output vector, representing the x, y and z velocity, even in 2D. In 2D the velocies are projected on the 2D plane, and the 3rd velocity element will be zero.

Definition at line 403 of file world.cc.

Here is the call graph for this function:

◆ properties_output_size()

unsigned int WorldBuilder::World::properties_output_size ( const std::vector< std::array< unsigned int, 3 >> &  properties) const

Return the size of the output vector returned by the properties function for a given properties vector.

Parameters
propertiesThe properties parameter from the properties function. See the documentation of that function for more info.
Returns
unsigned int Return the size of the output vector returned by the properties function for a given properties vector.

Definition at line 274 of file world.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ temperature() [1/4]

double WorldBuilder::World::temperature ( const std::array< double, 2 > &  point,
const double  depth 
) const

Returns the temperature based on a 2d Cartesian point, the depth in the model at that point and the gravity norm at that point.

Definition at line 490 of file world.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ temperature() [2/4]

double WorldBuilder::World::temperature ( const std::array< double, 3 > &  point,
const double  depth 
) const

Returns the temperature based on a 3d Cartesian point, the depth in the model at that point and the gravity norm at that point.

Definition at line 505 of file world.cc.

Here is the call graph for this function:

◆ temperature() [3/4]

double WorldBuilder::World::temperature ( const std::array< double, 2 > &  point,
const double  depth,
const double  gravity_norm 
) const

Returns the temperature based on a 2d Cartesian point, the depth in the model at that point and the gravity norm at that point. Note: gravity norm is no longer used, instead use the gravity model from the input file.

Definition at line 497 of file world.cc.

Here is the call graph for this function:

◆ temperature() [4/4]

double WorldBuilder::World::temperature ( const std::array< double, 3 > &  point,
const double  depth,
const double  gravity_norm 
) const

Returns the temperature based on a 3d Cartesian point, the depth in the model at that point and the gravity norm at that point. Note: gravity norm is no longer used, instead use the gravity model from the input file.

Definition at line 512 of file world.cc.

Here is the call graph for this function:

Member Data Documentation

◆ cross_section

std::vector<Point<2> > WorldBuilder::World::cross_section

Todo

Definition at line 258 of file world.h.

◆ dim

unsigned int WorldBuilder::World::dim
private

The minimum dimension. If cross section data is provided, it is set to 2, which means the 2d function of temperature and composition can be used. Otherwise it is set to 3, which means that they can't be used.

Definition at line 317 of file world.h.

◆ feature_tags

std::vector<std::string> WorldBuilder::World::feature_tags

A list of all the feature tags.

Definition at line 308 of file world.h.

◆ force_surface_temperature

bool WorldBuilder::World::force_surface_temperature

Todo

Definition at line 278 of file world.h.

◆ interpolation

std::string WorldBuilder::World::interpolation

Todo

Definition at line 303 of file world.h.

◆ limit_debug_consistency_checks

bool WorldBuilder::World::limit_debug_consistency_checks
private

limits some of the consistency checks in debug mode. Current only prevents a check whether depth in spherical coordinates is consistent with the computed depth from x,y,z and provided radius. Note: Recommended to keep it at false, unless you know what you are doing.

Definition at line 332 of file world.h.

◆ maximum_distance_between_coordinates

double WorldBuilder::World::maximum_distance_between_coordinates

Todo

Definition at line 298 of file world.h.

◆ MPI_RANK

int WorldBuilder::World::MPI_RANK

The MPI rank. Set to zero if MPI is not available.

Definition at line 236 of file world.h.

◆ MPI_SIZE

int WorldBuilder::World::MPI_SIZE

The MPI size. Set to one if MPI is not available.

Definition at line 241 of file world.h.

◆ parameters

Parameters WorldBuilder::World::parameters

This is the parameter class, which stores all the values loaded in from the parameter file or which are set directly.

Definition at line 253 of file world.h.

◆ potential_mantle_temperature

double WorldBuilder::World::potential_mantle_temperature

Todo

Definition at line 268 of file world.h.

◆ random_number_engine

std::mt19937 WorldBuilder::World::random_number_engine
private

random number generator engine

Definition at line 323 of file world.h.

◆ specific_heat

double WorldBuilder::World::specific_heat

Todo

Definition at line 288 of file world.h.

◆ surface_coord_conversions

Point<2> WorldBuilder::World::surface_coord_conversions

Todo

Definition at line 263 of file world.h.

◆ surface_temperature

double WorldBuilder::World::surface_temperature

Todo

Definition at line 273 of file world.h.

◆ thermal_diffusivity

double WorldBuilder::World::thermal_diffusivity

Todo

Definition at line 293 of file world.h.

◆ thermal_expansion_coefficient

double WorldBuilder::World::thermal_expansion_coefficient

Todo

Definition at line 283 of file world.h.


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