Skip to content

discretize fails on Robin Boundary condition applied to Laplace equation in spherical domain #75

@rschiemann1

Description

@rschiemann1

Solving a simple heat conduction problem on a sphere (1D in radial direction, assumed rotational symmetry) with symmetry boundary condition on r=0 and convective heat flux boundary condition on r=R (boundary condition of Robin type) fails with error Boundary condition Differential(r)(T(0.01, t)) ~ 100 - T(0.01, t) is not on a boundary of the domain, or is not a valid boundary condition. MethodOfLines documentation claims that Robin BCs should work.

using ModelingToolkit, MethodOfLines, OrdinaryDiffEq, DomainSets

@parameters r t
@variables T(..)
Dt = Differential(t)
Dr = Differential(r)
Drr = Differential(r)^2

t_min = 0.0
t_max = 11.5

R = 10e-3 # Sphere radius
T_ambient = 100 # ambient temperature


T0(r,t) = 20 # initial temperature field

# Laplace equation in spherical coordinates, describing heat conduction in sphere
eq = [Dt(T(r,t)) ~ 1/r^2 * Dr(r^2 * Dr(T(r,t))) ]


domains = [r  Interval(0, R),
           t  Interval(t_min, t_max)]

# BCs
bcs = [T(r,0) ~ T0(r,0), # initial values
       Dr(T(0,t)) ~ 0,   # symmetry at r = 0
       Dr(T(R,t)) ~ T_ambient - T(R,t)]  # Robin type BC describing convective heat transport on sphere surface
       


@named pdesys = PDESystem(eq,bcs,domains,[r,t],[T(r,t)])

N = 32
dr = 1/N
order = 2

discretization = MOLFiniteDifference([r=>dr], t, approx_order=order, upwind_order = 1, grid_align = center_align)


# fails on third Boundary Condition (Robin one) with error:
#  Boundary condition Differential(r)(T(0.01, t)) ~ 100 - T(0.01, t) is not on a boundary of the domain, or is not a valid boundary condition
prob = discretize(pdesys,discretization)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions