Skip to content

Commit

Permalink
dolfin fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomusy committed May 8, 2022
1 parent 13b4c20 commit e56c51f
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 248 deletions.
3 changes: 1 addition & 2 deletions docs/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
---
### `plotter.py`
- added `lookAt(plane='xy')` to move the camera to face one of the cartesian planes
- removed `load()` as not really necessary and potentially confusing
- removed `plotter.load()` as not really necessary and potentially confusing

---
### `picture.py`
Expand Down Expand Up @@ -83,4 +83,3 @@ examples/basic/multiwindows2.py




30 changes: 16 additions & 14 deletions examples/other/dolfin/awefem.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
from dolfin import *
from vedo import settings
from vedo.dolfin import plot, interactive, ProgressBar, printc, download
from vedo.dolfin import plot, ProgressBar, printc, download
import numpy as np

set_log_level(30)
Expand Down Expand Up @@ -74,19 +74,21 @@ def awefem(mesh, t, source_loc=None):
u1.assign(u)

if t_>0.03:
plot(u,
warpZfactor=20, # set elevation along z
vmin=.0, # sets a minimum to the color scale
vmax=0.003,
cmap='rainbow', # the color map style
alpha=1, # transparency of the mesh
lw=0.1, # linewidth of mesh
scalarbar=None,
#lighting='plastic',
#elevation=-.3,
interactive=0) # continue execution

interactive()
plt = plot(
u,
warpZfactor=20, # set elevation along z
vmin=.0, # sets a minimum to the color scale
vmax=0.003,
cmap='rainbow', # the color map style
alpha=1, # transparency of the mesh
lw=0.1, # linewidth of mesh
scalarbar=None,
#lighting='plastic',
#elevation=-.3,
interactive=False,
) # continue execution
plt.clear()
plt.interactive()

if __name__ == "__main__":

Expand Down
4 changes: 1 addition & 3 deletions examples/other/dolfin/elastodynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,10 @@ def local_project(v, V, u=None):
scalarbar=False,
azimuth=1, # at each iteration add an angle to rotate scene
text=__doc__, # add this file header
interactive=False)
interactive=False).clear()
#screenshot('bar'+str(i)+'.png') # uncomment to save screenshots
pb.print("Time: "+str(t)+" seconds")

plot()




Expand Down
8 changes: 4 additions & 4 deletions examples/other/dolfin/ex03_poisson.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@
f = r'-\nabla^{2} u=f'

########################################################### vedo
from vedo.dolfin import plot, clear, histogram
from vedo.dolfin import plot
from vedo.pyplot import histogram
from vedo import Latex

l = Latex(f, s=0.2, c='w').addPos(.6,.6,.1)
l = Latex(f, s=0.2, c='w').shift(.6,.6,.1)

plot(u, l, cmap='jet', scalarbar='h', text=__doc__)
plot(u, l, cmap='jet', scalarbar='h', text=__doc__).clear()

# Now show uD values on the boundary of a much finer mesh
clear()
bmesh = BoundaryMesh(UnitSquareMesh(80, 80), "exterior")
plot(uD, bmesh, cmap='cool', ps=5, legend='boundary') # ps = point size

Expand Down
8 changes: 3 additions & 5 deletions examples/other/dolfin/ex07_stokes-iterative.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,10 @@ def top_bottom(x, on_boundary):


#################################################### vedo
from vedo.dolfin import plot, printHistogram
from vedo.dolfin import plot

# Plot u and p solutions on N=2 synced renderers
plot(u, mode='mesh arrows', at=0, N=2, legend='velocity',
scale=0.1, wireframe=1, lw=0.03, alpha=0.5, scalarbar=False)
scale=0.1, wireframe=1, lw=0.03, alpha=0.5, scalarbar=False).close()

printHistogram(pressures, title='pressure histo', logscale=True, c=1)

plot(p, mode='mesh', at=1, N=2, legend='pressure', interactive=True)
plot(p, mode='mesh').close()
3 changes: 1 addition & 2 deletions examples/other/dolfin/heatconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,9 @@ def operator(u, v):
isolines={"n": 12, "lw":1, "c":'black', "alpha":0.1},
scalarbar=False,
interactive=False,
)
).clear()

# Move to next time step
u0.assign(u)
t += dt

interactive()
8 changes: 4 additions & 4 deletions examples/other/dolfin/stokes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
# https://github.com/pf4d/fenics_scripts/blob/master/cbc_block/stokes.py
from dolfin import *
import numpy as np
from vedo.dolfin import plot, dataurl, download
from vedo import Latex
from vedo.dolfin import plot, download
from vedo import Latex, dataurl

# Load mesh and subdomains
fpath = download(dataurl+"dolfin_fine.xml")
Expand Down Expand Up @@ -51,7 +51,7 @@
plot(u, formula, at=0, N=2,
mode='mesh and arrows', scale=.03,
wireframe=True, scalarbar=False, style=1)
plot(p, at=1, text="pressure", cmap='rainbow', interactive=False)
plot(p, at=1, text="pressure", cmap='rainbow', interactive=True).close()


##################################################################### streamlines
Expand All @@ -64,7 +64,7 @@
streamlines={'tol':0.02, # control density of streams
'lw':2, # line width
'direction':'forward', # direction of integration
'maxPropagation':1.2, # max length of propagation
'maxPropagation':2.2, # max length of propagation
'probes':probes, # custom list of point in space as seeds
},
c='white', # mesh color
Expand Down
1 change: 0 additions & 1 deletion examples/other/dolfin/turing_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,4 @@ def J(self, A, x):
lw=0, warpZfactor=-0.1,
vmin=0, vmax=1, scalarbar=False, interactive=False)

interactive()

2 changes: 0 additions & 2 deletions examples/other/dolfin/turing_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,3 @@ def J(self, A, x):
u_out, v_out = W.split()
plot(u_out, Text2D("time = "+str(t)),
vmin=0, vmax=1, scalarbar=False, interactive=False)

interactive()
84 changes: 0 additions & 84 deletions examples/other/dolfin/turing_pattern.py

This file was deleted.

91 changes: 0 additions & 91 deletions examples/other/dolfin/wavy_1d.py

This file was deleted.

28 changes: 0 additions & 28 deletions examples/other/trimesh/first_example.py

This file was deleted.

Loading

0 comments on commit e56c51f

Please sign in to comment.