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

Gridap modalC0 #78

Open
ioannisPApapadopoulos opened this issue Jul 31, 2024 · 0 comments
Open

Gridap modalC0 #78

ioannisPApapadopoulos opened this issue Jul 31, 2024 · 0 comments

Comments

@ioannisPApapadopoulos
Copy link
Member

ioannisPApapadopoulos commented Jul 31, 2024

@DanielVandH @dlfivefifty I thought the following info might be useful:

Gridap has an implementation of ContinuousPolynomial{1} called modalC0 although the implementation isn't aware of the sparsity pattern of the mass/weak Laplacian matrices and I assume their transforms/quadrature schemes are not (quasi)optimal. It has also been implemented in 2D and 3D:

1D:

using Gridap, SparseArrays, Plots

domain = (0,1) # unit interval domain
n = (5,) # 5 cells
model = CartesianDiscreteModel(domain,n)

labels = get_face_labeling(model)
p = 6
reffe_u = ReferenceFE(modalC0,Float64, p)

Vu = TestFESpace(model,reffe_u,labels=labels,dirichlet_tags="boundary",conformity=:H1)
Uu = TrialFESpace(Vu, 0.0)

Ω = Triangulation(model)
dΩ = Measure(Ω,p+3)

a(uh, v) =∫( ∇(uh) ⋅ ∇(v)) * dΩ
jac(uh, duh, v) = ∫( ∇(duh) ⋅ ∇(v)) * dΩ
op = FEOperator(a, jac, Uu, Vu)

u0 = ones(Float64,num_free_dofs(Vu))
uh = FEFunction(Uu,u0);
J  = Gridap.Algebra.jacobian(op, uh) # J is the weak Laplacian matrix

# Reveal actual sparsity pattern
J[abs.(J) .< 1e-10] .=0 # reveal
J = sparse(Matrix(J))

Plots.spy(J)

To look at the 2D version, change the domain and n to

domain = (0,1,0,1) # unit square domain
n = (5,5) # 25 cells
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

1 participant