Skip to content
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.

gridap/GridapODEs.jl

Repository files navigation

🚫 VERY IMPORTANT NOTE: This repository is discontinued from 28/02/2022. GridapODEs has been merged into Gridap. Its development continues here 🚫

GridapODEs

Stable Dev Build Status Codecov DOI

This package provides time integration tools for Gridap. As an example, the following code solves the heat equation.

using Gridap
using ForwardDiff
using GridapODEs.ODETools
using GridapODEs.TransientFETools

θ = 0.5

u(x,t) = (1.0-x[1])*x[1]*(1.0-x[2])*x[2]*t
u(t) = x -> u(x,t)

f(t) = x -> ∂t(u)(x,t)-Δ(u(t))(x) # or ∂t(u)(t)(x)-Δ(u(t))(x)

domain = (0,1,0,1)
partition = (4,4)
model = CartesianDiscreteModel(domain,partition)

order = 2

reffe = ReferenceFE(lagrangian,Float64,order)
V0 = FESpace(
  model,
  reffe,
  conformity=:H1, 
  dirichlet_tags="boundary"
)

U = TransientTrialFESpace(V0,u)

Ω = Triangulation(model)
degree = 2*order
dΩ = Measure(Ω,degree)

a(u,v) = ( (v)(u) )dΩ
b(v,t) = ( v*f(t) )dΩ
m(u,v) = ( v*u )dΩ

res(t,u,v) = a(u,v) + m(∂t(u),v) - b(v,t)
jac(t,u,du,v) = a(du,v)
jac_t(t,u,dut,v) = m(dut,v)

op = TransientFEOperator(res,jac,jac_t,U,V0)

t0 = 0.0
tF = 1.0
dt = 0.1

U0 = U(0.0)
uh0 = interpolate_everywhere(u(0.0),U0)

ls = LUSolver()
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
end

How to cite GridapODEs

In order to give credit to the Gridap and GridapODEs contributors, we simply ask you to cite the Gridap main project as indicated here and the sub-packages you use as indicated in the corresponding repositories. Please, use the reference below in any publication in which you have made use of GridapODEs:

@misc{Badia_GridapODEs_2021,
author = {Badia, Santiago and Colomes, Oriol and Verdugo, Francesc},
doi = {10.5281/zenodo.5518455},
month = {9},
title = {{GridapODEs}},
url = {https://github.com/gridap/GridapODEs.jl},
year = {2021}
}