GithubHelp home page GithubHelp logo

kunstrasenspringer / precice_st Goto Github PK

View Code? Open in Web Editor NEW
3.0 0.0 0.0 189.56 MB

Design und Implementation of system tests for the distributed multi-physics simulation package precCICE

Python 0.21% Shell 0.03% C++ 99.76%
openfoam simulation precice calculix su2 docker

precice_st's People

Contributors

kunstrasenspringer avatar

Stargazers

 avatar  avatar  avatar

precice_st's Issues

Prefer Python over system calls to compare results

Hey!

I had a brief look at the comparison scripts (such as compare_of-of.py).

I think it would be good to avoid calling system tools through Python wherever possible, as doing so decreases the portability (and in some cases, also the safety).

With this issue, I just want to draw your attention on Python packages such as difflib for computing deltas and re for regular expressions. I think they are also much easier to use!

OpenFOAM environment not defined correctly

Dear @kunstrasenspringer,

Trying to debug your problem mentioned in precice/tutorials#3, I noticed that defining the OpenFOAM environment inside a Docker container is not as trivial as in a normal installation.

First of all, keep in mind that every Docker step creates a new intermediate container, which is then deleted, together with its local environment. Therefore, sourcing the /opt/openfoam-dev/etc/bashrc file inside a dedicated RUN command is actually not changing anything. That's why you need to source it every time before running any OpenFOAM command.

Moreover, I noticed that even in this case, some paths, such as the FOAM_RUN are not set correctly, because the USER variable is not defined in this minimal environment. You can check the environment using env. One approach could be to use ENV USER=alice to add this manually in the environment, however there are probably better solutions for this. Maybe you can just invoke docker run in a better way to solve this.

On Dockerhub you can find many Dockerfiles for OpenFOAM, you may find a better approach there.

Here is a minimum working example, based on your Dockerfile.of-ccx:

FROM kunstrasenspringer/precice:latest

USER root
RUN apt-get update && apt-get install -y \
    software-properties-common \
    wget \
    apt-transport-https \
    libyaml-cpp-dev \
    bzip2 \
    libbz2-dev \
    cmake \
    automake \
    autoconf \
    autotools-dev \
    libarpack2-dev

# Install openfoam
RUN add-apt-repository "http://dl.openfoam.org/ubuntu dev"
RUN sh -c "wget -O - http://dl.openfoam.org/gpg.key | apt-key add -"
RUN add-apt-repository http://dl.openfoam.org/ubuntu && apt update
RUN apt-get -y install openfoam-dev --no-install-recommends

RUN rm /bin/sh && ln -s /bin/bash /bin/sh

USER alice
WORKDIR /home/alice

RUN source /opt/openfoam-dev/etc/bashrc

ENV USER=alice
ENTRYPOINT source /opt/openfoam-dev/etc/bashrc && env

Also, please check if wmake creates the FOAM_USER_LIBBIN if it does not already exist. If not, please open an issue on the OpenFOAM adapter and I will improve this later.

Good luck!

(by the way, I am not sure why you overwrite the shell binary, you may want to check this again)

Port to Python 3

Shouldn't be much effort, probably mainly wrapping parens around the print statements.

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.