From 704338771dea0c2c3df445b4eb5ee525d57577e7 Mon Sep 17 00:00:00 2001 From: Oriol Colomes Date: Sun, 7 Nov 2021 20:50:58 +0100 Subject: [PATCH 1/2] Removed TransientFESolver --- src/TransientFETools/TransientFESolutions.jl | 27 ++++++++++++++----- src/TransientFETools/TransientFESolvers.jl | 21 --------------- src/TransientFETools/TransientFETools.jl | 3 --- .../AffineFEOperatorsTests.jl | 3 +-- .../BoundaryHeatEquationTests.jl | 3 +-- .../ConstantFEOperatorsTests.jl | 3 +-- test/TransientFEsTests/DGHeatEquationTests.jl | 3 +-- .../ForwardEulerHeatEquationTests.jl | 3 +-- .../HeatEquationAutoDiffTests.jl | 3 +-- test/TransientFEsTests/HeatEquationTests.jl | 3 +-- .../HeatVectorEquationTests.jl | 3 +-- .../StokesEquationAutoDiffTests.jl | 3 +-- test/TransientFEsTests/StokesEquationTests.jl | 3 +-- .../Transient2ndOrderFEOperatorsTests.jl | 9 +++---- .../TransientFEOperatorsTests.jl | 3 +-- test/TransientFEsTests/TransientFETests.jl | 6 ++--- .../VectorHeatEquationTests.jl | 3 +-- 17 files changed, 39 insertions(+), 63 deletions(-) delete mode 100644 src/TransientFETools/TransientFESolvers.jl diff --git a/src/TransientFETools/TransientFESolutions.jl b/src/TransientFETools/TransientFESolutions.jl index 2e1f3b3..1e2001c 100644 --- a/src/TransientFETools/TransientFESolutions.jl +++ b/src/TransientFETools/TransientFESolutions.jl @@ -11,36 +11,51 @@ end function TransientFESolution( - solver::TransientFESolver, op::TransientFEOperator, uh0, t0::Real, tF::Real) + solver::ODESolver, op::TransientFEOperator, uh0, t0::Real, tF::Real) - ode_solver = solver.odes ode_op = get_algebraic_operator(op) u0 = get_free_dof_values(uh0) - ode_sol = solve(ode_solver,ode_op,u0,t0,tF) + ode_sol = solve(solver,ode_op,u0,t0,tF) trial = get_trial(op) TransientFESolution(ode_sol, trial) end function TransientFESolution( - solver::TransientFESolver, + solver::ODESolver, op::TransientFEOperator, xh0::Tuple{Vararg{Any}}, t0::Real, tF::Real) - ode_solver = solver.odes ode_op = get_algebraic_operator(op) x0 = () for xhi in xh0 x0 = (x0...,get_free_dof_values(xhi)) end - ode_sol = solve(ode_solver,ode_op,x0,t0,tF) + ode_sol = solve(solver,ode_op,x0,t0,tF) trial = get_trial(op) TransientFESolution(ode_sol, trial) end +# Solve functions + +function solve( + solver::ODESolver,op::TransientFEOperator,u0,t0::Real,tf::Real) + TransientFESolution(solver,op,u0,t0,tf) +end + +function solve( + solver::ODESolver,op::TransientFEOperator,u0,v0,a0,t0::Real,tf::Real) + TransientFESolution(solver,op,u0,v0,a0,t0,tf) +end + +function test_transient_fe_solver(solver::ODESolver,op::TransientFEOperator,u0,t0,tf) + solution = solve(solver,op,u0,t0,tf) + test_transient_fe_solution(solution) +end + #@fverdugo this is a general implementation of iterate for TransientFESolution # We could also implement another one for the very common case that the # underlying ode_op is a ODEOpFromFEOp object diff --git a/src/TransientFETools/TransientFESolvers.jl b/src/TransientFETools/TransientFESolvers.jl deleted file mode 100644 index 17397ca..0000000 --- a/src/TransientFETools/TransientFESolvers.jl +++ /dev/null @@ -1,21 +0,0 @@ -""" -A general TransientFESolver -""" -struct TransientFESolver - odes::ODESolver -end - -function solve( - solver::TransientFESolver,op::TransientFEOperator,u0,t0::Real,tf::Real) - TransientFESolution(solver,op,u0,t0,tf) -end - -function solve( - solver::TransientFESolver,op::TransientFEOperator,u0,v0,a0,t0::Real,tf::Real) - TransientFESolution(solver,op,u0,v0,a0,t0,tf) -end - -function test_transient_fe_solver(solver::TransientFESolver,op::TransientFEOperator,u0,t0,tf) - solution = solve(solver,op,u0,t0,tf) - test_transient_fe_solution(solution) -end diff --git a/src/TransientFETools/TransientFETools.jl b/src/TransientFETools/TransientFETools.jl index e6b1f9e..434b3f7 100644 --- a/src/TransientFETools/TransientFETools.jl +++ b/src/TransientFETools/TransientFETools.jl @@ -67,7 +67,6 @@ import Gridap.FESpaces: get_test using GridapODEs.ODETools: test_ode_operator export test_transient_fe_operator -export TransientFESolver import Gridap.FESpaces: FESolver import GridapODEs.ODETools: ODESolver import Gridap: solve @@ -94,8 +93,6 @@ include("TransientFEOperators.jl") include("ODEOperatorInterfaces.jl") -include("TransientFESolvers.jl") - include("TransientFESolutions.jl") export FETerm diff --git a/test/TransientFEsTests/AffineFEOperatorsTests.jl b/test/TransientFEsTests/AffineFEOperatorsTests.jl index 3fd5f85..3d36ad8 100644 --- a/test/TransientFEsTests/AffineFEOperatorsTests.jl +++ b/test/TransientFEsTests/AffineFEOperatorsTests.jl @@ -55,8 +55,7 @@ uh0 = interpolate_everywhere(u(0.0),U0) ls = LUSolver() odes = ThetaMethod(ls,dt,θ) -solver = TransientFESolver(odes) -sol_t = solve(solver,op,uh0,t0,tF) +sol_t = solve(odes,op,uh0,t0,tF) l2(w) = w*w diff --git a/test/TransientFEsTests/BoundaryHeatEquationTests.jl b/test/TransientFEsTests/BoundaryHeatEquationTests.jl index f07f76f..70f5749 100644 --- a/test/TransientFEsTests/BoundaryHeatEquationTests.jl +++ b/test/TransientFEsTests/BoundaryHeatEquationTests.jl @@ -71,9 +71,8 @@ ls = LUSolver() using Gridap.Algebra: NewtonRaphsonSolver # nls = NLSolver(ls;show_trace=true,method=:newton) #linesearch=BackTracking()) odes = ThetaMethod(ls,dt,θ) -solver = TransientFESolver(odes) -sol_t = solve(solver,op,uh0,t0,tF) +sol_t = solve(odes,op,uh0,t0,tF) # Juno.@enter Base.iterate(sol_t) diff --git a/test/TransientFEsTests/ConstantFEOperatorsTests.jl b/test/TransientFEsTests/ConstantFEOperatorsTests.jl index 8f33a7c..8ecaf4f 100644 --- a/test/TransientFEsTests/ConstantFEOperatorsTests.jl +++ b/test/TransientFEsTests/ConstantFEOperatorsTests.jl @@ -55,8 +55,7 @@ uh0 = interpolate_everywhere(u(0.0),U0) ls = LUSolver() odes = ThetaMethod(ls,dt,θ) -solver = TransientFESolver(odes) -sol_t = solve(solver,op,uh0,t0,tF) +sol_t = solve(odes,op,uh0,t0,tF) l2(w) = w*w diff --git a/test/TransientFEsTests/DGHeatEquationTests.jl b/test/TransientFEsTests/DGHeatEquationTests.jl index 3cfaf1a..05eb2c5 100644 --- a/test/TransientFEsTests/DGHeatEquationTests.jl +++ b/test/TransientFEsTests/DGHeatEquationTests.jl @@ -70,9 +70,8 @@ uh0 = interpolate_everywhere(u(0.0),U0) ls = LUSolver() using Gridap.Algebra: NewtonRaphsonSolver odes = ThetaMethod(ls,dt,θ) -solver = TransientFESolver(odes) -sol_t = solve(solver,op,uh0,t0,tF) +sol_t = solve(odes,op,uh0,t0,tF) l2(w) = w*w diff --git a/test/TransientFEsTests/ForwardEulerHeatEquationTests.jl b/test/TransientFEsTests/ForwardEulerHeatEquationTests.jl index 63427bc..e82fb1a 100644 --- a/test/TransientFEsTests/ForwardEulerHeatEquationTests.jl +++ b/test/TransientFEsTests/ForwardEulerHeatEquationTests.jl @@ -61,9 +61,8 @@ ls = LUSolver() using Gridap.Algebra: NewtonRaphsonSolver nls = NLSolver(ls;show_trace=true,method=:newton) #linesearch=BackTracking()) odes = ThetaMethod(ls,dt,θ) -solver = TransientFESolver(odes) -sol_t = solve(solver,op,uh0,t0,tF) +sol_t = solve(odes,op,uh0,t0,tF) l2(w) = w*w diff --git a/test/TransientFEsTests/HeatEquationAutoDiffTests.jl b/test/TransientFEsTests/HeatEquationAutoDiffTests.jl index 3ec19eb..b4d5313 100644 --- a/test/TransientFEsTests/HeatEquationAutoDiffTests.jl +++ b/test/TransientFEsTests/HeatEquationAutoDiffTests.jl @@ -72,9 +72,8 @@ ls = LUSolver() using Gridap.Algebra: NewtonRaphsonSolver nls = NLSolver(ls;show_trace=true,method=:newton) #linesearch=BackTracking()) odes = ThetaMethod(ls,dt,θ) -solver = TransientFESolver(odes) -sol_t = solve(solver,op,uh0,t0,tF) +sol_t = solve(odes,op,uh0,t0,tF) # Juno.@enter Base.iterate(sol_t) diff --git a/test/TransientFEsTests/HeatEquationTests.jl b/test/TransientFEsTests/HeatEquationTests.jl index 70545a6..992c08a 100644 --- a/test/TransientFEsTests/HeatEquationTests.jl +++ b/test/TransientFEsTests/HeatEquationTests.jl @@ -57,9 +57,8 @@ ls = LUSolver() using Gridap.Algebra: NewtonRaphsonSolver nls = NLSolver(ls;show_trace=true,method=:newton) #linesearch=BackTracking()) odes = ThetaMethod(ls,dt,θ) -solver = TransientFESolver(odes) -sol_t = solve(solver,op,uh0,t0,tF) +sol_t = solve(odes,op,uh0,t0,tF) # Juno.@enter Base.iterate(sol_t) diff --git a/test/TransientFEsTests/HeatVectorEquationTests.jl b/test/TransientFEsTests/HeatVectorEquationTests.jl index 96475e6..4262c34 100644 --- a/test/TransientFEsTests/HeatVectorEquationTests.jl +++ b/test/TransientFEsTests/HeatVectorEquationTests.jl @@ -58,9 +58,8 @@ uh0 = interpolate_everywhere(u(0.0),U0) ls = LUSolver() odes = ThetaMethod(ls,dt,θ) -solver = TransientFESolver(odes) -sol_t = solve(solver,op,uh0,t0,tF) +sol_t = solve(odes,op,uh0,t0,tF) l2(w) = w⋅w diff --git a/test/TransientFEsTests/StokesEquationAutoDiffTests.jl b/test/TransientFEsTests/StokesEquationAutoDiffTests.jl index b4d9fa0..640f039 100644 --- a/test/TransientFEsTests/StokesEquationAutoDiffTests.jl +++ b/test/TransientFEsTests/StokesEquationAutoDiffTests.jl @@ -100,9 +100,8 @@ dt = 0.1 ls = LUSolver() odes = ThetaMethod(ls,dt,θ) -solver = TransientFESolver(odes) -sol_t = solve(solver,op,xh0,t0,tF) +sol_t = solve(odes,op,xh0,t0,tF) l2(w) = w⋅w diff --git a/test/TransientFEsTests/StokesEquationTests.jl b/test/TransientFEsTests/StokesEquationTests.jl index d198cac..ddba6ea 100644 --- a/test/TransientFEsTests/StokesEquationTests.jl +++ b/test/TransientFEsTests/StokesEquationTests.jl @@ -85,9 +85,8 @@ dt = 0.1 ls = LUSolver() odes = ThetaMethod(ls,dt,θ) -solver = TransientFESolver(odes) -sol_t = solve(solver,op,xh0,t0,tF) +sol_t = solve(odes,op,xh0,t0,tF) l2(w) = w⋅w diff --git a/test/TransientFEsTests/Transient2ndOrderFEOperatorsTests.jl b/test/TransientFEsTests/Transient2ndOrderFEOperatorsTests.jl index ba83eea..914e478 100644 --- a/test/TransientFEsTests/Transient2ndOrderFEOperatorsTests.jl +++ b/test/TransientFEsTests/Transient2ndOrderFEOperatorsTests.jl @@ -69,12 +69,11 @@ ah0_const = interpolate_everywhere(a_const(0.0),U0) ls = LUSolver() odes = Newmark(ls,dt,γ,β) -solver = TransientFESolver(odes) -sol_t = solve(solver,op,(uh0,vh0,ah0),t0,tF) -sol_affine_t = solve(solver,op_affine,(uh0,vh0,ah0),t0,tF) -sol_const_t = solve(solver,op_const,(uh0,vh0_const,ah0_const),t0,tF) -sol_const_mat_t = solve(solver,op_const_mat,(uh0,vh0,ah0),t0,tF) +sol_t = solve(odes,op,(uh0,vh0,ah0),t0,tF) +sol_affine_t = solve(odes,op_affine,(uh0,vh0,ah0),t0,tF) +sol_const_t = solve(odes,op_const,(uh0,vh0_const,ah0_const),t0,tF) +sol_const_mat_t = solve(odes,op_const_mat,(uh0,vh0,ah0),t0,tF) l2(w) = w*w diff --git a/test/TransientFEsTests/TransientFEOperatorsTests.jl b/test/TransientFEsTests/TransientFEOperatorsTests.jl index ed12332..062aa18 100644 --- a/test/TransientFEsTests/TransientFEOperatorsTests.jl +++ b/test/TransientFEsTests/TransientFEOperatorsTests.jl @@ -61,9 +61,8 @@ uh0 = interpolate_everywhere(u(0.0),U0) ls = LUSolver() odes = ThetaMethod(ls,dt,θ) -solver = TransientFESolver(odes) -sol_t = solve(solver,op,uh0,t0,tF) +sol_t = solve(odes,op,uh0,t0,tF) l2(w) = w*w diff --git a/test/TransientFEsTests/TransientFETests.jl b/test/TransientFEsTests/TransientFETests.jl index fd8fadd..779d03a 100644 --- a/test/TransientFEsTests/TransientFETests.jl +++ b/test/TransientFEsTests/TransientFETests.jl @@ -113,8 +113,7 @@ maxiters = 20 using Gridap.Algebra: NewtonRaphsonSolver nls = NLSolver(ls;show_trace=true,method=:newton) #linesearch=BackTracking()) odes = ThetaMethod(nls,dt,1.0) -solver = TransientFESolver(odes) # Return a specialization of TransientFESolver -@test test_transient_fe_solver(solver,op,uh0,t0,tF) +@test test_transient_fe_solver(odes,op,uh0,t0,tF) residual!(r,op,0.1,(uh,uh),cache) jacobian!(J,op,1.0,(uh,uh10),1,1.0,cache) @@ -218,8 +217,7 @@ for (u_n, t_n) in sol_ode_t @test all(u_n .≈ t_n) end -solver = TransientFESolver(odes) -sol_t = solve(solver,op,uh0,t0,tF) +sol_t = solve(odes,op,uh0,t0,tF) @test test_transient_fe_solution(sol_t) _t_n = 0.0 diff --git a/test/TransientFEsTests/VectorHeatEquationTests.jl b/test/TransientFEsTests/VectorHeatEquationTests.jl index b85be08..9bf2892 100644 --- a/test/TransientFEsTests/VectorHeatEquationTests.jl +++ b/test/TransientFEsTests/VectorHeatEquationTests.jl @@ -68,9 +68,8 @@ ls = LUSolver() # using Gridap.Algebra: NewtonRaphsonSolver # nls = NLSolver(ls;show_trace=true,method=:newton) #linesearch=BackTracking()) odes = ThetaMethod(ls,dt,θ) -solver = TransientFESolver(odes) -sol_t = solve(solver,op,xh0,t0,tF) +sol_t = solve(odes,op,xh0,t0,tF) l2(w) = w⋅w From 0d38d3c6c96488a4acdefb7f58b7a231bd74d247 Mon Sep 17 00:00:00 2001 From: Santiago Badia Date: Mon, 8 Nov 2021 08:04:57 +1100 Subject: [PATCH 2/2] some renaming and updated readme --- README.md | 5 ++--- test/TransientFEsTests/AffineFEOperatorsTests.jl | 4 ++-- .../BoundaryHeatEquationTests.jl | 4 ++-- .../TransientFEsTests/ConstantFEOperatorsTests.jl | 4 ++-- test/TransientFEsTests/DGHeatEquationTests.jl | 4 ++-- .../ForwardEulerHeatEquationTests.jl | 4 ++-- .../HeatEquationAutoDiffTests.jl | 4 ++-- test/TransientFEsTests/HeatEquationTests.jl | 4 ++-- test/TransientFEsTests/HeatVectorEquationTests.jl | 8 ++++---- .../StokesEquationAutoDiffTests.jl | 4 ++-- test/TransientFEsTests/StokesEquationTests.jl | 4 ++-- .../Transient2ndOrderFEOperatorsTests.jl | 10 +++++----- .../TransientFEOperatorsTests.jl | 8 ++++---- test/TransientFEsTests/TransientFETests.jl | 15 +++++++-------- test/TransientFEsTests/VectorHeatEquationTests.jl | 4 ++-- 15 files changed, 42 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index f94512e..942874f 100644 --- a/README.md +++ b/README.md @@ -62,9 +62,8 @@ U0 = U(0.0) uh0 = interpolate_everywhere(u(0.0),U0) ls = LUSolver() -odes = ThetaMethod(ls,dt,θ) -solver = TransientFESolver(odes) -sol_t = solve(solver,op,uh0,t0,tF) +ode_solver = ThetaMethod(ls,dt,θ) +sol_t = solve(ode_solver,op,uh0,t0,tF) for (uh_tn, tn) in sol_t # Here we have the solution uh_tn at tn diff --git a/test/TransientFEsTests/AffineFEOperatorsTests.jl b/test/TransientFEsTests/AffineFEOperatorsTests.jl index 3d36ad8..b68078b 100644 --- a/test/TransientFEsTests/AffineFEOperatorsTests.jl +++ b/test/TransientFEsTests/AffineFEOperatorsTests.jl @@ -54,8 +54,8 @@ U0 = U(0.0) uh0 = interpolate_everywhere(u(0.0),U0) ls = LUSolver() -odes = ThetaMethod(ls,dt,θ) -sol_t = solve(odes,op,uh0,t0,tF) +ode_solver = ThetaMethod(ls,dt,θ) +sol_t = solve(ode_solver,op,uh0,t0,tF) l2(w) = w*w diff --git a/test/TransientFEsTests/BoundaryHeatEquationTests.jl b/test/TransientFEsTests/BoundaryHeatEquationTests.jl index 70f5749..b5bdc0c 100644 --- a/test/TransientFEsTests/BoundaryHeatEquationTests.jl +++ b/test/TransientFEsTests/BoundaryHeatEquationTests.jl @@ -70,9 +70,9 @@ uh0 = interpolate_everywhere(u(0.0),U0) ls = LUSolver() using Gridap.Algebra: NewtonRaphsonSolver # nls = NLSolver(ls;show_trace=true,method=:newton) #linesearch=BackTracking()) -odes = ThetaMethod(ls,dt,θ) +ode_solver = ThetaMethod(ls,dt,θ) -sol_t = solve(odes,op,uh0,t0,tF) +sol_t = solve(ode_solver,op,uh0,t0,tF) # Juno.@enter Base.iterate(sol_t) diff --git a/test/TransientFEsTests/ConstantFEOperatorsTests.jl b/test/TransientFEsTests/ConstantFEOperatorsTests.jl index 8ecaf4f..d1a852a 100644 --- a/test/TransientFEsTests/ConstantFEOperatorsTests.jl +++ b/test/TransientFEsTests/ConstantFEOperatorsTests.jl @@ -54,8 +54,8 @@ U0 = U(0.0) uh0 = interpolate_everywhere(u(0.0),U0) ls = LUSolver() -odes = ThetaMethod(ls,dt,θ) -sol_t = solve(odes,op,uh0,t0,tF) +ode_solver = ThetaMethod(ls,dt,θ) +sol_t = solve(ode_solver,op,uh0,t0,tF) l2(w) = w*w diff --git a/test/TransientFEsTests/DGHeatEquationTests.jl b/test/TransientFEsTests/DGHeatEquationTests.jl index 05eb2c5..05d0b65 100644 --- a/test/TransientFEsTests/DGHeatEquationTests.jl +++ b/test/TransientFEsTests/DGHeatEquationTests.jl @@ -69,9 +69,9 @@ uh0 = interpolate_everywhere(u(0.0),U0) ls = LUSolver() using Gridap.Algebra: NewtonRaphsonSolver -odes = ThetaMethod(ls,dt,θ) +ode_solver = ThetaMethod(ls,dt,θ) -sol_t = solve(odes,op,uh0,t0,tF) +sol_t = solve(ode_solver,op,uh0,t0,tF) l2(w) = w*w diff --git a/test/TransientFEsTests/ForwardEulerHeatEquationTests.jl b/test/TransientFEsTests/ForwardEulerHeatEquationTests.jl index e82fb1a..2de154d 100644 --- a/test/TransientFEsTests/ForwardEulerHeatEquationTests.jl +++ b/test/TransientFEsTests/ForwardEulerHeatEquationTests.jl @@ -60,9 +60,9 @@ uh0 = interpolate_everywhere(u(0.0),U0) ls = LUSolver() using Gridap.Algebra: NewtonRaphsonSolver nls = NLSolver(ls;show_trace=true,method=:newton) #linesearch=BackTracking()) -odes = ThetaMethod(ls,dt,θ) +ode_solver = ThetaMethod(ls,dt,θ) -sol_t = solve(odes,op,uh0,t0,tF) +sol_t = solve(ode_solver,op,uh0,t0,tF) l2(w) = w*w diff --git a/test/TransientFEsTests/HeatEquationAutoDiffTests.jl b/test/TransientFEsTests/HeatEquationAutoDiffTests.jl index b4d5313..9fb494c 100644 --- a/test/TransientFEsTests/HeatEquationAutoDiffTests.jl +++ b/test/TransientFEsTests/HeatEquationAutoDiffTests.jl @@ -71,9 +71,9 @@ uh0 = interpolate_everywhere(u(0.0),U0) ls = LUSolver() using Gridap.Algebra: NewtonRaphsonSolver nls = NLSolver(ls;show_trace=true,method=:newton) #linesearch=BackTracking()) -odes = ThetaMethod(ls,dt,θ) +ode_solver = ThetaMethod(ls,dt,θ) -sol_t = solve(odes,op,uh0,t0,tF) +sol_t = solve(ode_solver,op,uh0,t0,tF) # Juno.@enter Base.iterate(sol_t) diff --git a/test/TransientFEsTests/HeatEquationTests.jl b/test/TransientFEsTests/HeatEquationTests.jl index 992c08a..68d5319 100644 --- a/test/TransientFEsTests/HeatEquationTests.jl +++ b/test/TransientFEsTests/HeatEquationTests.jl @@ -56,9 +56,9 @@ uh0 = interpolate_everywhere(u(0.0),U0) ls = LUSolver() using Gridap.Algebra: NewtonRaphsonSolver nls = NLSolver(ls;show_trace=true,method=:newton) #linesearch=BackTracking()) -odes = ThetaMethod(ls,dt,θ) +ode_solver = ThetaMethod(ls,dt,θ) -sol_t = solve(odes,op,uh0,t0,tF) +sol_t = solve(ode_solver,op,uh0,t0,tF) # Juno.@enter Base.iterate(sol_t) diff --git a/test/TransientFEsTests/HeatVectorEquationTests.jl b/test/TransientFEsTests/HeatVectorEquationTests.jl index 4262c34..58c213a 100644 --- a/test/TransientFEsTests/HeatVectorEquationTests.jl +++ b/test/TransientFEsTests/HeatVectorEquationTests.jl @@ -57,9 +57,9 @@ U0 = U(0.0) uh0 = interpolate_everywhere(u(0.0),U0) ls = LUSolver() -odes = ThetaMethod(ls,dt,θ) +ode_solver = ThetaMethod(ls,dt,θ) -sol_t = solve(odes,op,uh0,t0,tF) +sol_t = solve(ode_solver,op,uh0,t0,tF) l2(w) = w⋅w @@ -89,14 +89,14 @@ ode_cache = allocate_cache(odeop) vθ = similar(u0) nl_cache = nothing -odes.θ == 0.0 ? dtθ = dt : dtθ = dt*odes.θ +ode_solver.θ == 0.0 ? dtθ = dt : dtθ = dt*ode_solver.θ tθ = t0+dtθ ode_cache = update_cache!(ode_cache,odeop,tθ) using GridapODEs.ODETools: ThetaMethodNonlinearOperator nlop = ThetaMethodNonlinearOperator(odeop,tθ,dtθ,u0,ode_cache,vθ) -nl_cache = solve!(uf,odes.nls,nlop,nl_cache) +nl_cache = solve!(uf,ode_solver.nls,nlop,nl_cache) uf K = nl_cache.A diff --git a/test/TransientFEsTests/StokesEquationAutoDiffTests.jl b/test/TransientFEsTests/StokesEquationAutoDiffTests.jl index 640f039..487d6d6 100644 --- a/test/TransientFEsTests/StokesEquationAutoDiffTests.jl +++ b/test/TransientFEsTests/StokesEquationAutoDiffTests.jl @@ -99,9 +99,9 @@ tF = 1.0 dt = 0.1 ls = LUSolver() -odes = ThetaMethod(ls,dt,θ) +ode_solver = ThetaMethod(ls,dt,θ) -sol_t = solve(odes,op,xh0,t0,tF) +sol_t = solve(ode_solver,op,xh0,t0,tF) l2(w) = w⋅w diff --git a/test/TransientFEsTests/StokesEquationTests.jl b/test/TransientFEsTests/StokesEquationTests.jl index ddba6ea..b731e71 100644 --- a/test/TransientFEsTests/StokesEquationTests.jl +++ b/test/TransientFEsTests/StokesEquationTests.jl @@ -84,9 +84,9 @@ tF = 1.0 dt = 0.1 ls = LUSolver() -odes = ThetaMethod(ls,dt,θ) +ode_solver = ThetaMethod(ls,dt,θ) -sol_t = solve(odes,op,xh0,t0,tF) +sol_t = solve(ode_solver,op,xh0,t0,tF) l2(w) = w⋅w diff --git a/test/TransientFEsTests/Transient2ndOrderFEOperatorsTests.jl b/test/TransientFEsTests/Transient2ndOrderFEOperatorsTests.jl index 914e478..6d3e507 100644 --- a/test/TransientFEsTests/Transient2ndOrderFEOperatorsTests.jl +++ b/test/TransientFEsTests/Transient2ndOrderFEOperatorsTests.jl @@ -68,12 +68,12 @@ vh0_const = interpolate_everywhere(v_const(0.0),U0) ah0_const = interpolate_everywhere(a_const(0.0),U0) ls = LUSolver() -odes = Newmark(ls,dt,γ,β) +ode_solver = Newmark(ls,dt,γ,β) -sol_t = solve(odes,op,(uh0,vh0,ah0),t0,tF) -sol_affine_t = solve(odes,op_affine,(uh0,vh0,ah0),t0,tF) -sol_const_t = solve(odes,op_const,(uh0,vh0_const,ah0_const),t0,tF) -sol_const_mat_t = solve(odes,op_const_mat,(uh0,vh0,ah0),t0,tF) +sol_t = solve(ode_solver,op,(uh0,vh0,ah0),t0,tF) +sol_affine_t = solve(ode_solver,op_affine,(uh0,vh0,ah0),t0,tF) +sol_const_t = solve(ode_solver,op_const,(uh0,vh0_const,ah0_const),t0,tF) +sol_const_mat_t = solve(ode_solver,op_const_mat,(uh0,vh0,ah0),t0,tF) l2(w) = w*w diff --git a/test/TransientFEsTests/TransientFEOperatorsTests.jl b/test/TransientFEsTests/TransientFEOperatorsTests.jl index 062aa18..9483657 100644 --- a/test/TransientFEsTests/TransientFEOperatorsTests.jl +++ b/test/TransientFEsTests/TransientFEOperatorsTests.jl @@ -60,9 +60,9 @@ U0 = U(0.0) uh0 = interpolate_everywhere(u(0.0),U0) ls = LUSolver() -odes = ThetaMethod(ls,dt,θ) +ode_solver = ThetaMethod(ls,dt,θ) -sol_t = solve(odes,op,uh0,t0,tF) +sol_t = solve(ode_solver,op,uh0,t0,tF) l2(w) = w*w @@ -91,14 +91,14 @@ nl_cache = nothing # tf = t0+dt -odes.θ == 0.0 ? dtθ = dt : dtθ = dt*odes.θ +ode_solver.θ == 0.0 ? dtθ = dt : dtθ = dt*ode_solver.θ tθ = t0+dtθ ode_cache = update_cache!(ode_cache,odeop,tθ) using GridapODEs.ODETools: ThetaMethodNonlinearOperator nlop = ThetaMethodNonlinearOperator(odeop,tθ,dtθ,u0,ode_cache,vθ) -nl_cache = solve!(uf,odes.nls,nlop,nl_cache) +nl_cache = solve!(uf,ode_solver.nls,nlop,nl_cache) K = nl_cache.A h = nl_cache.b diff --git a/test/TransientFEsTests/TransientFETests.jl b/test/TransientFEsTests/TransientFETests.jl index 779d03a..fb1a66e 100644 --- a/test/TransientFEsTests/TransientFETests.jl +++ b/test/TransientFEsTests/TransientFETests.jl @@ -112,16 +112,15 @@ tol = 1.0 maxiters = 20 using Gridap.Algebra: NewtonRaphsonSolver nls = NLSolver(ls;show_trace=true,method=:newton) #linesearch=BackTracking()) -odes = ThetaMethod(nls,dt,1.0) -@test test_transient_fe_solver(odes,op,uh0,t0,tF) +ode_solver = ThetaMethod(nls,dt,1.0) +@test test_transient_fe_solver(ode_solver,op,uh0,t0,tF) residual!(r,op,0.1,(uh,uh),cache) jacobian!(J,op,1.0,(uh,uh10),1,1.0,cache) jacobian!(J,op,1.0,(uh,uh10),2,10.0,cache) u0 = get_free_dof_values(uh0) -odes -solver = odes +solver = ode_solver t0 = 0.0 ode_cache = allocate_cache(odeop) cache = nothing @@ -194,7 +193,7 @@ Gridap.Algebra.nlsolve(df,x;linsolve=linsolve!,nls.kwargs...) using Gridap.FESpaces: get_algebraic_operator odeop = get_algebraic_operator(op) -sol_ode_t = solve(odes,odeop,u0,t0,tF) +sol_ode_t = solve(ode_solver,odeop,u0,t0,tF) test_ode_solution(sol_ode_t) _t_n = t0 @@ -205,8 +204,8 @@ for (u_n, t_n) in sol_ode_t @test all(u_n .≈ t_n) end -odes = ThetaMethod(nls,dt,θ) -sol_ode_t = solve(odes,odeop,u0,t0,tF) +ode_solver = ThetaMethod(nls,dt,θ) +sol_ode_t = solve(ode_solver,odeop,u0,t0,tF) test_ode_solution(sol_ode_t) _t_n = t0 un, tn = Base.iterate(sol_ode_t) @@ -217,7 +216,7 @@ for (u_n, t_n) in sol_ode_t @test all(u_n .≈ t_n) end -sol_t = solve(odes,op,uh0,t0,tF) +sol_t = solve(ode_solver,op,uh0,t0,tF) @test test_transient_fe_solution(sol_t) _t_n = 0.0 diff --git a/test/TransientFEsTests/VectorHeatEquationTests.jl b/test/TransientFEsTests/VectorHeatEquationTests.jl index 9bf2892..7dc2660 100644 --- a/test/TransientFEsTests/VectorHeatEquationTests.jl +++ b/test/TransientFEsTests/VectorHeatEquationTests.jl @@ -67,9 +67,9 @@ xh0 = interpolate_everywhere([uh0,uh0],X0) ls = LUSolver() # using Gridap.Algebra: NewtonRaphsonSolver # nls = NLSolver(ls;show_trace=true,method=:newton) #linesearch=BackTracking()) -odes = ThetaMethod(ls,dt,θ) +ode_solver = ThetaMethod(ls,dt,θ) -sol_t = solve(odes,op,xh0,t0,tF) +sol_t = solve(ode_solver,op,xh0,t0,tF) l2(w) = w⋅w