Skip to content

FOSSILFOrtran Surfaces, Solids, Immersed boundaries and Level sets

The geometry of complex bodies for simulation codes, in pure Fortran: triangulated surfaces and 2-D curves read and repaired, signed distances and level sets, immersed-boundary queries, AMR tagging, exact cut cells and moving bodies, on the CPU or bit-exact on the GPU.

the FOSSIL logo, an ammonite meshed in triangles and carved by lightthe FOSSIL logo, an ammonite meshed in triangles and carved by light

In a nutshell ​

Load a body, read what FOSSIL computed about it, save it (the first chapter of the tutorial):

f90
!< Tutorial 1: load an STL surface, read what analyze computed, save it.
program tut01_first_surface
use fossil, only : surface_stl_object
use penf,   only : I4P, R8P
use vecfor, only : vector_R8P

implicit none
type(surface_stl_object) :: surface
type(vector_R8P)         :: bmin, bmax

call surface%load_from_file(file_name='dragon.stl', guess_format=.true.) ! analyze runs inside
bmin = surface%get_bmin() ; bmax = surface%get_bmax()
print '(A,I0)',       'facets      ', surface%get_facets_number()
print '(A,3F10.4)',   'box min     ', bmin%x, bmin%y, bmin%z
print '(A,3F10.4)',   'box max     ', bmax%x, bmax%y, bmax%z
print '(A,F12.4)',    'volume      ', surface%get_volume()
print '(A,L1,A,L1)',  'watertight  ', surface%is_watertight(), '   manifold ', surface%is_manifold()
call surface%save_into_file(file_name='dragon-ascii.stl', is_ascii=.true.)
print '(A)', 'saved dragon-ascii.stl'
endprogram tut01_first_surface
$ tut01_first_surface
facets      6588
box min       -10.8287   -4.1883    5.2821
box max         9.6461    4.9512   19.7413
volume          465.9287
watertight  F   manifold F
saved dragon-ascii.stl

The dragon is neither watertight nor manifold as loaded: chapter 2 repairs it. Start with the tutorial, or look up a task in the cookbook.

See it run ​

animation: the exact cut cells of a NACA 0012 section pitching and translating through a 48 by 24 grid, each cell shaded by its solid fractionanimation: iso-distance contours from 0.05 to 0.6 around the same pitching section

Every figure and every program of the tutorial and of the cookbook is computed and run by scripts/docs_examples.sh: the outputs above are captured, not typed.

Authors ​

Copyrights ​

FOSSIL is distributed under a multi-licensing system: GPL v3 for FOSS projects, BSD 2-Clause, BSD 3-Clause or MIT for closed-source or commercial ones.