# Pseudo-spectral solver for the heat equation
(SP4E 2018, Homework 3)
Authors: Sajjad Azimi, Alessia Ferraro
## Description
The main.cc program is written to construct and solve a physical problems related to system of particles. In this specific
case the goal is to solve the 2-dimensional heat equation to describe the variation of temperature over time when a source
term is present.
The primitive equation is solved via a pseudo-spectral method, making use of finite differences in time and spectral
discretization in space with Fourier expansion in x and y directions.
The relevant classes for the implementation are the followings:
* **MaterialPoint**: Class derived from Particles, containing spatially located virtual massless particles that carry a
temperature and a heat transfer coefficient.
* **MaterialPointFactory**: Class responsible for the creation of the specific simulation that solves the heat transfer equation.
It derives from the ParticleFactory interface and builds the system with the suitable type of particles and solver.
* **Matrix**: Storage Class for the temperature and the heat-transfer values of each particles in the domain. Each element (i,j)
represents a position in the physical space with the corresponding values of these scalar quantities.
* **FFT**: Wrapping interface for FFTW. Class responsible to compute forward and backward DFT for input matrices.
* **ComputeTemperature**: Solver class responsible for the time integration of the heat equation. At each time-step the
right-hand side (spatial derivatives and source term) is evaluated in the Fourier space, then transformed back to the
physical space and used to update the Temperature distrubutions for the next iteration. Although a stationary
source term does not require to be evolved in time (and to be computed in the spectral space at each time step) we decided
to keep a general structure as much as possible in order to allow for future implementation of routines to handle with
time-dependent source terms.
### Initial conditions for Temperature and Heat-rate distributions
The python script `TH_gen.py` generates the initial conditions for the temperature and heat source terms in a given domain
as follow:
* **Heat-rate** is uniformly distributed within a circular portion of radius R of the simulation box and zero elsewhere
* **Temperature** can be homogeneously zero or follow a multivariate Gaussian distribution with given mean and covariance values.
For both the scalar quantities parameters are set in order to satisfy zero homogeneous boundary conditions.
The output is then saved to a .txt file containing as many rows as grid points and 12 columns
( x, y, z, vx, vy, vz, Fx, Fy, Fz, m, T, h )