.. _Materials:

.. include:: ../shared.rst

Materials
=========

.. _Material:

Solid material specification
----------------------------

The material of the substrate and powder is defined in the ``Material`` section of the JSON file.
This should be a **string**.

The ``MaterialsLibrary`` section contains material specifications corresponding to the string defined in ``Material``.

``MaterialsLibrary`` consists of key-value pairs where:

- The **key** (a string) must match the value in ``Material`` field of the current JSON file. 
- The **value** follows the format described on this page.

Example: User-Specified Material
--------------------------------

.. include:: ../json_desc/descUserMaterial.rst

Heat Capacity
^^^^^^^^^^^^^
The volumetric heat capacity is defined when:

- ``HeatCapacityIntervalsT`` = :math:`[T_1, T_2, ..., T_n]`
- ``HeatCapacityVolumeVals`` = :math:`[c_{vol,1}, c_{vol,2}, ..., c_{vol,n}]`

  
  
..
  The expression for the volumetric heat capacity if ``HeatCapacityIntervalsT`` is  :math:`[T_1, T_2, ..., T_n]` and  ``HeatCapacityVolumeVals`` is :math:`[c_{vol,1}, c_{vol,2}, ..., c_{vol,n}]`,

.. math::

   &T_1=0; \\
   c_{vol}= & c_{vol,1}, \quad \text{if } T_1<T<T_2;  \\
   c_{vol}= & c_{vol,2}, \quad\text{if }  T_2<T<T_3;  \\
   ...\\
   c_{vol}= & c_{vol,n}, \quad\text{if }  T_n<T.

The expression for the heat capacity is :math:`c_{vol} = c_p\rho`

Evaporation
^^^^^^^^^^^
The ``Evaporation`` section includes 3 sections:

  1. General Parameters 

========================== ============================== ==========================================================
Key                        Value type                     Default value                                             
========================== ============================== ==========================================================
``Tboiling``               value                          0
``Tcritical``              value                          0
:math:`T_{\text{boiling}}` and :math:`T_{\text{critical}}` (K) for the `ClausiusClapeyron` saturated pressure model 
--------------------------------------------------------------------------------------------------------------------
``LatentHeatVaporization`` value                          0
number — Latent heat of vaporization in J/kg used for `ClausiusClapeyron` saturated pressure model                  
--------------------------------------------------------------------------------------------------------------------
========================== ============================== ==========================================================

  2. One-component evaporation. It is used if NULL is set in components field in the “main Materials section”.  
       In this case the material is considered to have one component, and the effective evaporation rate should be set:

========================== ============================== ==========================================================
Key                        Value type                     Default value                                             
========================== ============================== ==========================================================
``name``                   string                         Unknown
The name of the evaporation preset                                                                                  
--------------------------------------------------------------------------------------------------------------------
``SatPressureName``        string                         Antonie
The choice of the evaporation model. The  possible types are ``Antonie``, ``AntonieExtended``, ``ClausiusClapeyron``
--------------------------------------------------------------------------------------------------------------------
``atomWeight``             value                          58.6934
Atomic weight (amu)                                                                                                 
--------------------------------------------------------------------------------------------------------------------
``gamma``                  value                          1.6666666666666667
Specific heat ratio                                                                                                 
--------------------------------------------------------------------------------------------------------------------
``coeffA``                 value                          11.672
``coeffB``                 value                          20765.0
``coeffC``                 value                          0.0
``coeffD``                 value                          0
``coeffE``                 value                          0
``coeffF``                 value                          0
Coefficients for the `AntonieExtended` model                                                                        
--------------------------------------------------------------------------------------------------------------------
========================== ============================== ==========================================================

For *Clausius-Clapeyron* model,


