This repository has been forked from the LehrFEM++ repository, all the files relevant to the Master thesis can be found in the folder cylinder_test
This repository contains:
- The LehrFEM++ library
- A program used to solve the Eddy current equation with iterative methods BDF-1/2
- Programs used to solve the Eddy current equation with ROW methods on a static mesh ROW-static and a rotating mesh ROW-rotating
- A script to compute the L2 norm of a solution computed with iterative methods or ROW benchmarking.
ROW Wanner methods promise to avoid expensive iterations in timestepping, while still having a high order. This repository is used to put ROW to the test for the simulation of Eddy currents in electrical machines. ROW methods have been already used to simulate Eddy currents, but this has been limited to static meshes. Here we adapt the method to rotating geometries.
First, LehrFEM++ needs to be installed, which can be done with CMake. After you clone the repository, create a build folder at the top level, and run CMake:
$ clone https://github.com/luca-commits/ROW_engines
$ mkdir build
$ cd build
$ cmake ..
Then move the folder of this project and compile the code:
$ cd projects/cylinder_test
$ make -j16
Then the folder structure needs to be reproduced in the build folder:
vtk_files/
├── time_dependent/
│ ├── non-linear/
│ │ ├── box_irregular_ring/
│ │ │ ├── bdf1/
│ │ │ └── bdf2/
│ │ └── transformator/
│ │ ├── bdf1/
│ │ ├── bdf2/
│ ├── row_dynamic/
│ └── row_static/
which can be done with the following command:
$ zsh create_folder_structure.sh
Copy the configuration files input-iterative, input-ROW-static, input-ROW-rotating to the build directory.
To run ROW on a static mesh:
$ ./projects.cylinder_test.row_static
To run ROW on a rotating mesh:
$ ./projects.cylinder_test.row_dynamic
To run BDF-1/2:
$ ./projects.cylinder_test.solve_non-linear
The number of timesteps and Newton iterations is the last output of the code.
Important note: only run a program at once when using rotating geometries.
The configuration of a simulation is managed with inputs file.
- The input of BDF-1/2 is: input-iterative
- The input of ROW static mesh is: input-ROW-static
- The input of ROW rotating mesh is: input-ROW-rotating
For BDF-1/2 the input file looks like:
# step size
1e-3
# total time
2e-2
# mesh, options: transformator, box_irregular_ring
transformator
# max_current
1e7
# conductivity
5.96e7
# exitation type, options: sinusoidal, ramp_up
sinusoidal
# exitation current parameter
50
# timestepping method
bdf_2
#geometry type, options: transformer, rotating_ring
transformer
#test mode
1
#adaptive // this parameter is only considere for Rosenbrock Wanner
1
#how frequently the timesteps are saved to vtk files
10.
Here comes the part that is a bit confusing:
- When using in test mode (creating the baseline, set test_mode = 1), step_size indicates the intervals at which the benchmark file is saved, and the actual step_size is computed by "how frequently the timesteps are saved to vtk files", so for example step_size=1e-3 and "how frequently the timesteps are saved to vtk files" = 10., results in step_size = 1e-4
- When using test_mode = 0 (actually running BDF-2 to see how it compares to ROW) step_size actually indicates the step size, and "how frequently the timesteps are saved to vtk files" should be set to match the timesteps at which the baseline has been recorded. For example if I have set the step_size to 1e-3 in baseline mode (test_mode=1), and I want to run BDF-2 with step_size 1e-4, then I need to set "how frequently the timesteps are saved to vtk files" to 10.
For the ROW input file, it is simpler, since the "saving step size" is explicitly defined:
# step size
6e-5
# total time
2e-2
# mesh, options: transformator, box_irregular_ring
transformator
# max_current
1e7
# conductivity
5.96e7
# exitation type, options: sinusoidal, ramp_up
sinusoidal
# exitation current parameter
50
# timestepping method, either bdf_1 or bdf_2
ROW
transformer
#test mode
0
#adaptive // this parameter is only considere for Rosenbrock Wanner
0
#saving step size, how often benchmark and visualization files are saved
1e-3
For ROW, some arguments are ignored, e.g. timestepping method, and test_mode. Explenation of the arguments:
- max_current: amplitude of the current, when using sinusoidal, an current to which the exitation linearly grows, when using ramp_up
- conductivity: in the geometry there are some conductive parts, like the conductive ring in the rotating geometry and the secondary coils in the transformer. This parameter sets the value of the conductivity in those regions.
- exitation type: ramp_up starts at 0, and linearly grows for a period defined by the exitation current parameter, and then stays constant.
- exitation parameter: defines frequency in sinusoidal, and growing time for ramp up
- adaptive: if 1 ROW will use adaptive timestepping, starting at step size defined by step_size parameter, and fixed timestep otherwise
The .vtk files are stored in the respective folders in the build folder. They can be visualized with the Paraview software: https://www.paraview.org/
The L2 errors of BDF-2 and ROW can be computed once the baseline (test_mode=1), BDF-2, and ROW have been computed.
This can be done by running:
zsh compute_L2_norm.sh transformator
Simple C++ Finite Element Framework for research and eduction optimzed for clarity and flexibility with some trade-off concerning performance. This libary is used for the course Numerical Methods for Partial Differential Euqations taught by Prof. R. Hiptmair at ETH Zurich.
- LehrFEM++ follows the Google C++ Style Guide.
- Adhere to the LehrFEM coding style guidelines.
- Whenever adding core functionality, thorough testing is mandatory, following the instructions in the testing guidelines.
- Doxygen Class Documentation
- Getting Started Guide
- Raffael Casagrande (core developer)
- Ralf Hiptmair (core developer)
- Tobias Rohner (
projects/ipdg_stokes
, hp-fem inlf::fe
) - Anian Ruoss (Second order Geometry, Mesh Generators)
- Philippe Peter (
projects/dpg
) - Amélie Justine Loher (
projects/FisherKPP
) - Gina Magnussen (TIKZ output)
- Julien Gacon (
lf::base::comm
) - Simon Meierhans