# SP4EHW_IM/HW3854fc74beddcmaster

# HW3

# README.md

## Homework 3 - Heat equation solver

### Exercise 1

#### MaterialPoint:

It's a derived class from the Particle class. Like usual it includes the printself and initself methods. Additional class-specific public methods were added such as getTemperature and getHeatRate.

#### matrix structure (header):

In this header file *.hh file; includes the implementation as well. This procedure could reduce the number of files needed and will reduce the circular relationship between objects. Although it will increase the compilation time (The whole code will be added to the referenced files).

In general, this file serves as an interface to manage the matrices operations in the particles system overall. The templated methods allow the user to allocate any kind of data matrices (doubles, ints ..etc).

**MatrixIterator**is a struct to manipulate and override the indices using operators such as *,++ and !=.**Matrix**is a templated struct that got two constructors (overloading methods) and allow to initialize a matrix entity in general. It has certain attributes that can be returned like the number of rows or columns and the overall size. A resize method has been added to alter the size of the matrix after initializing an empty entity for example. Operator accessor () has been added to manipulate elements of the related metrics. An element-by-element operation has been added /= to divide the elements by a certain numerical value. begin() and end() pointers have been defined to facilitate iterations over the storage of the matrix (iterators methods).

#### MaterialPointsFactory:

This class is the general framework for initializing material particles and triggering the simulation (creatSimulation) and returns the number of particles involved in the simulation once initialized. It will make a general checkout over the number of the provided particles and will throw a run-time exception if the system was not square.

#### FFT:

This wrapping interface will manipulate directly the FFTW3 library in order to process the operations of computing Forward and Inverse FFT. In addition, it will compute the frequencies out of the resulted operations from the Forward and Inverse FFTs'. The normalization in relation to the sample size has been performed in this step.

### GTEST Exercise 3

Google test has been written, run and passed for the exercise no. 3.

A python file should be found at "PythonTest" folder. The file can be triggered by using:

ipython3 test_fft.py N(The size of the matrix), 1/2 (Dimention) , Name(Optional)

(Default values for no inputs will be N = 5 and Dim = 1)

### Exercise 4

In order to solve to transient heat equation in two dimensions , the approach based on Fourier series is used. Using fourier transform in the first part of the code we've transformed the equation to ordinar differential one, which is solveable with an explicit time integrator. Once it is solved, we perform the inverse transform (pre-programmed in the previous section) in order to compute the temperature.

### Exercises 4.2 - 4.4

Due to strict deadlines related to our lab's projects, unfortunately were forced to pass this part of the homework.

#### Exercise 4.5

The way to produce dumps observable with paraview is to dump the output as a CSV file. Afterwards, it is possible to load the dump in the Paraview and apply table to point filter. Finally, using "glyph" filter, and setting up the other properties, we can calibrate the graphical output.

Parts of the code related to the computation of the temperature are not working due to the problems with operators.