Click the green "Use this template" button at the top of the page, then choose "Create a new repository".
This will create your own copy of this project, which you can modify freely — no need to fork!
| Term | Definition |
|---|---|
| SHG | Second Harmonic Generation |
| PW | Pulsed Wave |
| G | Gaussian |
Article title:
Heat coupled type II long-pulse second harmonic generation: a model for inclusion of thermal phase mismatching and thermal lensing
Table of Contents
This repository contains the toolkit and computational tools used in the research article "Heat coupled type II long-pulse second harmonic generation: a model for inclusion of thermal phase mismatching and thermal lensing", including source code, numerical solvers, and reproducibility assets.
This toolkit provides a comprehensive time-dependent three-dimensional spatial model for the mutual interaction of type II pulsed second harmonic generation and thermal effects in potassium titanyl phosphate (KTP) crystals. The model investigates how thermally induced phase mismatching (TPM) and thermal lensing reduce conversion efficiency and beam quality, revealing the key limitations to achieving higher efficiency in second harmonic generation systems.
The toolkit implements a complete solution for five coupled differential equations solved simultaneously using the Finite Difference Method (FDM). The coupled equations include: three field equations for fundamental ordinary wave (
The model considers Gaussian distribution for the transverse distribution of fundamental and second harmonic waves, depletion of pump waves during propagation along the
The numerical procedure presented here offers substantial reduction in runtime for modeling repetitively pulsed pumping toward steady-state conditions. The optimized code requires approximately 16 GB RAM and 1 minute to complete simulations on personal computers, enabling accurate investigation of how thermally induced phase mismatching and thermal lensing reduce conversion efficiency and beam quality in second harmonic generation systems. The numerical calculations use 120 × 12000 meshes for
Folder PATH listing
+---citation <-- Contains citation materials and papers
│ 1_Heat-Equation_Continu… <-- Heat equation analytical paper
│ 2_Heat-Equation_Continu… <-- Heat equation continuous wave paper
│ 3_Heat-Equation_Pulsed-… <-- Heat equation pulsed wave paper
│ 4_Phase-Mismatch_Pulsed… <-- Phase mismatch pulsed wave paper
│ 5_Ideal_Continuous-Wave… <-- Ideal continuous wave paper
│ 6_Ideal_Pulsed-Wave_Be… <-- Ideal pulsed wave Bessel paper
│ 7_Coupled_Continuous-Wa… <-- Coupled continuous wave paper
│ README.md <-- Citation guidelines and information
│
+---images <-- Contains project images and logos
│ SHG-banner.png <-- SHG project banner
│
+---results <-- Numerical simulation results
│ E_045_f_4000_Np_1_tp_50… <-- Elec12 radial distribution data
│ E_045_f_4000_Np_1_tp_50… <-- Elec12 time series data
│ E_045_f_4000_Np_1_tp_50… <-- Elec12 axial distribution data
│ E_045_f_4000_Np_1_tp_50… <-- Elec22 radial distribution data
│ E_045_f_4000_Np_1_tp_50… <-- Elec22 time series data
│ E_045_f_4000_Np_1_tp_50… <-- Elec22 axial distribution data
│ E_045_f_4000_Np_1_tp_50… <-- Elec32 radial distribution data
│ E_045_f_4000_Np_1_tp_50… <-- Elec32 time series data
│ E_045_f_4000_Np_1_tp_50… <-- Elec32 axial distribution data
│ E_045_f_4000_Np_1_tp_50… <-- Optimization index data
│ E_045_f_4000_Np_1_tp_50… <-- Phase radial distribution data
│ E_045_f_4000_Np_1_tp_50… <-- Phase time series data
│ E_045_f_4000_Np_1_tp_50… <-- Phase axial distribution data
│ E_045_f_4000_Np_1_tp_50… <-- Minimum phase data
│ E_045_f_4000_Np_1_tp_50… <-- Psi2 picks data
│ E_045_f_4000_Np_1_tp_50… <-- Psi3 picks data
│ E_045_f_4000_Np_1_tp_50… <-- Temperature radial data
│ E_045_f_4000_Np_1_tp_50… <-- Temperature time series data
│ E_045_f_4000_Np_1_tp_50… <-- Temperature axial data
│ E_045_f_4000_Np_1_tp_50… <-- Maximum temperature data
│
+---src <-- Contains source code
│ Code_SHG_PW_G_Coupled… <-- Fortran solver for coupled equations
│
LICENSE <-- Project license information
README.md <-- Project overview and documentation
To run this project, you will need the following software and tools: Fortran Compiler (Intel Fortran ifort is recommended, or gfortran as an alternative), Git for cloning the repository, Text Editor or IDE such as VS Code or Cursor with Fortran language support, and Terminal/Command Line Interface for compilation and execution.
For Ubuntu/Debian systems, Intel Fortran can be installed through Intel oneAPI toolkit. Alternatively, gfortran can be installed using sudo apt-get install gfortran. For macOS, gfortran can be installed via brew install gfortran. For Windows, install MinGW-w64 or Intel Fortran Compiler.
Follow these steps to get the project running:
Clone the Repository: Use git clone to obtain a local copy of the repository, then navigate into the project directory using cd SHG-PW-G-Coupled.
Navigate to Project Root: The source code is located in the src/ directory, but compilation should be performed from the project root directory.
Compile the Fortran Code: Use Intel Fortran compiler with the command ifort -o Code_SHG_PW_G_Coupled src/Code_SHG_PW_G_Coupled.f90. If Intel Fortran is not available, gfortran can be used as an alternative with gfortran -o Code_SHG_PW_G_Coupled src/Code_SHG_PW_G_Coupled.f90.
Run the Simulation: Execute the compiled program using ./Code_SHG_PW_G_Coupled. The program will prompt for input parameters including energy value, frequency, number of pulses, and pulse width. These can also be modified directly in the source code for automated runs.
View Results: The program generates output files in the results/ directory containing temperature distribution data, phase mismatch data, and electric field intensity data for fundamental and second harmonic waves. These files are in PLT format and can be analyzed using data visualization tools or imported into analysis software.
Development Environment: For enhanced development experience, open the project in VS Code or Cursor with Fortran language extensions installed for syntax highlighting and debugging capabilities. Use the integrated terminal for compilation and execution.
Note: Simulation parameters including energy, frequency, number of pulses, pulse width, crystal dimensions, and material properties can be modified directly in the Fortran source code (src/Code_SHG_PW_G_Coupled.f90) to explore different scenarios and crystal configurations. The code implements an optimized numerical procedure that significantly reduces computational requirements compared to initial implementations.
Please refer to the citation folder for accurate citations. It contains essential guidelines for accurate referencing, ensuring accurate acknowledgement of our work.
For questions not addressed in the resources above, please connect with Mostafa Rezaee on LinkedIn for personalized assistance.
