-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Set up CMake to produce Python modules for 2D and 3D using pybind11 * Changed interface functions to only use standard types * Prepared release
- Loading branch information
1 parent
e8c318e
commit 21bcd67
Showing
271 changed files
with
6,063 additions
and
2,788 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import viennaLS2d as vls | ||
|
||
## @example AirGapDeposition.py | ||
# Example showing how to use the library for topography | ||
# simulation, by creating a trench geometry. A layer of a different material is | ||
# then grown directionally on top. | ||
|
||
class velocityField(vls.lsVelocityField): | ||
# coord and normalVec are lists with 3 elements | ||
# in 2D coord[2] and normalVec[2] are zero | ||
# getScalarVelocity must return a scalar | ||
def getScalarVelocity(self, coord, material, normal): | ||
return abs(normal[0]) + abs(normal[1]) | ||
|
||
def getVectorVelocity(self, coord, material, normal): | ||
return (0,0,0) | ||
|
||
extent = 30 | ||
gridDelta = 0.5 | ||
|
||
bounds = (-extent, extent, -extent, extent) | ||
boundaryCons = (0, 1, 0) # 0 = reflective, 1 = infinite, 2 = periodic | ||
|
||
# create level set | ||
substrate = vls.lsDomain(bounds, boundaryCons, gridDelta) | ||
|
||
# create plane | ||
origin = (0,0,0) | ||
planeNormal = (0,1,0) | ||
|
||
vls.lsMakeGeometry(substrate, vls.lsPlane(origin, planeNormal)).apply() | ||
|
||
print("Extracting") | ||
mesh = vls.lsMesh() | ||
vls.lsToSurfaceMesh(substrate, mesh).apply() | ||
vls.lsVTKWriter(mesh, "plane.vtk").apply() | ||
|
||
# create layer used for booling | ||
print("Creating box...") | ||
trench = vls.lsDomain(bounds, boundaryCons, gridDelta) | ||
minCorner = (-extent / 6., -25.) | ||
maxCorner = (extent / 6., 1.) | ||
vls.lsMakeGeometry(trench, vls.lsBox(minCorner, maxCorner)).apply() | ||
|
||
print("Extracting") | ||
vls.lsToMesh(trench, mesh).apply() | ||
vls.lsVTKWriter(mesh, "box.vtk").apply() | ||
|
||
# Create trench geometry | ||
print("Booling trench") | ||
vls.lsBooleanOperation(substrate, trench, vls.lsBooleanOperationEnum.RELATIVE_COMPLEMENT).apply() | ||
|
||
# Now grow new material | ||
|
||
# create new levelset for new material, which will be grown | ||
# since it has to wrap around the substrate, just copy it | ||
print("Creating new layer...") | ||
newLayer = vls.lsDomain(substrate) | ||
|
||
velocities = velocityField() | ||
|
||
print("Advecting") | ||
advectionKernel = vls.lsAdvect() | ||
|
||
# the level set to be advected has to be inserted last | ||
# the other could be taken as a mask layer for advection | ||
advectionKernel.insertNextLevelSet(substrate) | ||
advectionKernel.insertNextLevelSet(newLayer) | ||
|
||
advectionKernel.setVelocityField(velocities) | ||
advectionKernel.setIgnoreVoids(True) | ||
|
||
# Now advect the level set 50 times, outputting every | ||
# advection step. Save the physical time that | ||
# passed during the advection. | ||
passedTime = 0 | ||
numberOfSteps = 60 | ||
for i in range(numberOfSteps): | ||
advectionKernel.apply() | ||
passedTime += advectionKernel.getAdvectionTime() | ||
|
||
print("Advection step {} / {}".format(i, numberOfSteps)) | ||
|
||
vls.lsToSurfaceMesh(newLayer, mesh).apply() | ||
vls.lsVTKWriter(mesh, "trench{}.vtk".format(i)).apply() | ||
|
||
print("Time passed during advection: {}".format(passedTime)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import viennaLS3d as vls | ||
|
||
## @example Deposition.py | ||
# 3D Example showing how to use the library for topography | ||
# simulation, by creating a trench geometry. A uniform | ||
# layer of a different material is then grown on top. | ||
|
||
class velocityField(vls.lsVelocityField): | ||
# coord and normalVec are lists with 3 elements | ||
# in 2D coord[2] and normalVec[2] are zero | ||
# getScalarVelocity must return a scalar | ||
def getScalarVelocity(self, coord, material, normal): | ||
# some arbitrary velocity function of your liking | ||
# (try changing it and see what happens :) | ||
velocity = 1 | ||
return velocity | ||
|
||
def getVectorVelocity(self, coord, material, normal): | ||
return (0,0,0) | ||
|
||
extent = 30 | ||
gridDelta = 0.5 | ||
|
||
bounds = (-extent, extent, -extent, extent, -extent, extent) | ||
boundaryCons = (0, 0, 1) # 0 = reflective, 1 = infinite, 2 = periodic | ||
|
||
# create level set | ||
substrate = vls.lsDomain(bounds, boundaryCons, gridDelta) | ||
|
||
# create plane | ||
origin = (0,0,0) | ||
planeNormal = (0,0,1) | ||
|
||
vls.lsMakeGeometry(substrate, vls.lsPlane(origin, planeNormal)).apply() | ||
|
||
# create layer used for booling | ||
print("Creating box...") | ||
trench = vls.lsDomain(bounds, boundaryCons, gridDelta) | ||
minCorner = (-extent - 1, -extent / 4., -15.) | ||
maxCorner = (extent + 1, extent / 4., 1.) | ||
vls.lsMakeGeometry(trench, vls.lsBox(minCorner, maxCorner)).apply() | ||
|
||
# Create trench geometry | ||
print("Booling trench") | ||
vls.lsBooleanOperation(substrate, trench, vls.lsBooleanOperationEnum.RELATIVE_COMPLEMENT).apply() | ||
|
||
# Now grow new material | ||
|
||
# create new levelset for new material, which will be grown | ||
# since it has to wrap around the substrate, just copy it | ||
print("Creating new layer...") | ||
newLayer = vls.lsDomain(substrate) | ||
|
||
velocities = velocityField() | ||
|
||
print("Advecting") | ||
advectionKernel = vls.lsAdvect() | ||
|
||
# the level set to be advected has to be inserted last | ||
# the other could be taken as a mask layer for advection | ||
advectionKernel.insertNextLevelSet(substrate) | ||
advectionKernel.insertNextLevelSet(newLayer) | ||
|
||
advectionKernel.setVelocityField(velocities) | ||
|
||
# Advect the level set | ||
counter = 1 | ||
passedTime = 0 | ||
|
||
mesh = vls.lsMesh() | ||
while(passedTime < 4): | ||
advectionKernel.apply() | ||
passedTime += advectionKernel.getAdvectionTime() | ||
|
||
vls.lsToSurfaceMesh(newLayer, mesh).apply() | ||
vls.lsVTKWriter(mesh, "trench-{}.vtk".format(counter)).apply() | ||
|
||
vls.lsToMesh(newLayer, mesh).apply() | ||
vls.lsVTKWriter(mesh, "LS-{}.vtk".format(counter)).apply() | ||
|
||
counter = counter + 1 | ||
|
||
print("Time passed during advection: {}".format(passedTime)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.