Custom temperature profile

57 views
Skip to first unread message

Peela baradwaj naidu

unread,
Aug 1, 2025, 4:36:37 PMAug 1
to Vampire Users
Hello Vampire users,
I am working on simulation that would require a custom heating profile that doesn't exactly follow a 2 Temperature model but rather an ultrafast heat transfer from a bilayer heterostructure. In order to generate a custom temperature profile , I have a defined a heat transfer problem in COMSOL and obtained a numerical solution since finding an exact analytical solution would be too complicated. My plan is to save this solution of T vs t as .txt file with all datapoints and write a modified temperature pulse routine , however , I am still wondering on what is the best way to load this file. Ideally , I would like to plase my temperature.txt file in the same directory as material.mat and unitcell.ucf so I can spawn copies while parallel computing. However I don't know which file is responsible for detecting these files and reading them from the directories.
I would appreciate any suggestions or help on this topic
Thank You.
temperature_pulse.cpp

gabo...@gmail.com

unread,
Aug 1, 2025, 6:22:05 PMAug 1
to Vampire Users
For material.mat, believe that is read by the following function in match.cpp [1]:

line 1544: int read_mat_file(std::string const matfile, int const line_number)

Detecting of the file believe is the following function in [1]:

line 1556: inputfile.str( vin::get_string(matfile.c_str(), "material", line_number) )

For unitcell.ucf,  believe that is read by the following function in read.cpp [2]:

line 29: void read_unit_cell(unit_cell_t & unit_cell, std::string filename)

Detecting of the file believe is the following function in [2]:

line 38: inputfile.str( vin::get_string(filename.c_str(), "input", -1) )


Kind Regards,
Gavin
VAMPIRE user

On Friday, August 1, 2025 at 2:36:37 PM UTC-6 baradwa...@gmail.com wrote:
Hello Vampire users,
I am working on simulation that would require a custom heating profile that doesn't exactly follow a 2 Temperature model but rather an ultrafast heat transfer from a bilayer heterostructure. In order to generate a custom temperature profile , I have a defined a heat transfer problem in COMSOL and obtained a numerical solution since finding an exact analytical solution would be too complicated. My plan is to save this solution of T vs t as .txt file with all datapoints and write a modified temperature pulse routine , however , I am still wondering on what is the best way to load this file. Ideally , I would like to place my temperature.txt file in the same directory as material.mat and unitcell.ucf so I can spawn copies while parallel computing. However I don't know which file is responsible for detecting these files and reading them from the directories.

Richard Evans

unread,
Aug 4, 2025, 4:40:38 AMAug 4
to Vampire Users
Hi,

For this problem I would just load in the file directly in the temperature pulse program, something like:

std::ifstream ifile("Tvst.txt");

std::vector<double> temp;

for(int i =0; i<10000; i++){
  double inT;
  ifile >> inT;
  temp.push_back(inT)  
}

In parallel every process would read this which is ok for up to a few hundred CPUs.

Cheers,

RIchard

Peela baradwaj naidu

unread,
Aug 5, 2025, 5:14:44 PMAug 5
to Vampire Users
Thank you for the suggestions , I have tried making some initial changes and vampire recompiles with new files no problem. but however , my temperature remains constant and does not change , my suspcion is that either I am loading temperature into a wrong variable or not scaling temperature properly because by default my temperature file has time in ps not seconds. For some reason , my temperature remains the same as Teq throughout the simulation.
temperature.txt
temperature_pulse.cpp

gabo...@gmail.com

unread,
Aug 23, 2025, 7:49:02 PMAug 23
to Vampire Users
As shown below, it looks like the interpolated temperature pulse can be obtained in the output file from your temperature.txt input.

username@computername:~$ cd ~
username@computername:~$ git clone --branch main https://github.com/richard-evans/vampire.git vampire
...

Used attached sim.cpp to replace ~/vampire/hdr/sim.hpp
Used attached match.cpp to replace ~/vampire/src/vio/match.cpp
Used attached temperature_pulse.cpp to replace ~/vampire-develop/src/program/temperature_pulse.cpp
- Note: This is temperature_pulse.cpp from [1] but two lines had to be changed in it for it to compile.  The two lines were:
  const double slow_time = sim::spin_lifetime;
