Tutorial: Understanding the structure of TorchPhysics
In this tutorial, you will learn how the different components of TorchPhysics work and interact. In the end, you will be able to transform a simple differential equation into the corresponding training setup in TorchPhysics.
We start by explaining the basic structure of this library. Then we will go over each important part in its own tutorial. Finally we will bring everything together to solve a PDE using the PINN-approach.
The structure of TorchPhysics can be illustrated via the following graph:
- Spaces
Define the dimension of the used variables, parameters and model outputs. This is the starting point for all problems and shown in the spaces and points tutorial. The tutorial also covers the way the library stores and creates points.
- Domains
Handle the creation of the underlying geometry of the problem. See:
Domain basics to learn everything about the definition and functionalities
Polygons and external objects to create 2D or 3D polygons and import external files
- PointSampler
Control the creation of sampling points for the training/validation process. The usage is explained in the PointSampler tutorial.
- Models/Parameters
Implement different neural network structures and trainable parameters. How to define a model is shown in the model creation tutorial.
- Conditions
Combine the created Domains, PointSampler and Models to apply the conditions induced by the differential equation. See condition tutorial on how to create different kinds of conditions for all parts of the problem.
- Solver
Handles the training of the defined model, by applying the previously created conditions. The usage of the solver is shown the beginnig example for solving a simple PDE. More details of the trainings process are mentioned here.
- Utils
Implement a variety of helper functions to make the definition and evaluation of problems easier. To get an overview of all methods, see the docs. Two parts that will be shown more detailed, are:
The usage of the pre implemented differential operators
Creating plots of the trained solutions.