..  math::

    &P_{sat}(T) \text{ [bars]} = \exp \left\{-m_a \cfrac{L_{vap0}}{k_B}
    \left(
    \cfrac{1}{T}\sqrt{1-\left(\cfrac{T}{T_{crit}}\right)^2} - \cfrac{1}{T_{boil}}\sqrt{1-\left(\cfrac{T_{boil}}{T_{crit}}\right)^2} +\right.\right.\\
    &\qquad\qquad\qquad\qquad\qquad\qquad \left.\left.\cfrac{1}{T_{crit}}
    \left( \arcsin\left(\cfrac{T}{T_{crit}}\right) - \arcsin\left(\cfrac{T_{boil}}{T_{crit}}\right)\right)
     \right) \right\} ;\\
     &L_{vap}(T) = L_{vap0}\sqrt{1-\left(\cfrac{T}{T_{crit}}\right)^2},\\
     &L_{vap0}(T) = L_{vap_B}/\sqrt{1-\left(\cfrac{T_{boil}}{T_{crit}}\right)^2},\\

where :math:`L_{vap0}` is the specific heat of vaporization at absolute zero temperature (it can be derived from :math:`L_{vap_B}`, the heat of vaporization at boiling point which is known more often), :math:`T_{boil}` is the boiling temperature at standard atmosphere (1~bar) and :math:`T_{crit}` is the critical temperature.

For the *Antonie* model:

.. math::

    & P_{sat}(T) \text{ [Pascal]} = 10^{\mathcal{A}-\mathcal{B}/\left(\mathcal{C}+T\right)}, \\
    & L_{vap}(T) = \cfrac{\mathcal{B}\ln{10}}{(\mathcal{C}+T)^2}\cdot \cfrac{k_BT^2}{m_a};\\

and for *Antonie Extended* model:

.. math::

    & P_{sat}(T) \text{ [Pascal]} = 10^{\mathcal{A}-\mathcal{B}/\left(\mathcal{C}+T\right)
    +\mathcal{D}T + \mathcal{E}T^2 + F\log_{10}(T) },\\
    & L_{vap}(T) =  \cfrac{k_BT^2}{m_a} \cdot \left(\cfrac{\mathcal{B}}{(\mathcal{C}+T)^2} + \mathcal{D} + 2\mathcal{E}+\cfrac{\mathcal{F}}{T\ln{10}}\right)\ln{10}. \\

The coefficients :math:`\mathcal{A}`, :math:`\mathcal{B}`, :math:`\mathcal{C}` can usually be found from any reference book with saturated vapor data 
(for example, see `Wikipedia article on vapor pressure <https://en.wikipedia.org/wiki/Vapor_pressures_of_the_elements_\%28data_page\%29>`_).
The additional coefficients :math:`\mathcal{D}`, :math:`\mathcal{E}`, :math:`\mathcal{F}` can be used for more precise fitting of saturated vapor curves.

The recommended model in |kissam| is the  *Antonie* model.

  3. Several component evaporation. It is used if something is set in the components field in the “main Materials section”, for example, ``{“Al”: 0.05, “Ti”: “balanced”}``. 
       In this case the material is considered to be an alloy, and the evaporation rates for each component  should be set in the components section. 
       For examples of the section, refer to the alloy materials (such as :ref:`Ti6Al4V`) below. 

========================== ============================== ==========================================================
Key                        Value type                     Contents                                             
========================== ============================== ==========================================================
``components``             JSON data                      Description for each component
--------------------------------------------------------------------------------------------------------------------
``ActivityMixingCoeffs``   JSON data                      Acitivity mixing coefficients
========================== ============================== ==========================================================

The ``components`` section has mandratory fields:

========================== ============================== ==========================================================
Key                        Value type                     Sample value
========================== ============================== ==========================================================
``name``                   string                         `'name1'`
The name of the component
--------------------------------------------------------------------------------------------------------------------
``atomWeight``             value                          58.6934
Atomic weight (amu)                                                                                                 
--------------------------------------------------------------------------------------------------------------------
``coeffsABCDEF``           list                           [11.672, 20765.0, 0.0, 0, 0, 0]
Coefficients for the Antonie and AntonieExtended evaporation expressions.                                                                                                
--------------------------------------------------------------------------------------------------------------------
========================== ============================== ==========================================================

The ``ActivityMixingCoeffs`` are the :math:`L1`, :math:`L2`, :math:`L3` coefficients specified as linear dependencies on temperature:

========================== ============================== ==========================================================
Key                        Value type                     Sample value
========================== ============================== ==========================================================
``L1``                     list of 2 values               [-153707 , 34.8594]
``L2``                     list of 2 values               [-153707 , 34.8594]
``L3``                     list of 2 values               [-153707 , 34.8594]
The two values, e.g. :math:`[a,b]` , are used as in :math:`L1=a+bT`.
--------------------------------------------------------------------------------------------------------------------
========================== ============================== ==========================================================

