Coder Social home page Coder Social logo

ofjulia's Introduction

OFJulia

This is an example repository to show usage of precompiled OpenFOAM applications through the OpenFOAM_com_jll package from within Julia.

Usage (Linux x86_64 ONLY for now)

  1. Install Julia (if not yet installed) with the command curl -fsSL https://install.julialang.org | sh. This will install juliaup and will use it to install the latest version of julia.
  2. Run the test case with the command julia ofavalanche_test.jl. This will take some time to finish. If no errors are thrown, the test case ran successfully :)

What's the deal with OpenFOAM helper scripts/functions?

Although these are usability features, at the core they are just shell scripts. For a simple explanation see this blog post. For detailed understanding, see the OpenFOAM source code here

How do we make it work?

See the ofavalanche_test.jl file. Here we try to mimic the synthetic-slope-elliptic-hemisphere/Allrun-serial shell script by directly calling the corresponding executables from the OpenFOAM_com_jll package.

Allrun Shell Script

#!/bin/sh
cd "${0%/*}" || exit                            # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions    # Tutorial run functions
#------------------------------------------------------------------------------

runApplication gridToSTL

if [ "$WM_LABEL_SIZE" = 64 ]
then
    echo "Skip tutorial - known issues with pMesh and 64-bit labels"
    echo End
    exit 0
elif command -v pMesh > /dev/null
then
    runApplication pMesh
else
    echo "Skip tutorial - no pMesh found"
    echo End
    exit 0
fi

runApplication makeFaMesh

# Restore initial fields
restore0Dir

runApplication releaseAreaMapping

runApplication $(getApplication)

#------------------------------------------------------------------------------

ofavalanche_test.jl Julia Script

import Pkg
Pkg.activate(".")
Pkg.instantiate()

using OpenFOAM_com_jll

cd("synthetic-slope-elliptic-hemisphere/")

run(gridToSTL())
run(pMesh())
run(makeFaMesh())
# restore0dir
cp("0.orig", "0")
run(releaseAreaMapping())
run(faSavageHutterFoam())

ofjulia's People

Contributors

thealanjason 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.