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

Visualization of the solution of a multifield time dependant problem #1001

Open
Mahdimasmoudi0 opened this issue Apr 20, 2024 · 0 comments
Open

Comments

@Mahdimasmoudi0
Copy link

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-ϕ)-c2rϕ
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`

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