Grains
^^^^^^
======================================= ============================== ==========================================================
Key                                     Value type                     Contents                                             
======================================= ============================== ==========================================================
``GrowthCoeffs``                        list of 3 values               Grain growth coefficients :math:`[K_1,K_2,K_3]` 
``Nucleation``                          JSON data                      Nucleation model parameters section
======================================= ============================== ==========================================================

The ``Nucleation`` section has two subsections: ``Bulk``, and ``Surface``. 
Both sections contain ``Density`` and ``CriticalTdiff`` fields. 

======================================= ============================== ==========================================================
Key                                     Value type                     Contents                                             
======================================= ============================== ==========================================================
``Nucleation.Bulk``                     JSON data                      Bulk parameters section
``Nucleation.Surface``                  JSON data                      Surface model parameters section
``Nucleation.Bulk.Density``             value                          Nucleation density (concentration) in 1/m³ (for example, `1e15`)
``Nucleation.Bulk.CriticalTdiff``       list of 2 values               Critical temperature difference :math:`(T_\text{liquidus}-T_\text{critical})` Gaussian distribution parameters when the nuclei can grow (mean in K and standard deviation in K) (for example, `[9.5, 0.5]`)
``Nucleation.Surface.Density``             value                          Nucleation density (concentration) in :math:`1/m^2` (for example, `2e8`)
``Nucleation.Surface.CriticalTdiff``    list of 2 values               Critical temperature difference :math:`(T_\text{liquidus}-T_\text{critical})` Gaussian distribution parameters when the nuclei can grow (mean in K and standard deviation in K) (for example, `[2, 0.1]` )
======================================= ============================== ==========================================================

The grain growth velocity (m/s) is :math:`v = K_1 \Delta T + K_2\Delta T^2 + K_3\Delta  T^3` , where the coefficients :math:`K_1` is in m/s/K, :math:`K_2` is  in m/s/K :math:`{}^2`, :math:`K_3` is in m/s/K³ and 
the temperature difference :math:`\Delta T = \max(T_{liquidus} - T, 0)` is in K.

Add New Material
----------------

To use another material, add the ``MaterialsLibrary`` to your JSON file, and, in it, specify a gas in the same format.  Then, specify the name of your material in the ``Material`` section of the JSON file.

All default values for every built-in material can be changed. If you want to adjust the properties of a built-in material, you can specify only the field you need to adjust in the JSON file. 
For example, to use the AA5182 material with custom density:

.. code:: json

  {
    ...

    "Material": "AA5182",
    ...

    "MaterialsLibrary": {
      "AA5182": {
        "density"               : 2700.0,
    }
  }



Gas material specification
--------------------------

The properties of the gas in the gas chamber influence the evaporation process. 
Here is the explanation of the material settings on the example of the built-in argon gas.
The entry is in the  ``MaterialsLibrary`` section of the JSON file. 
To use another gas, add the ``MaterialsLibrary`` to your JSON file, and, in it, specify a gas in the following format. 

.. include:: ../json_desc/descAr.rst


To use the specified gas, its name should be in the ``Camera.AmbientGas`` field of the JSON file. 



Built-in Materials
------------------

Some materials are already specified in the :file:`default.json` file.
These materials are verified for the use in KiSSAM. 

Some materials have additional parameters for microstructure modeling and multicomponent evaporation.
The table below shows which models were verified.
If the material properties for the multicomponent evaporation are missing, users can input custom properties. 


.. table:: 
    :widths: 20 20 20
    :align: left

    ========= ================================== ===================================
    Material  Verified                           Verified 
              Microstructure                     Multicomponent 
              Parameters                         Evaporation

    ========= ================================== ===================================
    AA5182_                                        
    CoCr_                                          
    In625_    yes                                  
    Ti6Al4V_                                     yes
    SS316L_                                        
    NiTi_                                        yes
    AlSi10Mg_                                      
    Mo_                                            
    ========= ================================== ===================================

.. include:: ../json_desc/desc_material.rst