Passer au contenu principal
SciNet
  • Accueil
  • Tous les cours
  • Calendrier
  • Certificats
  • SciNet
    Site principal Documentation my.SciNet
  • CCDB
  • Plus
Fermer
Activer/désactiver la saisie de recherche
Français
English Français
Vous êtes connecté anonymement
Connexion
SciNet
Accueil Tous les cours Calendrier Certificats SciNet Replier Déplier
Site principal Documentation my.SciNet
CCDB
Tout déplier Tout replier
  1. Tableau de bord
  2. PHY1610 - Winter 2024
  3. Assignment 6: Inhomogeneous PDE using LAPACKE

Assignment 6: Inhomogeneous PDE using LAPACKE

Conditions d’achèvement
Ouvert le : jeudi 7 mars 2024, 23:00
À rendre : jeudi 14 mars 2024, 23:59

In this assignment, we want to numerically solve the Laplace equation for the electric field in an inhomogeneous 1d medium, using LAPACKE.

For our problem, the domain for the electric field \(V\) is the unit interval \(x\in[0,1]\), with boundary conditions \(V(x=0)=0\) and \(V(x=1)=1\). The Laplace equation to solve is

$$\frac{d}{dx}\left[\epsilon(x)\frac{dV}{dx}\right] = 0$$

where the inhomogeneous dielectric constant is (in arbitrary units) given by

$$\epsilon(x)=1+10\cos^2(2\pi x)$$

Use a discretization scheme where the \(x\) axis will be discretized into \(N+1\) points, such that \(x_i=i\Delta x\), with \(\Delta x=1/N\).  

The boundary conditions become \(V_0=0\) and \(V_N=1\).

The discretization of this Laplace equation needs to take into account the \(x\) dependence of \(\epsilon\). To \(O(\Delta x^2)\) , this works out as follows:

$$\frac{d}{dx}\left[\epsilon(x)\frac{dV}{dx}\right]_{x=x_i}$$

$$\approx \frac{\epsilon(x+\Delta x/2)V_{i+1}+\epsilon(x-\Delta x/2)V_{i-1}-\{\epsilon(x+\Delta x/2)+\epsilon(x-\Delta x/2)\}V_i}{\Delta x^2}$$

This holds for \(i>0\) and \(i<N\). 

If we denote by \(v\) the \(N-1\)-dimensional vector \((V_1,V_2,..,V_{N-1})\), we can write the discretized equation as

$$\mathbf{A}\cdot v = b$$

where \(\mathbf A\) is an \(N-1\) x \(N-1\) "tri-diagonal" matrix, and \(b\) is an \(N-1\) dimensional vector \((0,...,0,-\epsilon(x+\Delta x/2)V_N/\Delta x^2)\) (that is, unless you factor out the common factor of \(1/\Delta x^2\)).

Your task for this assignment is as follows

  • Install openblas on your Teach cluster account.
  • Construct the matrix \(\mathbf{A}\) and vector \(b\), and write a program to solve the equation for \(v\)in double precision using a solver routine from LAPACKE that can take advantage of the tri-diagonal form of the matrix.
  • Store both the values of \(\epsilon\) and the solution for V on the grid in a netcdf file.
  • N can be an input value. The output should be the one produced for N=10000.

As usual, use git and make.  Modularity is not a requirement in this assignment, but your code should use functions.  Submit your repo as a zip file.


Contacter l’assistance du site
Vous êtes connecté anonymement (Connexion)
Résumé de conservation de données


All content on this website is made available under the Creative Commons Attribution 4.0 International licence, with the exception of all videos which are released under the Creative Commons Attribution-NoDerivatives 4.0 International licence.
Fourni par Moodle