dealii-courses / sissa-mhpc-lab-02-

sissa-mhpc-lab-02-

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lab 02 - Triangulation, DoFHandler, FiniteElement

Theory and Practice of Finite Elements

Luca Heltai luca.heltai@sissa.it


Setup

  • You will need the following programs:
    • Visual Studio Code with the Remote Development plugin installed
    • Paraview (ver > 5.4 would be better)
  • Check that the .devcontainer directory contains a configuration that works foryou. When you open the root directory of the repository, it should prompt you toreopen in container. If not, try explictily with the command F1 -> Reopen folder incontainer
  • If opening in container worked, you should be able to run a terminal (CTRL + ~)and see something like
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
dealii@3f25621373bd:/workspaces/02_tria_dh_fem$ 
  • The folder contains a CMakeLists.txt file. VSCode should detect this, and providecommands to configure and build your application, at the bottom of the terminal window

Setup if you have ubuntu/debian and DO NOT want to use Docker

In this case you can copy the commands from the docker image that you can find here:

to install all the dependencies. After this, you can install the latest version of the library using the commands you find here:

Lab-02: step-1

  1. Read the documentation of step-1 at
  2. Compile and run step-1 inside the VSCode container and look at the output.
  3. Understand what happens if you now call first_grid(triangulation) and second_grid(triangulation) one after the other. Fix the problem you get, without creating a second triangulation, or without going out of scope, and make sure your main function works correctly.
  4. Create an image of an L-shape domain (add a function third_grid to step-1) with one global refinement, and output it as third_grid.vtk using the GridOut::write_vt() function.
  5. Refine the L-shaped mesh adaptively around the re-entrant corner three times (after the global refinement you already did), but with a twist: refine all cells with the distance between the center of the cell and re-entrant corner is smaller than 2/3.
  6. Create a helper function that takes a reference to a Triangulation and returns a tuple with the following information: number of levels, number of cells, number of active cells. Test this with all of your meshes.
  7. Un-comment the triangulation.reset_manifold(0) line in second_grid(). What happens now? Write your findings as a comment under the line in the file, and leave the command commented out after you experimented with it.
  8. Bonus: Create a mesh that represents the surface of a torus and refine it 2 times globally. Output to vtk format and check the output. Note that your Triangulation needs to be of type Triangulation<2,3>, which we will discuss later this week.
  9. Bonus: Take a look at step-49 and read the included .msh file in your modifiedstep-1 program.

Lab-02: step-2

  1. Read the documentation of step-2 at

  2. Run step-2. Look at the sparsity patterns in your browser.

  3. How does the pattern change if you increase the polynomial degree from 1 to 2 orto 3?

  4. How does the pattern change if you use a globally refined (say 3 times) unitsquare?

  5. Are these patterns symmetric? Why/why not?

  6. How many entries per row in the sparsity pattern do you expect for a Q1 element (assuming four cells are around each vertex)? Check that this is true for the mesh in b) (look for row_length(i) and output them for each row). Can you construct a 2d mesh (without hanging nodes) that has a row with more entries?

  7. How many entries per row in the sparsity pattern are there for Q2 and Q3 elements, again assuming four cells around each vertex?

  8. Print all entries for row 42 for the original renumbered sparsity pattern.

  9. Bonus: Compute and output statistics like the number of unknowns, bandwidth of the sparsity pattern, average number of entries per row, and fill ratio.

About

sissa-mhpc-lab-02-

License:MIT License


Languages

Language:C++ 84.5%Language:CMake 7.8%Language:Shell 6.8%Language:Dockerfile 1.0%