Giter Club home page Giter Club logo

ellipticmeshgenerator's Introduction

Elliptic mesh generator for 3D geometries

This repository contains the code to generate elliptic-smoothed meshes for three dimensional geometries. The geometry is user-specified. Stretching functions are implemented to cluster the mesh at appropriate regions in the domain, and a elliptic equation based smoothing algorithm is implemented to smooth the mesh.

Final mesh images

Elliptic mesh
Elliptic mesh
Elliptic mesh

Compilation and running

mpicxx -std=c++14 EllipticMeshGenerator.cpp -o out
./out

Inputs

The input geometry is user defined. This example consists of a half-ellipsoid.

Outputs

  1. The code outputs a mesh file_mesh.vtk which is an ASCII VTK file of the structured mesh
  2. A bc.dat file which contains the boundary conditions for the bottom wall
  3. Files file_bc_wall.vtk and file_bc_farfield.vtk which are vtk files to visualize the wall bc regions for the hump region vicinity

Mesh stretching

Consider stretching in the x coordinate centered at a position pos (as a percentage of domain length from xmin). For the case of the ellipsoid, for eg., the center of the ellipsoid is at a $x=1.0$, and domain length is $3.0$. Hence $\mathrm{pos} = 0.333$ is an appropriate choice. The stretching is done using hyperbolic tangent functions as below

$\xi = i/nx-1$, where i is the index
$u1 = \mathrm{tanh}(\delta(1-\xi))(1-\mathrm{pos})$
$u2 = \mathrm{pos}\times(2-\mathrm{tanh}(\delta\xi))$
$\mathrm{fac} = 1-((u1+u2)-\mathrm{pos})$
$x = \mathrm{xmin} + \mathrm{fac}\times(\mathrm{xmax}-\mathrm{xmin})$

The smoothing algorithm

The elliptic governing equation is solved for the y coordinate to smooth the mesh. In this particular geoemtry, the x and z directions only need appropriate stretching and no smoothing is necessary.

$\alpha_{11}\cfrac{\partial^2 y}{\partial \xi^2} + 2\alpha_{12}\cfrac{\partial^2 y}{\partial\xi\partial\eta} + 2\alpha_{13}\cfrac{\partial^2y}{\partial\xi\partial\zeta}+\alpha_{22}\cfrac{\partial^2y}{\partial\eta^2}+2\alpha_{23}\cfrac{\partial^2y}{\partial\eta\partial\zeta}+\alpha_{33}\cfrac{\partial^2y}{\partial\zeta^2} = 0$

where

$\alpha_{11} = a_{22}a_{33}-a^2_{23}$, $\alpha_{12}=a_{13}a_{23}-a_{12}a_{33}$, $\alpha_{13}=a_{12}a_{23}-a_{13}a_{22}$
$\alpha_{22} = a_{11}a_{33}-a^2_{13}$, $\alpha_{23}=a_{13}a_{12}-a_{11}a_{23}$, $\alpha_{33}=a_{11}a_{22}-a^2_{12}$

where as are defined for eg. as

$a_{12} = a_{\xi\eta} = \frac{\partial x}{\partial\xi}\frac{\partial x}{\partial\eta} + \frac{\partial y}{\partial \xi}\frac{\partial y}{\partial\eta}$ $+ \frac{\partial z}{\partial \xi}\frac{\partial z}{\partial\eta}$

The derivatives are approximated using second-order finite differences, and an iterative Gauss-Siedel approach is used to solve the elliptic pde.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.