Documentation for v0.1 version (#199)
* Adding Equations, solving typos * improve _code.rst * the team rst and restuctore index.rst * fixing errors --------- Co-authored-by: Dario Coscia <dariocoscia@dhcp-015.eduroam.sissa.it>
This commit is contained in:
committed by
Nicola Demo
parent
3f9305d475
commit
8b7b61b3bd
@@ -4,21 +4,25 @@ from pina import LabelTensor
|
||||
import torch
|
||||
import pytest
|
||||
|
||||
|
||||
def eq1(input_, output_):
|
||||
u_grad = grad(output_, input_)
|
||||
u1_xx = grad(u_grad, input_, components=['du1dx'], d=['x'])
|
||||
u2_xy = grad(u_grad, input_, components=['du2dx'], d=['y'])
|
||||
return torch.hstack([u1_xx , u2_xy])
|
||||
return torch.hstack([u1_xx, u2_xy])
|
||||
|
||||
|
||||
def eq2(input_, output_):
|
||||
force_term = (torch.sin(input_.extract(['x'])*torch.pi) *
|
||||
torch.sin(input_.extract(['y'])*torch.pi))
|
||||
force_term = (torch.sin(input_.extract(['x']) * torch.pi) *
|
||||
torch.sin(input_.extract(['y']) * torch.pi))
|
||||
delta_u = laplacian(output_.extract(['u1']), input_)
|
||||
return delta_u - force_term
|
||||
|
||||
|
||||
def foo():
|
||||
pass
|
||||
|
||||
|
||||
def test_constructor():
|
||||
Equation(eq1)
|
||||
Equation(eq2)
|
||||
@@ -27,6 +31,7 @@ def test_constructor():
|
||||
with pytest.raises(ValueError):
|
||||
Equation(foo())
|
||||
|
||||
|
||||
def test_residual():
|
||||
eq_1 = Equation(eq1)
|
||||
eq_2 = Equation(eq2)
|
||||
|
||||
Reference in New Issue
Block a user