Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision 92d43fb1eea21ec77fe31adc0b0c999f1a124737 authored by Nils Thuerey on 08 June 2017, 20:22:23 UTC, committed by Nils Thuerey on 08 June 2017, 20:22:23 UTC
screens
1 parent 0b4d265
  • Files
  • Changes
  • 5d19b9f
  • /
  • scenes
  • /
  • vortexsheets.py
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
revision badge
swh:1:rev:92d43fb1eea21ec77fe31adc0b0c999f1a124737
directory badge
swh:1:dir:8046bfcf9852b9019a6879130764073eab66a024
content badge
swh:1:cnt:fe072d5a9b9b2bf35255e93d266ab80dfe8f77fc

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
vortexsheets.py
#
# Example scene for mesh-based smoke simulations using Vortex Sheets
# ( http://graphics.ethz.ch/publications/papers/paperPfa12.php )
#
# This example requires CUDA to run

from manta import *
assert(CUDA), 'Requires CUDA. Please compile with -DCUDA=ON'

scale = 0.2

# solver params
res = 64
gs = vec3(res,res*1.5,res)
dx = 1/(1.5*res)
s = Solver(name='main', gridSize = gs)
s.timestep = 0.5

gravity = vec3(0,-0.15,0)
velInflow = vec3(0,0.52,0)

# prepare grids
flags = s.create(FlagGrid)
pressure = s.create(RealGrid, show=False)
vel = s.create(MACGrid)
density = s.create(RealGrid)

# noise field
noise = s.create(NoiseField)
noise.posScale = vec3(45)
noise.clamp = True
noise.clampNeg = 0
noise.clampPos = 1
noise.valScale = 1
noise.valOffset = 0.75
noise.timeAnim = 0.2

mesh = s.create(VortexSheetMesh)
vp = s.create(VortexParticleSystem)

flags.initDomain()
flags.fillGrid()

if (GUI):
	gui = Gui()
	gui.show()

# inflow mesh
source = s.create(Cylinder, center=gs*vec3(0.5,0.13,0.5), radius=res*0.14, z=gs*vec3(0, 0.03, 0))
mesh.fromShape(source)
subdivideMesh(mesh=mesh, minAngle=0.01, minLength=scale, maxLength=2*scale)

# fix the nodes at the bottom of mesh
fixedRegion = Box( parent=s, center=gs*vec3(0.5,0.09,0.5), size=gs*vec3(0.4,0.03,0.4))
	
#main loop
for t in range(180):
	mantaMsg('\nFrame %i, simulation time %f' % (s.frame, s.timeTotal))

	# seed smoke within the source region and apply inflow velocity condition
	densityInflow(flags=flags, density=density, noise=noise, shape=source, scale=1, sigma=0.5)
	source.applyToGrid(grid=vel, value=velInflow)
	advectSemiLagrange(flags=flags, vel=vel, grid=density, order=2)
	markAsFixed(mesh=mesh, shape=fixedRegion)

	# advect mesh in large-scale grid
	mesh.calcCirculation()        
	mesh.advectInGrid(vel=vel, flags=flags, integrationMode=IntRK4)  
	mesh.calcVorticity()
	
	# vortex sheet integration
	#filterVorticityCuda(mesh=mesh, sigma=1.6)
	smoothVorticity(mesh=mesh, iter=50, alpha=1.0, sigma=0.6) # fast approximation for Gauss kernel
	meshApplyBuoyancyLocalCuda(mesh=mesh, scale=0.6*1e-2, cutoffCells=5, regularization=0.5)
	mesh.calcVorticity()
	
	# mesh cosmetics
	smoothMesh(mesh=mesh, strength=1e-4, steps=1)
	subdivideMesh(mesh=mesh, minAngle=0.01, minLength=scale, maxLength=2*scale, cutTubes=True)
	killSmallComponents(mesh=mesh, elements=20)
	
	# base solver
	advectSemiLagrange(flags=flags, vel=vel, grid=vel, order=2)
	setWallBcs(flags=flags, vel=vel)
	addBuoyancy(density=density, vel=vel, gravity=gravity*dx, flags=flags)
	solvePressure(flags=flags, vel=vel, pressure=pressure)
	setWallBcs(flags=flags, vel=vel)
	
	# vorticity source terms
	vorticitySource(mesh=mesh, gravity=gravity, scale=0.1, maxAmount=200)
	
	#mesh.save('d%04d.bobj.gz' % t)
	s.step()
	
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API