Skip to content
Public template

About

Finite Element method project

Topics

Resources

Stars

0 stars

Watchers

3 watching

Forks

Repository files navigation

C++ Finite Element Method Project

This repository contains the code, LaTeX files, and other resources for the C++ Finite Element Method (FEM) project. The project involves solving a Poisson-type partial differential equation (PDE) in a 2D domain using FEM and includes documentation and source code to guide students through the implementation, testing, and reporting process.

Important
Update this file by the end of the project to describe your repository structure and the exact commands needed to build, test, and run your code.

Template Status and Course Guidelines

This is an individual project: each student maintains their own repository, report, and AI usage journal.

This repository provides the scientific project brief, meshes, two C++ examples, and a report template. Students must implement the CMake build, tests, CI, and Docker setup; these are not preconfigured. Creating a repository from this template does not automatically configure branch protection, permissions, or GitHub Classroom.

The dates and grading weights in project.tex are historical. Instructors will confirm the requirements for the new cohort.

Repository Structure

  • project.tex: The main LaTeX file for the project, describing the objectives, methods, and overall instructions for solving the FEM problem.

  • report.tex: A template for the students to use when writing their project report.

  • meshes/: Contains various mesh files (.msh) that students will use for their FEM simulations.

  • src/: Contains sample C++ code to help students get started with FEM implementation.

  • tex/: Includes LaTeX macros used by project.tex and report.tex.

  • .vscode/: VSCode configuration for LaTeX settings, ensuring consistent formatting and build processes for LaTeX documents.

Getting Started

Prerequisites

To work on this project, you’ll need the following tools installed:

C++ Compiler

Ensure you have a C++ compiler like g` or `clang.

Eigen Library

Eigen is used for linear algebra in this project.

Gmsh

Gmsh is used for generating mesh files.

LaTeX

For generating project reports and reading project documentation.

Git

Version control for tracking your progress and submitting your project.

VSCode with LaTeX Workshop

Recommended editor for LaTeX. The .vscode/ directory contains settings for this.

Shared Style and Compilation

The project brief and report share the tex/csmi.sty style (cover page, typography, colors, and callout boxes). See the style documentation for customization instructions. The .latexmkrc configuration places generated PDFs in output/pdf/. Students must configure their CI to retain these PDFs as artifacts.

Using the LaTeX Files

project.tex

This file contains detailed project instructions. Compile it with:

latexmk -pdf -interaction=nonstopmode -halt-on-error project.tex
report.tex

Use this template to create your project report. Customize it with your own content, results, and analysis. Compile it similarly:

latexmk -pdf -interaction=nonstopmode -halt-on-error report.tex
Note
The VSCode settings provide LaTeX Workshop recipes that use latexmk to compile documents from the editor.

Project Workflow

Version Control with GitHub

Repository Setup

Clone this repository to your local machine:

git clone <YOUR_INDIVIDUAL_REPOSITORY_URL>
cd <REPOSITORY_NAME>
Branching

Create a separate branch for each issue, feature, or bug fix:

git checkout -b <BRANCH_NAME>
Commits

Make commits regularly with meaningful messages:

git commit -m "Implemented FEM solver"
Pull Requests

When ready, push your branch and open a pull request (PR) to merge changes into the main branch. Configure your CI to check that the code builds, runs, and passes its tests on each PR. Use PRs to record self-review and instructor feedback.

Note
GitHub Classroom can create a feedback PR if instructors enable that feature. Creating a repository from this template alone does not create this PR.

Continuous Integration (CI)

Students must set up GitHub Actions to compile and test the code on pushes and pull requests. Create the configuration in .github/workflows/; no workflow is supplied in this starter. To set up CI:

  1. Write unit tests for your FEM code.

  2. Ensure tests are automatically run with each PR by configuring GitHub Actions.

Containerization with Docker

To make your project easily reproducible, you have to containerize it using Docker. The repository can include a Dockerfile that compiles and runs the C++ code inside a Docker container:

docker build -t fem_project .
docker run fem_project
Note
The Docker image must be built by your GitHub Actions workflow.

Documentation

Project Overview

The project covers the following key topics: - Solving Poisson-type PDEs using FEM. - Meshing using Gmsh and processing meshes in C++. - Post-processing of results using ParaView.

Report Guidelines

Use report.tex to structure your project report, including: - A brief description of the project. - Explanation of the algorithms and code structures. - Results obtained from running your FEM solver. - Analysis of the results (e.g., convergence behavior, accuracy, performance).

License

This project is licensed under the MIT License.

About

Finite Element method project

Topics

Resources

Stars

0 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages