Skip to content

Commit f5e2b1c

Browse files
committed
Allow DirichletBC.func returns a number
1 parent 1ab33d1 commit f5e2b1c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

deepxde/boundary_conditions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from __future__ import division
33
from __future__ import print_function
44

5+
import numbers
6+
57
import numpy as np
68

79
from .backend import tf
@@ -49,7 +51,7 @@ def __init__(self, geom, func, on_boundary, component=0):
4951

5052
def error(self, X, inputs, outputs, beg, end):
5153
values = self.func(X[beg:end])
52-
if values.shape[1] != 1:
54+
if not isinstance(values, numbers.Number) and values.shape[1] != 1:
5355
raise RuntimeError(
5456
"DirichletBC should output 1D values. Use argument 'component' for different components."
5557
)

0 commit comments

Comments
 (0)