Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ways to plot slices of 3D phase fields? #311

Closed
elbert5770 opened this issue Mar 31, 2023 · 3 comments
Closed

Ways to plot slices of 3D phase fields? #311

elbert5770 opened this issue Mar 31, 2023 · 3 comments

Comments

@elbert5770
Copy link

Here's a 2D phase field for IGA analysis, this works and plots nicely:

 Nx = 60
 Ny = 60
 @show Nx,Ny

 p = 3
 q = 3

 knotvectorU = KnotVector(collect(Int64,range(0,Nx,length=Nx+1)))
 knotvectorV = KnotVector(collect(Int64,range(0,Ny,length=Ny+1)))
# @show knotvectorU
# @show knotvectorV

 lenu = length(knotvectorU)
 lenv = length(knotvectorV)
 @show lenu,lenv

 P1 = BSplineSpace{p}(knotvectorU) # B-spline space
 P2 = BSplineSpace{q}(knotvectorV) # B-spline space

 a = [SVector(i, j, (i-dim(P1)/2)^2+(j-dim(P1)/2)^2 < 100 ? 1 : 0) for i in 1:dim(P1), j in 1:dim(P2)] 
# @show a
 M = BSplineManifold(a,(P1,P2)) # Define B-spline manifold
# @show M
 plot(M)

Now extend this to 3D, which is mathematically possible but difficult to visualize. One could plot a slice through the 3D space, but slicing the BSplineManifold fails. Is there a way to do this?

Nx = 60
Ny = 60
Nz = 60
@show Nx,Ny,Nz

p = 3
q = 3
r = 3

knotvectorU = KnotVector(collect(Int64,range(0,Nx,length=Nx+1)))
knotvectorV = KnotVector(collect(Int64,range(0,Ny,length=Ny+1)))
knotvectorW = KnotVector(collect(Int64,range(0,Nz,length=Nz+1)))
# @show knotvectorU
# @show knotvectorV
# @show knotvectorW

lenu = length(knotvectorU)
lenv = length(knotvectorV)
lenw = length(knotvectorW)
@show lenu,lenv,lenw

P1 = BSplineSpace{p}(knotvectorU) # B-spline space
P2 = BSplineSpace{q}(knotvectorV) # B-spline space
P3 = BSplineSpace{r}(knotvectorW) # B-spline space

a = [SVector(i, j, k ,(i-dim(P1)/2)^2+(j-dim(P2)/2)^2+(k-dim(P3)/2)^2 < 100 ? 1 : 0) for i in 1:dim(P1), j in 1:dim(P2),k in 1:dim(P3)] 
#@show a
M = BSplineManifold(a,(P1,P2,P3)) # Define B-spline manifold
@show M[25,:,:,:]
plot(M[25,:,:,:])
@hyrodium
Copy link
Owner

Thank you for using BasicBSpline.jl!
M[25,:,:,:] should be written as M(25,:,:,:), but this is not supported yet. (#225)

@hyrodium
Copy link
Owner

#225 was resolved.
Plotting recipes does not support BSplineManifold{3}, but BasicBSplineExporter.jl may help visualization.

@hyrodium
Copy link
Owner

Please comment on this issue if you have any further comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants