Git Product home page Git Product logo

iapws's Introduction

Introduction

ipaws is a Fortran library providing the formulas for computing light and heavy water properties. The formulas are taken from http://iapws.org. C API allows usage from C, or can be used as a basis for other wrappers. Python wrapper allows easy usage from Python.

For now, I have implemented

  • R2-83
    • Tc in H2O and D2O
    • pc in H2O and D2O
    • rhoc in H2O and D2O
  • G7-04
    • kH
    • kD
  • R7-97
    • Region 1
    • Region 2
    • Region 3
    • Region 4
    • Region 5

To use iapws within your fpm project, add the following to your fpm.toml file:

    [dependencies]
    iapws = { git="https://github.com/MilanSkocic/iapws.git" }

Dependencies

gcc>=10.0
gfortran>=10.0
fpm>=0.7
stdlib>=0.5

Installation

A Makefile is provided, which uses fpm, for building the library.

  • On windows, msys2 needs to be installed. Add the msys2 binary (usually C:\msys64\usr\bin) to the path in order to be able to use make.
  • On Darwin, the gcc toolchain needs to be installed.

Build: the configuration file will set all the environment variables necessary for the compilation

    chmod +x configure.sh
    . ./configure.sh
    make

Run tests

    make test

Install

    make install

Uninstall

    make uninstall

License

MIT

iapws's People

Contributors

milanskocic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

iapws's Issues

Tests

Rewrite tests with test-drive.

Restructure code as independent modules

Proposed changes

The objective is to separate modules for the sake of clarity when calling functions

  • Remove the global IAPWS.f90 module
  • Access directly the desired functions in the dedicated module e.g. iapwsG704_kh_water()
  • Create C API headers for each module
  • Translate the structure in the python wrapper as well e.g pyiapws.iapwsG704.kh_water()

r797

Implement all equations.

version module

Rewritte the version module without autogeneration and create a getter.

kh and kd as elementary functions

Changes

The iapws_G704_kh and iapws_G704_kd functions might turned into elementary functions in order to improve performance when looping over a range of temperatures.

Currently, those two functions work only on scalar inputs for temperature. If a range of temperatures needs to be computed a loop is needed in the calling the procedure.

Code modification

iapwsG704.f90

This change would imply that the functions:

  • iapws_kh
  • iapws_kd
  • iapwsG704_kh_water
  • iapwsG704_kh_heavywater
  • iapwsG704_kd_water
  • iapwsG704_kd_heavywater

will become subroutines that need to accept an assumed-shape array of rank-1 for the temperature T(:) and an assumed-shape array for the result kh(:).

iapws_capi

By cascading those modifications to the C API, they would imply that the functions:

  • iapws_capi_kh
  • iapws_capi_kd

would also become subroutines that need also to accept an assumed-shape array of rank-1 for the temperature T(:) and an assumed-shape array for the result kh(:).

The C header needs to be modified:

  • turn all functions into void functions
  • change scalar T to a pointer *T
  • add a pointer for the result *kh
  • add a scalar for the size of the array size_t n

Python Wrapper

The calling python functions will not change. The changes needs to be done in the C extension on how to handle input data coming from Python.

  • send reference for scalar inputs
  • send buffer pointer for array inputs.

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.