Giter Club home page Giter Club logo

adaptive-mesh-refinement's Introduction

AirShaper

Adaptive Mesh Refinement

OpenFoam® motorBike case with adaptive volume & surface mesh refinement based on curl(U) or grad(p)

Description

This repository provides adaptive mesh refinement for both the volume mesh and the surface mesh. Any field can be used for refinement. In this tutorial, two options have been included:

  • grad(p): the pressure gradient

  • curl(U): the curl of the velocity field

    Both are multipled by the cell length to "discourage" the algorithm to keep refining the smallest cells. The method has 3 major parts:

  1. Initial mesh

    SnappyHexMesh is run in two separate steps:

    • castellated mesh: only runs the refinement phase using "baffles" for the surface of the geometry (to avoid the mesh inside the geometry being cut and to keep all cells hexagonal). This mesh is stored in primal_refinement for use in the mesh refinement phase.
    • snapping phase: this part will cut the mesh (by also having castellated enabled) and snap it to the surface (by setting the surface patch type to wall). This mesh is used in primal_run for the first CFD loop.
  2. Refinement field

    Once the first CFD loop has finished, it maps the fields onto the stored castellated mesh (in primal_refinement) and calculates the refinement field (refVal), for which the lower limit value should be set manually in dynamicMeshDict.

  3. Mesh refinement

    The refinement is then applied to the castellated mesh of the first loop. Once refinement is done, the castellated mesh is copied to primal_run where the snapping phase is executed again to snap the refined mesh to the surface. This mesh is then used for the second CFD run.

Flow Chart Flow Chart

Conclusions

This method allows for mesh refinement of both the volume and the surface mesh.

In contrast to other OpenFOAM® based methods that refine on the surface, the mesh is re-snapped after refinement, which improves the correspondence to the real geometry.

Adaptive mesh refinement can greatly reduce the computational cost, as the mesh is applied in a more efficient way.

Any given field can be created to steer the mesh refinement. The gradient of pressure (useful for airfoils for example) and curl of the velocity field (useful for wake refinement for example) have been included.

We definitely welcome any contribution to further improve this method (for example, would it be easier to just use refineMesh instead of pimpleFoam?).

How to run the case

  1. Make sure you have installed latest OpenFoam® v2012
  2. Clone this repository on your machine git clone https://github.com/airshaper/adaptive-mesh-refinement.git
  3. Adopt primal_run/system/decomposeParDict depending on number of cores you have. Change numberOfSubdomains 6 to number of cores or threads you have available. Also modify n under coeffs to reflect numberOfSubdomains change. For example if you have 12 cores your n should be (3 2 2) if you have 16 cores for example then n should be (4 2 2) and so on.
  4. Go to cd ./primal_run then run ./Allrun

Results

Non-refined mesh slice Non-refined mesh

Refined mesh slice with curl(U) (notice how curl(U) refines the wake as well) Refined Mesh with curl(U)

Refined mesh slice with grad(p) (notice how grad(p) mostly refines the surface) Refined Mesh with grad(p)

Zoomed Non-refined mesh slice Zoomed Non-refined mesh)

Zoomed Refined mesh slice with curl(U) Zoomed Refined Mesh with curl(U)

Zoomed Refined mesh slice with grad(p) Zoomed Refined Mesh with grad(p)

Non-refined surface mesh Non-refined mesh

Refined surface mesh based on curl(U) Refined surface mesh based on curl(U)

Refined surface mesh based on grad(p) Refined surface mesh based on grad(p)

Custom calculated field refVal based on curl(U) Custom calculated field refVal based on curl(U)

Custom calculated field refVal based on grad(p) Custom calculated field refVal based on grad(p)

adaptive-mesh-refinement's People

Contributors

nikola-airshaper avatar

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.