const double fast_time = sim::phonon_lifetime;
As a quick fix, they were changed to:
const double slow_time = 1.0;
const double fast_time = 1.0;
For that quick fix, the slow_time and fast_time values have to be set by hand.  The sim::spin_lifetime and sim::phonon_lifetime would need defined for being able to use them instead to set slow_time and fast_time.

username@computername:~$ cd vampire/
username@computername:~/vampire$ make serial GCC=g++-11
...
username@computername:~/vampire$ cd ~/custom_temp_profile/
username@computername:~/custom_temp_profile$ ls -l
total 20
-rw-r--r-- 1 username username 3528 Aug 23 05:52 cgt.ucf
-rw-r--r-- 1 username username 1989 Aug 23 15:23 input
-rw-r--r-- 1 username username  816 Aug 23 15:23 material.mat
-rw-r--r-- 1 username username 2137 Aug 23 14:54 temperature.txt
-rw-rw-r-- 1 username username  182 Aug 23 16:33 timeVsT

Note: temperature.txt is at [1].  The cgt.ucf is at [2]. The material.mat is at [3]. input is the input0 file at [4] but with some changes.

The input0 file had:
sim:laser-pulse-temporal-profile=two-temperature
sim:equilibration-time-steps=10000
sim:total-time-steps= 50000
sim:time-step=1E-15
sim:program=temperature-pulse

For input, the above lines were changed to:
sim:laser-pulse-temporal-profile=custom-temperature
sim:equilibration-time-steps=1
sim:total-time-steps= 30000
sim:time-step=1E-14
sim:program=laser-pulse

username@computername:~/custom_temp_profile$ ~/vampire/vampire-serial
                                                _          
                                               (_)        
                    __   ____ _ _ __ ___  _ __  _ _ __ ___
                    \ \ / / _` | '_ ` _ \| '_ \| | '__/ _ \
                     \ V / (_| | | | | | | |_) | | | |  __/
                      \_/ \__,_|_| |_| |_| .__/|_|_|  \___|
                                         | |              
                                         |_|              

                      Version 7.0.0 Aug 23 2025 16:28:25

             Git commit: 525bc27ee44c525aee229570f30f3d4c61d54f66

  Licensed under the GNU Public License(v2). See licence file for details.

  Developers:   Richard F L Evans, Sarah Jenkins, Andrea Meo,
                Daniel Meilak, Andrew Naden, Matthew Ellis,
                Oscar Arbelaez, Sam Morris, Rory Pond, Weijia Fan,
                Phanwadee Chureemart, Pawel Sobieszczyk, Joe Barker,
                Thomas Ostler, Andreas Biternas, Roy W Chantrell,
                Wu Hong-Ye, Razvan Ababei, Sam Westmoreland,
                Milton Persson
 
                Compiler Flags:

  Vampire includes a copy of the qhull library from C.B. Barber and The
  Geometry Center and may be obtained via http from www.qhull.org.

================================================================================
Sat Aug 23 16:35:16 2025
================================================================================
Initialising system variables
Creating system
Reading in unit cell data from disk...done!
Processing unit cell data...
Processing data for 6 atoms...done!
Processing data from 114 interactions...done!
Verifying exchange interactions...done!
Generating neighbour list..........done!
Copying system data to optimised data structures.
Using isotropic form of exchange interaction with 114 total interactions.
Number of atoms generated: 13600
Preconditioning spin configuration at T = 10 K..........Done!
Preconditioning time for 10000 steps: 18.0623 s
Starting Simulation with Program Temperature-Pulse...
Simulation run time [s]: 48.5062
Simulation ended gracefully.
username@computername:~/custom_temp_profile$ gnuplot --persist timeVsT

temperature_pulse_from_file.png
Note: Temperature in the plot is from the output file.  Temperature Input in the plot is from the temperature.txt file.  For Temperature in the plot, the simulation was set to stop earlier than the end of the "Temperature Input" data at about 3 x 10 ^ -10.


Kind Regards,
Gavin
VAMPIRE user

temperature_pulse.cpp
input
sim.hpp
match.cpp
timeVsT
Reply all
Reply to author
Forward
0 new messages