You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@time createpvd(“transient_stokes_solution”) do pvd
for (xₕ,t) in xₕₜ
(uₕ,pₕ) = xₕ
pvd[t] = createvtk(Ωₕ,“transient_stokes_solution_$t”*“.vtu”,cellfields=[“u”=>uₕ,“p”=>pₕ])
end
end
The text was updated successfully, but these errors were encountered:
@larsudb You are solving 100 steps, and solving a nonlinear problem at each step.... This is costly, no way around it... Either you improve your choice of solvers of you go to parallel, but I don't think anything else can be done.
I have written a code for a lid-driven square cavity within gridap and am wondering if the solve time can be decreased easily.
using Gridap
using LineSearches: BackTracking
using TickTock
using WriteVTK
n = 100
domain = (0,1,0,1)
partition = (n,n)
model = CartesianDiscreteModel(domain,partition)
labels = get_face_labeling(model)
add_tag_from_tags!(labels,“sides”,[5,7,8])
add_tag_from_tags!(labels,“top”,[6])
D = 2
order = 2
degree = 2*order
Ωₕ = Interior(model)
dΩ = Measure(Ωₕ,degree)
reffeᵤ = ReferenceFE(lagrangian,VectorValue{D,Float64},order)
V = TestFESpace(Ωₕ,reffeᵤ,conformity=:H1,dirichlet_tags=[“top”,“sides”])
reffeₚ = ReferenceFE(lagrangian,Float64,order-1)
Q = TestFESpace(Ωₕ,reffeₚ,conformity=:H1,constraint=:zeromean)
u_wall(x, t) = VectorValue(cos(t),0)
u_wall(t::Real) = x → u_wall(x, t)
u_top(x, t) = VectorValue(1, 0)
u_top(t::Real) = x → u_top(x, t)
U = TransientTrialFESpace(V,[u_top,u_wall])
P = TransientTrialFESpace(Q)
Y = MultiFieldFESpace([V, Q])
X = TransientMultiFieldFESpace([U, P])
res(t,(u,p),(v,q)) = ∫( ∂t(u)⋅v + ∇(u)⊙∇(v) - (∇⋅v)*p + q⋅(∇⋅u))dΩ #- ∫( f(t)⋅v )dΩ - ∫( g(t)*q )dΩ
jac(t,(u,p),(du,dp),(v,q)) = ∫( ∇(du)⊙∇(v) - (∇⋅v)*dp + q⋅(∇⋅du))dΩ
jac_t(t,(u,p),(dut,dpt),(v,q)) = ∫(v⋅dut)dΩ
op = TransientFEOperator(res,jac,jac_t,X,Y)
nls = NLSolver(show_trace = true,method = :newton,linesearch = BackTracking()) #,iterations=5
dt = 0.1
θ = 0.5
ode_solver = ThetaMethod(nls,dt,θ)
u₀ = interpolate_everywhere(VectorValue(0,0),U(0.0))
p₀ = interpolate_everywhere(0,P)
x₀ = interpolate_everywhere([u₀,p₀],X(0.0))
t₀ = 0
T = 10
xₕₜ = solve(ode_solver,op,x₀,t₀,T)
@time createpvd(“transient_stokes_solution”) do pvd
for (xₕ,t) in xₕₜ
(uₕ,pₕ) = xₕ
pvd[t] = createvtk(Ωₕ,“transient_stokes_solution_$t”*“.vtu”,cellfields=[“u”=>uₕ,“p”=>pₕ])
end
end
The text was updated successfully, but these errors were encountered: