PTsolvers / JustRelax.jl

Pseudo-transient accelerated iterative solvers
https://ptsolvers.github.io/JustRelax.jl/dev/
MIT License
26 stars 6 forks source link

Add DisplacementBoundaryConditions #188

Closed aelligp closed 2 months ago

aelligp commented 2 months ago

This PR renames the boundary conditions to:

This allows to set displacement BCs by e.g.:

    bcs = DisplacementBoundaryConditions(;
    no_slip      = (left=false, right=false, top=false, bot=false),
    free_slip    = (left=true, right=true, top=true, bot=true),
    free_surface = false
)
    stokes.U.Ux .= PTArray(backend)([ x*εbg*lx*dt for x in xvi[1], _ in 1:ny+2])
    stokes.U.Uy .= PTArray(backend)([-y*εbg*ly*dt for _ in 1:nx+2, y in xvi[2]])
    flow_bcs!(stokes, flow_bcs) # apply boundary conditions
    displacement2velocity!(stokes, dt)
    update_halo!(@velocity(stokes)...)

Within the stokes solver, the BC's are converted from displacement to velocity by displacement2velocity!(stokes,dt) and after solving the PT iterations back to displacement by velocity2displacement!(stokes, dt). This minimizes the amount of different solvers. Here the ShearBand2D benchmark for both velocity and displacement BC's with a resolution of 512x512 and the same input parameters. Velocity BC's (note that the bottom left is Vx): 28_velocity and displacement 28_displacement