Skip to content

J-Grf/masters-project

Repository files navigation

Master's Thesis Project Johannes Grafen:

Title: Artifical neural networks for Lagrangian point-particle models in particle-laden flows with arbitrary particle-size to mesh-spacing ratio

This repository contains the code used to train and test artificial neural networks (ANNs) that are embedded in the Lagrangian Particle Tracking (LPT) method of the multiphysics PDE solver framework m-AIA for simulations of particle-laden flow. The fluid phase is described using a lattice Boltzmann method (LBM) with D3Q27 velocity set and BGK-collision operator. The main objective of this work is to train ANNs to predict either an intermediate representation of the surface forces acting or the total hydrodynamic force acting on a particle, based on velocity samples that capture the flow field in the vicinity of the particle. Two simulation setups are used: a fixed particle in freestream flow and a particle settling in a quiescent fluid.

The intermediate representation of surface forces is constructed using a HEALPix surface tessellation of the particle surface. Each pixel is assigned a force composed of all contributions from particle distribution functions (PDFs) that intersect the particle surface through the pixel area. These distribution-based forces are written to an output file after applying the BFL bounce-back condition and the Momentum Exchange Algorithm and used to construct the target data for ANN training.

During coupled simulations, the ANN assists the LPT method in determining the cell-based particle force feedback. It predicts a surface representation of the particle's force feedback, which is then distributed to nearby cells within a kernel radius using distance-weighting with a semi-Gaussian kernel in direction of the pixel normal.

For further reading please refer to the corresponding thesis.

Getting Started

  1. Clone the repository:
  2. Setup and activate the virtual environment
  3. Create directory for training
  4. Setup the config.toml file and link code_NN/run.py in the directory
  5. Start training an ANN: python run.py config.toml

Training methodologies

Two Training approaches are used:

  1. Velocity samples and force data are directly inferred from the Particle Resolved - DNS
  2. Generating velocity samples from a LPT based simulation, where the particle is moved exactly according to the PR-DNS, the force data is directly inferred from the PR-DNS

To align input and output data for the datasets, a property timeStepFactor is used in the config file. This factor accounts for the difference in mesh resolution for LPT and PR-DNS simulations. For the approach 1), the velocity samples and surface force data are both extracted from the PR-DNS simulation, such that input and output data for the ANN training are measured at the same time (timeStepFactor = 1). For the approach 2), the input data are generated from a LPT simulation on a coarser grid compared to the PR-DNS. This requires a timeStepFactor = $\Delta x_{LPT} / \Delta x_{PR-DNS}$.

Things to note:

Tensor shapes:

MODE Input shape (1D x timesteps) Output shape (1D x timesteps)
force 3 * noVelSamplePoints (6 samples = 18) 3 (Body force)
momentumDist 3 * noVelSamplePoints (6 samples = 18) 3 * NPIXELS (force vector for each Healpix Pixel)
  • multiple input Files can be specified as a list in the toml file: ["bodyVicinitySampling_1.log", "bodyVicinitySampling_2.log"]
  • the data of the files is concatenated within the code
  • only LIMITATION: the sample points have to be the same

Standardization of data

  • Standardization on training data can be performed in three ways:

For example for 6 input samples (i.e. 18 input features) and 108 pixels (i.e. 324 output features)

METHOD Number Stds/Means
overall 1
dimensionwise 3 (x,y,z)
featurewise 18/324 (# Features)

Properties in config-file

  • inDim is determined automatically from velocitySamplePoints file
  • outDim is set automatically (for momentum dist according to NSIDE param)
  • noBodies is 1, for velocity Sample files containing data of multiple bodies this parameter has to be adjusted accordingly

Error assessment

  • Error is evaluated in the end of training on seperate test set that remains untouched during training
  • Total error is evaluated solely on x-component
  • mean relative Error in 1-norm and 2-norm for test set is determined for each dim seperately

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published