.. _Materials:

Materials
=========

.. _Material:

Solid material specification
----------------------------
The material of the substrate and powder is set in the ``Material`` section of the JSON file. 
It should be a string. 
The ``MaterialsLibrary`` section of the JSON file should contain the material specification for the string.

``MaterialsLibrary`` is an entry with key-value pairs, where the key string should be in specified in the ``Material`` field and the value in an entry which has the format specified below. 
Here is an example for the user specification of the user material. 

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

Heat Capacity
^^^^^^^^^^^^^
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                                                                        
--------------------------------------------------------------------------------------------------------------------
========================== ============================== ==========================================================

  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