# Material

• Some definitions coming from crystallography
• The library accounting for Orientation Density Function (ODF) for phases in an heterogeneous material

# The crystallography Library: crystallo.hpp

### Schmid(vec,vec)

provides the Schmid tensor written as a matrix, with n is the vector normal to the habit plane and m is the vector pointing in the transformation direction.
return a mat

vec n = randu(3);
vec m = randu(3);
mat R = Schmid(n,m);

### Schmid_v(vec,vec)

provides the Schmid tensor written as a vector v in the SMART+ formalism, with n is the vector normal to the habit plane and m is the vector pointing in the transformation direction.
return a vec

vec n = randu(3);
vec m = randu(3);
vec R = Schmid_v(n,m);

### Q_nm(vec,double,double)

Provides the interfacial operator for an isotropic elastic material behavior with $$\mu$$ and $$\lambda$$ the Lamé constants (see papers of Siredey ).
Return a mat.

vec v = randu(6);
double mu= (double) rand();
double lambda = (double) rand();
mat m = Q_nm (v,mu,lambda);

# The ODF Library: ODF2Nphases.hpp

### ODF(double, int, vec, bool, double)

Provides the value of a specific ODF for a given angle (the first input “double”). This is designed to work with angles between 0 and Pi. The chosen ODF is defined by the int. The vec defines the parameters relative to the ODF. The bool is false if the values are angles written in °. The last double is the decimal number, by default the same than Pi.
Returns a double.
List of methods:
1: ODF_sd
2: ODF_hard
3: Gaussian
30: Gaussian with 2 peaks or more
4: Lorentzian
40: Lorentzian with 2 peaks or more
5: Pseudo-Voigt
50: Pseudo-Voigt with 2 peaks or more
6: Pearson VII
60: Pearson VII with 2 peaks or more

double X = (double)rand()/(double)(RAND_MAX) % Pi - Pi;
int method = 3;
vec param = randu(3);
double value = ODF(X,method,param,radian);

### ODF2Nphases(Col<int>, Col<int>, Col<int>, vector<string>, mat, bool, double)

Writes the Nphases.dat file for multiphase modeling, according to specific ODFs.

Needs a defined phases.dat file regrouping each different phase. Each one of them may be splitted into phases with same properties but different angles and volume fraction.

For the method labeled “tabulated”, an external .dat file is needed. It shall contains 2 columns : the first with the angles between 0 and Pi and the second with the orentation density value. At least 2 points are required to build an ODF.

 ///Number of phases of "phases.dat" that will make it to the output "Nphases.dat".
int nb_phase = 2;

///Number of orientation families for each initial phase
Col<int> nphases;
nphases.zeros(nb_phase);
nphases(0) = 1;
nphases(1) = 18;

///Euler angle: 0. psi, 1. theta, 2. phi
Col<int> angle;
angle.zeros(nb_phase);
angle(1) = 0;

///Method: 0. tabulated, 1. ODF_sd, 2. ODF_hard, 3. Gaussian, 4. Lorentzian, 5. Pseudo-Voigt, 6. Pearson7
///Multi-Peak: 30. Gaussian, 40. Lorentzian, 50. Pseudo-Voigt, 60. Pearson7
Col<int> method;
method.zeros(nb_phase);
method(1) = 0;

///File_name: method "0" implies a dedicated .dat file containing an ODF. Ascending order on angles!
/// Warning: Trapezoidal integration. You may want at least 1 point inside each orientation family in the .dat file. Or at the very minimum at least 2 points in different orientation families...
std::vector<string> filename(nb_phase);
filename[1] = "ODF_theta";

///NB_Param: (0. 0) (1. 5)(2. 3)(3. 3)(4. 3)(5. 5)(6. 4)
///Multi-Peak: {1st_param = Nb_Peak #} (30. 3#)(40. 3#)(50. 5#)(60. 4#)
/// Methods 3. to 6. : No need to set a value for amplitude or maximum parameter due to normalization process (1 peak)
mat param = zeros(nb_phase,1);

///Define if the parameters are in degrees or radians

///Number of decimals - has to be equal to 0.
double dec = 0.*pi;

ODF2Nphases(nphases, angle, method, filename, param, radian, dec);

# The Variant Library: variant.hpp

In SMART+, the variant class defines characteristics of a variant of martensite.

## Definition of variant object

### Members of an object of the variant class

This library contains a class called “variant”, which contains the following informations :

• n (arma::vec) : The vector normal to the habit plane
• m (arma::vec) : The vector pointing in the transformation direction
• R (arma::mat) : The Schmid tensor
• g (arma::double) : The transformation magnitude
• ETn (arma::mat): The strain associated to each variant

Those informations are fully accessible out of the class.

### Constructors of the variant class

This class has several constructors. Those are examples :

variant v1(); 	//Default constructor

vec n = randu (3);
vec m = randu (3);
double g = (double)rand();
variant v2(n,m,g) // Constructor with parameters

variant v3(v2); //Copy constructor

variant v4 = v3; // constructor with operator “=”


## Methods for variant objects

### build(double)

Computes the Schmid tensor and the strain associated to each variant,
return a void.

vec n = randu (3);
vec m = randu (3);
double g = (double)rand();
v= variant (n,m,g);
v.build(g);


### Display with <<

To display a informations contained in a variant object, the << operator have been over-defined. For example, this permits to print data in a file
Return an ostream

vec n = randu (3);
vec m = randu (3);
double g = (double)rand();
variant v(n,m,g);

ofstream myFile,
myFile.open(“myFileName.txt”, ios::out);

myFile << v;
myfile.close