Skip to content

Fortran code to interpolate between regular and unstructured grid (e.g. triangle mesh).

Notifications You must be signed in to change notification settings

ChristianSteger/grid_interpolation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

Fortran code to interpolate from regular to unstructured grid (e.g., triangle mesh) and vice versa. The former interpolation is performed with bilinear interpolation, the latter with inverse distance weighting (IDW) and the application of a k-d tree to efficiently find the nearest neighbours. For an equally spaced regular grid (esrg) – i.e., a grid with an equal spacing in the x- and y-direction – an even faster algorithm for IDW interpolation is implemented.

Usage

Create conda environment

conda create -n grid_interpolation numpy scipy matplotlib ipython gfortran meson openmp -c conda-forge

Compile Fortran code and build shared library for F2PY (tested on MacOS)

gfortran -shared -O3 -o libkd_tree.so -fPIC kd_tree.f90
gfortran -shared -O3 -o libquery_esrg.so -fPIC query_esrg.f90
cwd=$(pwd)
f2py -c --f90flags='-fopenmp' -lgomp --fcompiler=gfortran -L${cwd}/ -I${cwd}/ -lkd_tree -lquery_esrg -m interpolation interpolation.f90

Clean build

rm *.so *.mod

To do

About

Fortran code to interpolate between regular and unstructured grid (e.g. triangle mesh).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published