Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get the variation of source term #28

Open
karnapravin opened this issue May 13, 2023 · 2 comments
Open

get the variation of source term #28

karnapravin opened this issue May 13, 2023 · 2 comments

Comments

@karnapravin
Copy link

How do I get the values of the source term at each time and position, like for electron or lattice temperature? I
need to get the source term values to calculate the contribution of -(Ke/G del^2Te).
Thanks

@karnapravin
Copy link
Author

Also, I cannot visualize the source term even if I copy the code from the example page. The error page is a huge page but at last it says" AssertionError: Pieces mismatches: [{1768, 1769}, {1776, 1775}, {1784, 1783}] ". Also the animation does not run.
My code for solving TTM is as follows.
from NTMpy import NTMpy as ntm
from matplotlib import pyplot as plt
import numpy as np
import numericalunits as u
u.reset_units('SI')
s = ntm.source()
s.spaceprofile = "TMM"
s.timeprofile = "Gaussian"
s.FWHM = 0.1u.ps #Full width half max of the laser pulse
s.fluence = 17
u.mJ/u.cm2 #Fluence of the laser
s.t0 = 1u.ps #Time when Gaussian peaks
s.lambda_vac = 400 #Wavelength of incident light (in nm!)
s.theta_in = np.pi/4 #Incident angle
s.polarization = "p"
#copper
length_cu = 500
u.nm #Length of the Material
n_cu = 1.2878+2.2596j #Complex refractive index
k_el_cu = 391u.W/(u.mu.K);#Heat conductivity
k_ph_cu = 7u.W/(u.mu.K);#Heat conductivity
rho_cu = 1e38.96u.kg/(u.m
3)#Density
C_el_cu = lambda Te:(96.8u.J/(u.m**3u.K2))/(1e38.96u.kg/(u.m3)) Te #Electron heat capacity
C_lat_cu = 3.62e6
u.J/(u.m3*u.K2)/rho_cu #Lattice heat capacity
G_cu = 6e17u.W/(u.m**3u.K) #Lattice electron coupling constant
Temperature Model:
#Two temperatures are considered, electron and lattice
sim = ntm.simulation(2,s)
#add parameters for both layers and both systems
sim.addLayer(length_cu,n_cu,[k_el_cu,k_ph_cu],[C_el_cu,C_lat_cu],rho_cu,[G_cu])
#sim.addLayer(length_ta,n_ta,[k_el_ta,k_ph_ta],[C_el_ta,C_lat_ta],rho_ta,G_ta)
sim.final_time = 15*u.ps
#To get the raw output
[x,t,T] = sim.run()

#Visualize result
#Create a visual object where the simulation gets passed on
v = ntm.visual(sim)
#output of v.source is the full matrix of the source(x,t)
so = v.source()
#A contourplot of the electron system
v.contour('1')
#This will only work in the two temperature case.
v.contour('2')
[timegrid, avT] = v.average()
#animate the result input parameter is the speed of the animation
speed = 1
v.animation(speed)

@VaSca92
Copy link
Member

VaSca92 commented May 17, 2023

Ciao karnapravin

You can get the source term with the method sourceprofile() of the class simulation.

For example, you can run
S = sim.sourceprofile('TMM','Gaussian', x, L, t, 12)

where

  • 'TMM' and 'Gaussian' are the type of the source, in particular the space distribution and the time evolution (you can use also other types like lambert-beer for example)

  • L is the array of the position of the interfaces. You can get them using sim.temp_data.length

  • t is the time instants when you want to compute the source term. You can use the output t of the method run(), so is coincides with the time where the temperature is computed

  • x is the points where you want to compute the source term. If you want the same points where the the temperature is computed, you can use the output x of the method run()

-12 is the number of points where the diffusion equation is imposed, in the current version of the code must be 12

For the problems with the plot tools, I am not sure what is the cause. May I ask what IDE and interpreter are you using? (so I can try to reproduce the same error)

If I take a long time to respond, you can email me at [email protected] (for some reason the repository owners did not received any notification of the issue form github)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants