Rename nabla -> laplacian
This commit is contained in:
committed by
Nicola Demo
parent
92e0e4920b
commit
6c627c70e3
@@ -1,6 +1,6 @@
|
||||
""" Module """
|
||||
from .equation import Equation
|
||||
from ..operators import grad, div, nabla
|
||||
from ..operators import grad, div, laplacian
|
||||
|
||||
|
||||
class FixedValue(Equation):
|
||||
@@ -92,5 +92,5 @@ class Laplace(Equation):
|
||||
are considered. Default is ``None``.
|
||||
"""
|
||||
def equation(input_, output_):
|
||||
return nabla(output_, input_, components=components, d=d)
|
||||
super().__init__(equation)
|
||||
return laplacian(output_, input_, components=components, d=d)
|
||||
super().__init__(equation)
|
||||
|
||||
@@ -145,26 +145,26 @@ def div(output_, input_, components=None, d=None):
|
||||
return div
|
||||
|
||||
|
||||
def nabla(output_, input_, components=None, d=None, method='std'):
|
||||
def laplacian(output_, input_, components=None, d=None, method='std'):
|
||||
"""
|
||||
Perform nabla (laplace) operator. The operator works for vectorial and
|
||||
Compute Laplace operator. The operator works for vectorial and
|
||||
scalar functions, with multiple input coordinates.
|
||||
|
||||
:param LabelTensor output_: the output tensor onto which computing the
|
||||
nabla.
|
||||
Laplacian.
|
||||
:param LabelTensor input_: the input tensor with respect to which computing
|
||||
the nabla.
|
||||
the Laplacian.
|
||||
:param list(str) components: the name of the output variables to calculate
|
||||
the nabla for. It should be a subset of the output labels. If None,
|
||||
the Laplacian for. It should be a subset of the output labels. If None,
|
||||
all the output variables are considered. Default is None.
|
||||
:param list(str) d: the name of the input variables on which the nabla
|
||||
:param list(str) d: the name of the input variables on which the Laplacian
|
||||
is calculated. d should be a subset of the input labels. If None, all
|
||||
the input variables are considered. Default is None.
|
||||
:param str method: used method to calculate nabla, defaults to 'std'.
|
||||
:param str method: used method to calculate Laplacian, defaults to 'std'.
|
||||
:raises ValueError: for vectorial field derivative with respect to
|
||||
all coordinates must be performed.
|
||||
:raises NotImplementedError: 'divgrad' not implemented as method.
|
||||
:return: The tensor containing the result of the nabla operator.
|
||||
:return: The tensor containing the result of the Laplacian operator.
|
||||
:rtype: LabelTensor
|
||||
"""
|
||||
if d is None:
|
||||
@@ -217,15 +217,15 @@ def advection(output_, input_, velocity_field, components=None, d=None):
|
||||
with multiple input coordinates.
|
||||
|
||||
:param LabelTensor output_: the output tensor onto which computing the
|
||||
nabla.
|
||||
advection.
|
||||
:param LabelTensor input_: the input tensor with respect to which computing
|
||||
the nabla.
|
||||
the advection.
|
||||
:param str velocity_field: the name of the output variables which is used
|
||||
as velocity field. It should be a subset of the output labels.
|
||||
:param list(str) components: the name of the output variables to calculate
|
||||
the nabla for. It should be a subset of the output labels. If None,
|
||||
the Laplacian for. It should be a subset of the output labels. If None,
|
||||
all the output variables are considered. Default is None.
|
||||
:param list(str) d: the name of the input variables on which the nabla
|
||||
:param list(str) d: the name of the input variables on which the advection
|
||||
is calculated. d should be a subset of the input labels. If None, all
|
||||
the input variables are considered. Default is None.
|
||||
:return: the tensor containing the result of the advection operator.
|
||||
|
||||
@@ -13,7 +13,7 @@ class TimeDependentProblem(AbstractProblem):
|
||||
|
||||
:Example:
|
||||
>>> from pina.problem import SpatialProblem, TimeDependentProblem
|
||||
>>> from pina.operators import grad, nabla
|
||||
>>> from pina.operators import grad, laplacian
|
||||
>>> from pina import Condition, Span
|
||||
>>> import torch
|
||||
>>>
|
||||
@@ -26,8 +26,8 @@ class TimeDependentProblem(AbstractProblem):
|
||||
>>> def wave_equation(input_, output_):
|
||||
>>> u_t = grad(output_, input_, components=['u'], d=['t'])
|
||||
>>> u_tt = grad(u_t, input_, components=['dudt'], d=['t'])
|
||||
>>> nabla_u = nabla(output_, input_, components=['u'], d=['x'])
|
||||
>>> return nabla_u - u_tt
|
||||
>>> delta_u = laplacian(output_, input_, components=['u'], d=['x'])
|
||||
>>> return delta_u - u_tt
|
||||
>>>
|
||||
>>> def nil_dirichlet(input_, output_):
|
||||
>>> value = 0.0
|
||||
|
||||
Reference in New Issue
Block a user