refactor(condition): deprecate `x` in favor of `u` in DirichletBVP
@@ -196,27 +196,28 @@ class IVP(BaseCondition):
class DirichletBVP(BaseCondition):
r"""A double-ended Dirichlet boundary condition:
- :math:`x(t_0)=x_0` and :math:`x(t_1)=x_1`.
+ :math:`u(t_0)=u_0` and :math:`u(t_1)=u_1`.
:param t_0: The initial time.
:type t_0: float
+ :param u_0: The initial value of :math:`u`. :math:`u(t_0)=u_0`.
+ :type u_0: float
:param t_1: The final time.
:type t_1: float
- :param x_0: The initial value of :math:`x`. :math:`x(t_0)=x_0`.
- :type x_0: float
- :param x_1: The initial value of :math:`x`. :math:`x(t_1)=x_1`.
- :type x_1: float
+ :param u_1: The initial value of :math:`u`. :math:`u(t_1)=u_1`.
+ :type u_1: float
"""
- def __init__(self, t_0, x_0, t_1, x_1):
+ @deprecated_alias(x_0='u_0', x_1='u_1')
+ def __init__(self, t_0, u_0, t_1, u_1):
super().__init__()
- self.t_0, self.x_0, self.t_1, self.x_1 = t_0, x_0, t_1, x_1
+ self.t_0, self.u_0, self.t_1, self.u_1 = t_0, u_0, t_1, u_1
def parameterize(self, output_tensor, t):
r"""Re-parameterizes outputs such that the Dirichlet condition is satisfied on both ends of the domain.
The re-parameterization is
- :math:`\displaystyle x(t)=(1-\tilde{t})x_0+\tilde{t}x_1+\left(1-e^{(1-\tilde{t})\tilde{t}}\right)\mathrm{ANN}(t)`,
+ :math:`\displaystyle u(t)=(1-\tilde{t})u_0+\tilde{t}u_1+\left(1-e^{(1-\tilde{t})\tilde{t}}\right)\mathrm{ANN}(t)`,
where :math:`\displaystyle \tilde{t} = \frac{t-t_0}{t_1-t_0}` and :math:`\mathrm{ANN}` is the neural network.
:param output_tensor: Output of the neural network.
@@ -228,8 +229,8 @@ class DirichletBVP(BaseCondition):
"""
t_tilde = (t - self.t_0) / (self.t_1 - self.t_0)
- return self.x_0 * (1 - t_tilde) \
- + self.x_1 * t_tilde \
+ return self.u_0 * (1 - t_tilde) \
+ + self.u_1 * t_tilde \
+ (1 - torch.exp((1 - t_tilde) * t_tilde)) * output_tensor
