GithubHelp home page GithubHelp logo

jangaertner / unitmesh Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 27 KB

Create an OpenFOAM mesh with length 1 and n^3 cells without any IO

License: GNU General Public License v3.0

C 79.43% C++ 10.56% Shell 10.01%
mesh openfoam

unitmesh's Introduction

IO-Free Unit Mesh and Object Registry

For writing unit and/or integration tests in OpenFOAM it is useful to avoid IO calls as much as possible to be independent of the state of the case files. Creating a mesh and object registry without IO is however not possible by default in OpenFOAM. This repository provides a library with which a cubed, structured mesh with $n^3$ cells is created without any IO calls. Further, the library provides an independent object registry for creation of GeometricFields.

Compilation

Source your OpenFOAM environment and execute wmake in the src folder

Usage

#include "unitMesh.H"

int main()
{
    // start of your case
    ...

    // create the object uMesh with 10^3 cells
    // Optional: provide a path to where objects are written if write()
    //           is called. (Defaults to: rootPath='./')
    fileName rootPath = "PATH_TO_MY_TESTS";
    // Optional case name. By default empty
    word caseName;
    unitMesh uMesh(10,rootPath,caseName);
    
    // Get the mesh
    const fvMesh& mesh = uMesh.mesh();

    // Create a volScalarField on that mesh
    volScalarField testField
    (
        IOobject
        (
            "test",
            uMesh.runTime().timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        mesh,
        dimensionedScalar("test",dimless,1E+5)
    );
}

unitmesh's People

Contributors

jangaertner avatar

Stargazers

Gregor Olenik avatar

Watchers

 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.