6. Splittings
A splitting scheme advances a system
The stepper drives a splitting like a Runge–Kutta scheme, one flow per stage. You declare the partitions as component ranges, and stage_partition(k) tells you which partition flow k advances, so you compute only that half of the residual.
allocate(y(1:2, 0:2, 0:2, 0:2, 1:1)) ! one cell, two components: q (1) and p (2)
y = 0._R_P ; y(2,1,1,1,1) = 1._R_P
bx = box_interior(LAYOUT_V_FIRST, 2_I4P, 1_I4P, 1_I4P, 1_I4P, 1_I4P, 1_I4P)
! partition 1 = components 1..1 (q), partition 2 = components 2..2 (p): column p holds (v1, v2)
call st%initialize(name, FORM_SPLITTING, lb=lbound(y), ub=ubound(y), partitions=reshape([1, 1, 2, 2], [2, 2]))call st%begin_step(bx, y)
do k=1, st%stages()
call st%begin_stage(k, bx, dt, y)
r => st%rhs_register()
select case(st%stage_partition(k)) ! the flow of stage k advances one partition:
case(1) ; r(1,1,1,1,1) = y(2,1,1,1,1) ! q' = p (its residual depends on p only)
case(2) ; r(2,1,1,1,1) = -y(1,1,1,1,1) ! p' = -q (on q only)
endselect
call st%end_stage(k, bx, dt, y) ! the partition's components += c_k dt r
enddo
call st%finish_step(bx, dt, y)partitions(:,p)holds(v1, v2), the components of partitionp: hereqalone andpalone.end_stageadvances the partition's components by: a forward-Euler sub-flow.
Running it
$ splittings
strang errors 3.23E-04 8.07E-05 2.02E-05 orders 2.00 2.00
yoshida-4 errors 8.50E-07 5.31E-08 3.32E-09 orders 4.00 4.00
blanes-moan-s10 errors 8.09E-10 1.26E-11 1.96E-13 orders 6.01 6.01When a splitting reaches its order
The sub-flow
What you learned
Partitions, flows, stage_partition, and when the declared order holds. Reference: Schemes: splittings, A4.
Next: 7. Masks.