Skip to content

VaSca92/NTMpy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latest Update 08/06/25

The graphical inteface is available on this repository.

Installation

At the moment, this new version of NTMpy is not available on pip. NTMpy does not require an installation: download this repository, unzip the files, and click on `launch.py` to open the user interface. The GUI needs eel and jinja2 as dependencies, which can be installed typing the command `pip install eel[jinja2]` on the command promtpt.

What does NTMpy solves

NTMpy is a python package to solve 1D diffusion equation with 2 or 3 temperature coupled

The equation under consideration is:

$$ \begin{cases} C_{Ei}\cdot\rho_i\cdot\partial_t T_E = \partial_x(k_{Ei}\cdot\partial_xT_E)+G_{ELi}\cdot(T_L-T_E)+G_{ESi}\cdot(T_S-T_E)+S(x,t)\\ C_{Li}\cdot\rho_i\cdot\partial_t T_L = \partial_x(k_{Li}\cdot\partial_xT_L)+G_{ELi}\cdot(T_E-T_L)+G_{LSi}\cdot(T_S-T_L)\\ C_{Si}\cdot\rho_i\cdot\partial_t T_S = \partial_x(k_{Si}\cdot\partial_xT_S)+G_{ESi}\cdot(T_E-T_S)+G_{LSi}\cdot(T_L-T_S) \end{cases} $$

where

  • $T_E(x,t)$, $T_L(x,t)$, and $T_S(x,t)$ are temperature (subscripts recall Electron, Lattice, and Spin)
  • $\rho$ is the mass density in the $i$-th layer of material (the material properties are piecewise homogeneous)
  • $C_{Ki}$ and $k_{Ki}$ are the specific heat and thermal conductivity of the system $K = E,L,S$ in the $i$-th layer of material
  • $G_{KHi}$ is the thermal coupling coefficient between the system $K$ and $H$ (with $K,H\in \lbrace E,L,S\rbrace$) in the $i$-th layer
  • $S(x,t)$ is the energy generation/ source

The material properties $C_{Ki}(T_E,T_L,T_S)$, $k_{Ki}(T_E,T_L,T_S)$, and $G_{KH}(T_E,T_L,T_S)$ are function of the three temperatures.
The dependance on temperature are non-dispersive, i.e. they depend on the temperature in the same point at the same time

$$ \begin{aligned} C_{Ki}(x,t) = C_{Ki}(T_E(x,t),T_L(x,t),T_S(x,t))\\ k_{Ki}(x,t) = k_{Ki}(T_E(x,t),T_L(x,t),T_S(x,t))\\ G_{KHi}(x,t) = G_{KHi}(T_E(x,t),T_L(x,t),T_S(x,t)) \end{aligned}$$

The solution is obtained using the Finite Element Method (FEM) + explicit Euler method. The FEM uses B-splines + collocation method.

Further informations can be found on the paper.


How to use NTMpy

NTMpy can be used as a Python package or with a Graphic User Interface depending on the user preferences.

Python Package

NTMpy provides a set of classes to simulate coupled heat equation with 2 or 3 temperature in a multilayer system. The simulation parameters are customizable, but the codes can choose them automatically if not given by the user.

Here is an example:

from Sim2T import Sim2T 
import Visual as vs 
from Source import source 

# Initialize source
s = source() # default option, Gaussian pulse
s.setLaser(5, 2e-12)
s.delay       = 2e-12       # time the maximum intensity hits
s.refraction  = [1,1]
s.absorption  = [1.9e-7, 1.9e-7]


# initialize simulation: ntm.simulation(number of temperatures, source)
sim = Sim2T() # Default initial temperature: 300 Kelvin
sim.setSource(s)

# add material layers:
# addLayer(length, [kE, kL], [CE, CL], density, G_EL, spline_number)
sim.addLayer( 30e-9, [ 8,  0], [lambda T: .112*T, 450], 6500, 6e17, 9)
sim.addLayer( 80e-9, [24, 12], [lambda T: .025*T, 730], 5100, 6e17, 12)

# set final simulation time (in seconds)
sim.final_time = 50e-12

# Run simulation
[x, t, phi] = sim.run()
    
# Plot temperature
vs.compare(x,t,phi[0],phi[1])

The ouput phi is a 3D array with the following structure:

  • the first index selects the temperature: phi[0] is the electron temperature, phi[1] is the lattice temperature.
  • the second index is the space position: phi[0][n] is the electron temperature in the n-th point of the grid.
  • the third index is the time instant: phi[0][0][n] is the electron temperature of the surface after n time steps.

Graphic User Interface

A GUI is available running the launch.py script with pyhton. Detailed description of the GUI is presented in the Wiki of the repository (currently under construction).


How to contribute

New features for NTMpy are currently under development, but with a very slow pace. If there is any important feature you think is missing and it is important for the experiments, you can open an issue on this repository or directly contact the author. If you want to contribute to the code development, you can either clone this directory or contact the author Valentino Scalera.
Any collaboration would be very appreciated.


About the authors

NTMpy was a project of the Ultrafast Condensed Matter physics group at the Stockholm University.
The main contributors are:

At the moment, Valentino Scalera is handling the maintenance and development of NTMpy.
You can contact me via email if you need help or you want to contribute.

How to cite

Please, cite the reference paper:

@article{alber2020ntmpy,
    title={NTMpy: An open source package for solving coupled parabolic differential equations in the framework of the three-temperature model},
    author = {Lukas Alber and Valentino Scalera and Vivek Unikandanunni and Daniel Schick and Stefano Bonetti},
    journal = {Computer Physics Communications},
    year={2021},
    volume = {265},
    pages = {107990},
    issn = {0010-4655},
    doi = {https://doi.org/10.1016/j.cpc.2021.107990},
    url = {https://www.sciencedirect.com/science/article/pii/S0010465521001028}
}

Dependencies

NTMpy has four dependencies: Numpy, Matplotlib, B-splines, and Progressbar, plus one extra dependency for the GUI Eel-Jinja2.

About

Simulation of multi temperature and multi layer heat diffusion

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 59.7%
  • JavaScript 25.8%
  • HTML 9.2%
  • CSS 5.3%