Visualization of the solution of a multifield time dependant problem
- Dominant language
- Julia
- Stars
- 879
- Forks
- 119
- Avg merge
- 6d 3h
- Merged PRs (30d)
- 4
Description
hi,
I am solving an electrophysiology problem using Gridap.
I have solved the problem, the issue is that while trying to write my solution in vtu file, I am getting this : ERROR: This function belongs to an interface definition and cannot be used.
The issue is within these lines :
`createpvd("Cardiac_Electrophysiology_transient_solution") do pvd
for (uₕ,t) in uₕₜ
pvd[t] = createvtk(Ω,"Cardiac_Electrophysiology_transient_solution_$t"*".vtu",cellfields=["uh"=>uₕ[1],"ph"=>uₕ[2]])
end
end`
This is the complete code :
`using Gridap
# mesh generation
n = 100
domain = (0,1,0,1)
partition = (n,n)
model = CartesianDiscreteModel(domain,partition)
# Define test and trial spaces
order = 1
reffeᵤ = ReferenceFE(lagrangian,Float64,order)
V = TestFESpace(model,reffeᵤ,conformity=:H1)
reffeₚ = ReferenceFE(lagrangian,Float64,order)
Q = TestFESpace(model,reffeₚ,conformity=:L2)
U = TransientTrialFESpace(V)
P = TransientTrialFESpace(Q)
Y = MultiFieldFESpace([V, Q])
X = TransientMultiFieldFESpace([U, P])
# Triangulation and integration quadrature
degree = order
Ωₕ = Triangulation(model)
dΩ = Measure(Ωₕ,degree)
# weak formulation
α=0.01
c1= 8
c2=8
γ=0.002
μ1=0.2
μ2=0.3
bcnst=0.15
D = 0.1
f(ϕ,r)=c1*ϕ*(ϕ−α)*(1-ϕ)-c2*r*ϕ
g(ϕ,r)=( γ + μ1*r*(1/(μ2+ϕ)))*(-r-c2*ϕ*(ϕ-bcnst-1))
res(t,(ϕ,r),(ν,η)) = ∫(∂t(ϕ)*ν +∂t(r)*η+ D*( ∇(ν)⋅(∇(ϕ))) - ν*f(ϕ,r) - η*g(ϕ,r))*dΩ
op_AD = TransientFEOperator(res,X,Y)
# Transient solver
linear_solver = LUSolver()
Δt = 0.05
θ = 0.5
ode_solver = ThetaMethod(linear_solver,Δt,θ)
t₀ = 0.0
T = 10.0
Uh0 = interpolate_everywhere(0.0, U(t₀)) # not like tutorial
Ph0 = interpolate_everywhere(0.0, P(t₀)) # not like tutorial
xh0 = interpolate_everywhere([Uh0, Ph0], X(t₀))
xhs0 = (xh0,)
uₕₜ = solve(ode_solver,op_AD,xhs0,t₀,T)
createpvd("Cardiac_Electrophysiology_transient_solution") do pvd
for (uₕ,t) in uₕₜ
pvd[t] = createvtk(Ω,"Cardiac_Electrophysiology_transient_solution_$t"*".vtu",cellfields=["uh"=>uₕ[1],"ph"=>uₕ[2]])
end
end`
Contributor guide
Research direction
Start by reproducing the complete Julia example and reading the createpvd and createvtk entry points used in the final loop. Check how transient multifield solutions are represented when passed as cellfields, and compare this with the supported visualization examples. Done means identifying the source of the interface-definition error and documenting or correcting the supported output path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100