From 422471a50d21211394b70558bbecbff481bab35f Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Mon, 2 Oct 2023 20:38:14 -0400 Subject: [PATCH 01/29] Upload linear elasticity example --- docs/.DS_Store | Bin 0 -> 6148 bytes docs/demos/pinn_forward/elasticity.plate.rst | 259 +++++++++++++++++++ examples/pinn_forward/elasticity_plate_2d.py | 150 +++++++++++ 3 files changed, 409 insertions(+) create mode 100644 docs/.DS_Store create mode 100644 docs/demos/pinn_forward/elasticity.plate.rst create mode 100644 examples/pinn_forward/elasticity_plate_2d.py diff --git a/docs/.DS_Store b/docs/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..435546d8990db150bac99f7827e03da5c09877b1 GIT binary patch literal 6148 zcmeH~J&pn~427Thk&w2b+%gRZ;06(b6YK>LJKM3E0@3H_JUecfrADLGv*f(kiRb4l zCSw40xDR_^3t&Tc#mSdKt&7r?JSr9?*G>=k;8ch=2%)fCz|y z2+W8;9O69xKW6kydK3{5fq4+{??a)x*3{NDJ{=sQ1)#2&4&yv}32N~KwWhYN%+M^m z2g_26HpKH$PA$2wrnauV9G1<8<((?J6KYLuU74ZjM<6h0 J5P`Q6cmSZ%6OjM_ literal 0 HcmV?d00001 diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst new file mode 100644 index 000000000..fea7a780d --- /dev/null +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -0,0 +1,259 @@ +Linear elastostatic equation over a 2D square domain +========== + +Problem setup +-------------- + +We will solve a 2D linear elasticity solid mechanic problem: + +.. math:: \frac{\partial \sigma_{xx}}{\partial x} + \frac{\partial \sigma_{xy}}{\partial y} + f_x= 0, + + \frac{\partial \sigma_{xy}}{\partial x} + \frac{\partial \sigma_{yy}}{\partial y} + f_y= 0, \qquad \Omega = [0, 1]^2, + +where the linear elastic constitutive model is defined as, + +.. math:: \sigma_{xx} = (\lambda + 2\mu)\epsilon_{xx} + \lambda\epsilon_{yy}, + + \sigma_{yy} = (\lambda + 2\mu)\epsilon_{yy} + \lambda\epsilon_{xx}, + + \sigma_{xy} = 2\mu\epsilon_{xy}, + +with kinematic relation, + +.. math:: \epsilon_{xx} = \frac{\partial u_{x}}{\partial x}, \qquad + \epsilon_{yy} = \frac{\partial u_{y}}{\partial y}, \qquad + \epsilon_{xy} = \frac{1}{2}(\frac{\partial u_{x}}{\partial y} + \frac{\partial u_{y}}{\partial x}). + +The 2D square domain is subjected to body forces, + +.. math:: f_x = \lambda[4\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3] + \mu[9\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3], + + f_y = \lambda[-3sin(\pi x)Qy^2 + 2\pi^2sin(2\pi x) cos(\pi y)] + \mu[-6 sin(\pi x)Qy^2 + 2 \pi^2 sin(2\pi x)cos(\pi y) + \pi^2 sin(\pi x)Qy^4/4], + +with displacement boundary conditions, + +.. math:: u_y(0, y)=0, \qquad u_y(1, y)=0, \qquad u_x(x, 0)=u_y(x, 0) = 0, + +and traction boundary conditions, + +.. math:: \sigma_{xx}(0, y)=0, \qquad \sigma_{xx}(1, y)=0, \qquad \sigma_{xx}(x, 1)=(\lambda + 2\mu)Qsin(\pi x). + +The parameters :math:`\lambda = 1,` :math:`\mu = 0.5,` and :math:`Q = 4.` + +The exact solution is :math:`u_x(x, y) = cos(2\pi x)sin(\pi y)` and :math:`u_y(x, y) = sin(\pi x)Qy^4/4.` + +Implementation +-------------- + +This description goes through the implementation of a solver for the above described linear elasticity problem step-by-step. + +First, the DeepXDE, NumPy (``np``) and PyTorch (``torch``) modules are imported: + +.. code-block:: python + + import deepxde as dde + import numpy as np + from deepxde.backend import torch + + +We begin by defining the general parameters for the problem. + +.. code-block:: python + + lmbd = 1.0 + mu = 0.5 + Q = 4.0 + pi = torch.pi + +Next, we define a computational geometry. We can use a built-in class ``Rectangle`` as follows + +.. code-block:: python + + geom = dde.geometry.Rectangle([0, 0], [1, 1]) + + +Next, we consider the left, right, top, and bottom boundary conditions. Two boundary conditions are applied on the left boundary. The location of the boundary conditions is defined by a simple Python function. The function should return ``True`` for those points satisfying :math:`x[0]=0` and ``False`` otherwise (Note that because of rounding-off errors, it is often wise to use ``dde.utils.isclose`` to test whether two floating point values are equivalent). In the functions below, the argument ``x`` to ``boundary`` is the network input and is a :math:`d`-dim vector, where :math:`d` is the dimension and :math:`d=1` in this case. Then a boolean ``on_boundary`` is used as the second argument. If the point ``x`` (the first argument) is on the boundary of the geometry, then ``on_boundary`` is ``True``, otherwise, ``on_boundary`` is ``False``. + +.. code-block:: python + + def boundary_left(x, on_boundary): + return on_boundary and dde.utils.isclose(x[0], 0.0) + +Two boundary conditions are applied on the right boundary. Similar to ``boundary_left``, the location of these two boundary condition is defined in a similar way that the function should return ``True`` for those points satisfying :math:`x[0]=1` and ``False`` otherwise. + +.. code-block:: python + + def boundary_right(x, on_boundary): + return on_boundary and dde.utils.isclose(x[0], 1.0) + +Two boundary conditions are applied on the top boundary. + +.. code-block:: python + + def boundary_top(x, on_boundary): + return on_boundary and dde.utils.isclose(x[1], 1.0) + +Two boundary conditions are applied on the bottom boundary. + +.. code-block:: python + + def boundary_bottom(x, on_boundary): + return on_boundary and dde.utils.isclose(x[1], 0.0) + +Next, for better comparsion, we define a function which is the exact solution to the problem. + +.. code-block:: python + + def func(x): + ux = np.cos(2 * np.pi * x[:, 0:1]) * np.sin(np.pi * x[:, 1:2]) + uy = np.sin(pi * x[:, 0:1]) * Q * x[:, 1:2] ** 4 / 4 + E_xx = np.diff(ux) / np.diff(x[:, 0:1]) + E_yy = np.diff(uy) / np.diff(x[:, 1:2]) + E_xy = 0.5 * (np.diff(ux) / np.diff(x[:, 1:2]) + np.diff(uy) / np.diff(x[:, 0:1])) + + Sxx = E_xx * (2 * mu + lmbd) + E_yy * lmbd + Syy = E_yy * (2 * mu + lmbd) + E_xx * lmbd + Sxy = 2 * E_xy * mu + + return np.hstack((ux, uy, Sxx, Syy, Sxy)) + +The displacement boundary conditions on the boundary are defined as follows. + +.. code-block:: python + + ux_top_bc = dde.icbc.DirichletBC(geom, lambda x: 0, boundary_top, component=0) + ux_bottom_bc = dde.icbc.DirichletBC(geom, lambda x: 0, boundary_bottom, component=0) + uy_left_bc = dde.icbc.DirichletBC(geom, lambda x: 0, boundary_left, component=1) + uy_bottom_bc = dde.icbc.DirichletBC(geom, lambda x: 0, boundary_bottom, component=1) + uy_right_bc = dde.icbc.DirichletBC(geom, lambda x: 0, boundary_right, component=1) + +Similarly, the traction boundary conditions are defined as, + +.. code-block:: python + + sxx_left_bc = dde.icbc.DirichletBC(geom, lambda x: 0, boundary_left, component=2) + sxx_right_bc = dde.icbc.DirichletBC(geom, lambda x: 0, boundary_right, component=2) + syy_top_bc = dde.icbc.DirichletBC( + geom, + lambda x: (2 * mu + lmbd) * Q * np.sin(pi * x[:, 0:1]), + boundary_top, + component=3, + ) + +Next, we define the body forces, + +.. code-block:: python + + def fx(x): + return ( + -lmbd + * ( + 4 * pi**2 * torch.cos(2 * pi * x[:, 0:1]) * torch.sin(pi * x[:, 1:2]) + - Q * x[:, 1:2] ** 3 * pi * torch.cos(pi * x[:, 0:1]) + ) + - mu + * ( + pi**2 * torch.cos(2 * pi * x[:, 0:1]) * torch.sin(pi * x[:, 1:2]) + - Q * x[:, 1:2] ** 3 * pi * torch.cos(pi * x[:, 0:1]) + ) + - 8 * mu * pi**2 * torch.cos(2 * pi * x[:, 0:1]) * torch.sin(pi * x[:, 1:2]) + ) + + + def fy(x): + return ( + lmbd + * ( + 3 * Q * x[:, 1:2] ** 2 * torch.sin(pi * x[:, 0:1]) + - 2 * pi**2 * torch.cos(pi * x[:, 1:2]) * torch.sin(2 * pi * x[:, 0:1]) + ) + - mu + * ( + 2 * pi**2 * torch.cos(pi * x[:, 1:2]) * torch.sin(2 * pi * x[:, 0:1]) + + (Q * x[:, 1:2] ** 4 * pi**2 * torch.sin(pi * x[:, 0:1])) / 4 + ) + + 6 * Q * mu * x[:, 1:2] ** 2 * torch.sin(pi * x[:, 0:1]) + ) + +Next, we express the PDE residuals of the momentum equation and the constitutive law. + +.. code-block:: python + + def pde(x, f): + E_xx = dde.grad.jacobian(f, x, i=0, j=0) + E_yy = dde.grad.jacobian(f, x, i=1, j=1) + E_xy = 0.5 * (dde.grad.jacobian(f, x, i=0, j=1) + dde.grad.jacobian(f, x, i=1, j=0)) + + S_xx = E_xx * (2 * mu + lmbd) + E_yy * lmbd + S_yy = E_yy * (2 * mu + lmbd) + E_xx * lmbd + S_xy = E_xy * 2 * mu + + Sxx_x = dde.grad.jacobian(f, x, i=2, j=0) + Syy_y = dde.grad.jacobian(f, x, i=3, j=1) + Sxy_x = dde.grad.jacobian(f, x, i=4, j=0) + Sxy_y = dde.grad.jacobian(f, x, i=4, j=1) + + momentum_x = Sxx_x + Sxy_y - fx(x) + momentum_y = Sxy_x + Syy_y - fy(x) + + stress_x = S_xx - f[:, 2:3] + stress_y = S_yy - f[:, 3:4] + stress_xy = S_xy - f[:, 4:5] + + return [momentum_x, momentum_y, stress_x, stress_y, stress_xy] + +The first argument to ``pde`` is the network input, i.e., the :math:`x` and `y` -coordinate. The second argument is the network output, i.e., the solution :math:`u_x(x, y)`, but here we use ``f`` as the name of the variable. + + +Now, we have specified the geometry, PDE residuals, and boundary conditions. We then define the PDE problem as + +.. code-block:: python + + data = dde.data.PDE( + geom, + pde, + [ + ux_top_bc, + ux_bottom_bc, + uy_left_bc, + uy_bottom_bc, + uy_right_bc, + sxx_left_bc, + sxx_right_bc, + syy_top_bc, + ], + num_domain=500, + num_boundary=500, + solution=func, + num_test=100, + ) + +The number 500 is the number of training residual points sampled inside the domain, and the number 500 is the number of training points sampled on the boundary. The argument ``solution=func`` is the reference solution to compute the error of our solution, and can be ignored if we don't have a reference solution. We use 100 residual points for testing the PDE residual. + +Next, we choose the network. Here, we use 5 fully connected independent neural network of depth 5 (i.e., 4 hidden layers) and width 40: + +.. code-block:: python + + layers = [2, [40] * 5, [40] * 5, [40] * 5, [40] * 5, 5] + activation = "tanh" + initializer = "Glorot uniform" + net = dde.nn.PFNN(layers, activation, initializer) + +Now, we have the PDE problem and the network. We build a ``Model`` and choose the optimizer and learning rate: + +.. code-block:: python + + model = dde.Model(data, net) + model.compile("adam", lr=0.001) + +We then train the model for 5000 iterations: + +.. code-block:: python + + losshistory, train_state = model.train(epochs=5000) + +Complete code +-------------- + +.. literalinclude:: ../../../examples/pinn_forward/elasticity_plate_2d.py + :language: python diff --git a/examples/pinn_forward/elasticity_plate_2d.py b/examples/pinn_forward/elasticity_plate_2d.py new file mode 100644 index 000000000..57610f75c --- /dev/null +++ b/examples/pinn_forward/elasticity_plate_2d.py @@ -0,0 +1,150 @@ +"""Backend supported: tensorflow.compat.v1, paddle + +Implementation of the linear elasticity 2D example in paper https://www.sciencedirect.com/science/article/pii/S0045782521000773?casa_token=cqzZTCdxm9kAAAAA:FWwk9lkEaLJMUCq_m_ZY0J2YhZp-uA9_UdxS8DmUqTF-dz1BObM25uUGJKRbtkG-q1O-OAdhpQ. +References: + https://github.com/sciann/sciann-applications/blob/master/SciANN-Elasticity/Elasticity-Forward.ipynb. +""" +import deepxde as dde +import numpy as np +from deepxde.backend import torch + +lmbd = 1.0 +mu = 0.5 +Q = 4.0 +pi = torch.pi + +geom = dde.geometry.Rectangle([0, 0], [1, 1]) + + +def boundary_left(x, on_boundary): + return on_boundary and dde.utils.isclose(x[0], 0.0) + + +def boundary_right(x, on_boundary): + return on_boundary and dde.utils.isclose(x[0], 1.0) + + +def boundary_top(x, on_boundary): + return on_boundary and dde.utils.isclose(x[1], 1.0) + + +def boundary_bottom(x, on_boundary): + return on_boundary and dde.utils.isclose(x[1], 0.0) + + +# Exact solutions +def func(x): + ux = np.cos(2 * np.pi * x[:, 0:1]) * np.sin(np.pi * x[:, 1:2]) + uy = np.sin(pi * x[:, 0:1]) * Q * x[:, 1:2] ** 4 / 4 + + E_xx = np.diff(ux) / np.diff(x[:, 0:1]) + E_yy = np.diff(uy) / np.diff(x[:, 1:2]) + E_xy = 0.5 * (np.diff(ux) / np.diff(x[:, 1:2]) + np.diff(uy) / np.diff(x[:, 0:1])) + + Sxx = E_xx * (2 * mu + lmbd) + E_yy * lmbd + Syy = E_yy * (2 * mu + lmbd) + E_xx * lmbd + Sxy = 2 * E_xy * mu + + return np.hstack((ux, uy, Sxx, Syy, Sxy)) + + +ux_top_bc = dde.icbc.DirichletBC(geom, lambda x: 0, boundary_top, component=0) +ux_bottom_bc = dde.icbc.DirichletBC(geom, lambda x: 0, boundary_bottom, component=0) +uy_left_bc = dde.icbc.DirichletBC(geom, lambda x: 0, boundary_left, component=1) +uy_bottom_bc = dde.icbc.DirichletBC(geom, lambda x: 0, boundary_bottom, component=1) +uy_right_bc = dde.icbc.DirichletBC(geom, lambda x: 0, boundary_right, component=1) +sxx_left_bc = dde.icbc.DirichletBC(geom, lambda x: 0, boundary_left, component=2) +sxx_right_bc = dde.icbc.DirichletBC(geom, lambda x: 0, boundary_right, component=2) +syy_top_bc = dde.icbc.DirichletBC( + geom, + lambda x: (2 * mu + lmbd) * Q * np.sin(pi * x[:, 0:1]), + boundary_top, + component=3, +) + + +def fx(x): + return ( + -lmbd + * ( + 4 * pi**2 * torch.cos(2 * pi * x[:, 0:1]) * torch.sin(pi * x[:, 1:2]) + - Q * x[:, 1:2] ** 3 * pi * torch.cos(pi * x[:, 0:1]) + ) + - mu + * ( + pi**2 * torch.cos(2 * pi * x[:, 0:1]) * torch.sin(pi * x[:, 1:2]) + - Q * x[:, 1:2] ** 3 * pi * torch.cos(pi * x[:, 0:1]) + ) + - 8 * mu * pi**2 * torch.cos(2 * pi * x[:, 0:1]) * torch.sin(pi * x[:, 1:2]) + ) + + +def fy(x): + return ( + lmbd + * ( + 3 * Q * x[:, 1:2] ** 2 * torch.sin(pi * x[:, 0:1]) + - 2 * pi**2 * torch.cos(pi * x[:, 1:2]) * torch.sin(2 * pi * x[:, 0:1]) + ) + - mu + * ( + 2 * pi**2 * torch.cos(pi * x[:, 1:2]) * torch.sin(2 * pi * x[:, 0:1]) + + (Q * x[:, 1:2] ** 4 * pi**2 * torch.sin(pi * x[:, 0:1])) / 4 + ) + + 6 * Q * mu * x[:, 1:2] ** 2 * torch.sin(pi * x[:, 0:1]) + ) + + +def pde(x, f): + E_xx = dde.grad.jacobian(f, x, i=0, j=0) + E_yy = dde.grad.jacobian(f, x, i=1, j=1) + E_xy = 0.5 * (dde.grad.jacobian(f, x, i=0, j=1) + dde.grad.jacobian(f, x, i=1, j=0)) + + S_xx = E_xx * (2 * mu + lmbd) + E_yy * lmbd + S_yy = E_yy * (2 * mu + lmbd) + E_xx * lmbd + S_xy = E_xy * 2 * mu + + Sxx_x = dde.grad.jacobian(f, x, i=2, j=0) + Syy_y = dde.grad.jacobian(f, x, i=3, j=1) + Sxy_x = dde.grad.jacobian(f, x, i=4, j=0) + Sxy_y = dde.grad.jacobian(f, x, i=4, j=1) + + momentum_x = Sxx_x + Sxy_y - fx(x) + momentum_y = Sxy_x + Syy_y - fy(x) + + stress_x = S_xx - f[:, 2:3] + stress_y = S_yy - f[:, 3:4] + stress_xy = S_xy - f[:, 4:5] + + return [momentum_x, momentum_y, stress_x, stress_y, stress_xy] + + +data = dde.data.PDE( + geom, + pde, + [ + ux_top_bc, + ux_bottom_bc, + uy_left_bc, + uy_bottom_bc, + uy_right_bc, + sxx_left_bc, + sxx_right_bc, + syy_top_bc, + ], + num_domain=500, + num_boundary=500, + solution=func, + num_test=100, +) + +layers = [2, [40] * 5, [40] * 5, [40] * 5, [40] * 5, 5] +activation = "tanh" +initializer = "Glorot uniform" +net = dde.nn.PFNN(layers, activation, initializer) + +model = dde.Model(data, net) +model.compile("adam", lr=0.001) +losshistory, train_state = model.train(epochs=5000) + +dde.saveplot(losshistory, train_state, issave=True, isplot=True) From 199c1f69f0a8bdd4789ccded2e697cebff3ff753 Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Mon, 2 Oct 2023 21:46:11 -0400 Subject: [PATCH 02/29] Update solution function --- docs/.DS_Store | Bin 6148 -> 6148 bytes docs/demos/pinn_forward/elasticity.plate.rst | 12 ++++++++---- examples/pinn_forward/elasticity_plate_2d.py | 11 +++++++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/docs/.DS_Store b/docs/.DS_Store index 435546d8990db150bac99f7827e03da5c09877b1..ca3979d9318e7eae42d847d73f38db29fae2c221 100644 GIT binary patch delta 55 zcmZoMXfc@Jq`&|IOkk3Mfe}apu>b=@aY}J=PEvk;&c?!N>=PUKCmV>cZ06?p$qxVl CLJPbA delta 56 zcmZoMXfc@Jq{zqs1WX_T2tXVl7GPi~PAN{#Ny^X9Vcb|ajeTMR-(&+3md)H8KluR% C;0wM0 diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index fea7a780d..5ef4a9a91 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -107,15 +107,19 @@ Next, for better comparsion, we define a function which is the exact solution to def func(x): ux = np.cos(2 * np.pi * x[:, 0:1]) * np.sin(np.pi * x[:, 1:2]) uy = np.sin(pi * x[:, 0:1]) * Q * x[:, 1:2] ** 4 / 4 - E_xx = np.diff(ux) / np.diff(x[:, 0:1]) - E_yy = np.diff(uy) / np.diff(x[:, 1:2]) - E_xy = 0.5 * (np.diff(ux) / np.diff(x[:, 1:2]) + np.diff(uy) / np.diff(x[:, 0:1])) + + E_xx = -2 * np.pi * np.sin(2 * np.pi * x[:, 0:1]) * np.sin(np.pi * x[:, 1:2]) + E_yy = np.sin(pi * x[:, 0:1]) * Q * x[:, 1:2] ** 3 + E_xy = 0.5 * ( + np.pi * np.cos(2 * np.pi * x[:, 0:1]) * np.cos(np.pi * x[:, 1:2]) + + np.pi * np.cos(np.pi * x[:, 0:1]) * Q * x[:, 1:2] ** 4 / 4 + ) Sxx = E_xx * (2 * mu + lmbd) + E_yy * lmbd Syy = E_yy * (2 * mu + lmbd) + E_xx * lmbd Sxy = 2 * E_xy * mu - return np.hstack((ux, uy, Sxx, Syy, Sxy)) + return np.hstack((ux, uy, Sxx, Syy, Sxy)) The displacement boundary conditions on the boundary are defined as follows. diff --git a/examples/pinn_forward/elasticity_plate_2d.py b/examples/pinn_forward/elasticity_plate_2d.py index 57610f75c..38d9593d6 100644 --- a/examples/pinn_forward/elasticity_plate_2d.py +++ b/examples/pinn_forward/elasticity_plate_2d.py @@ -36,10 +36,13 @@ def boundary_bottom(x, on_boundary): def func(x): ux = np.cos(2 * np.pi * x[:, 0:1]) * np.sin(np.pi * x[:, 1:2]) uy = np.sin(pi * x[:, 0:1]) * Q * x[:, 1:2] ** 4 / 4 - - E_xx = np.diff(ux) / np.diff(x[:, 0:1]) - E_yy = np.diff(uy) / np.diff(x[:, 1:2]) - E_xy = 0.5 * (np.diff(ux) / np.diff(x[:, 1:2]) + np.diff(uy) / np.diff(x[:, 0:1])) + + E_xx = -2 * np.pi * np.sin(2 * np.pi * x[:, 0:1]) * np.sin(np.pi * x[:, 1:2]) + E_yy = np.sin(pi * x[:, 0:1]) * Q * x[:, 1:2] ** 3 + E_xy = 0.5 * ( + np.pi * np.cos(2 * np.pi * x[:, 0:1]) * np.cos(np.pi * x[:, 1:2]) + + np.pi * np.cos(np.pi * x[:, 0:1]) * Q * x[:, 1:2] ** 4 / 4 + ) Sxx = E_xx * (2 * mu + lmbd) + E_yy * lmbd Syy = E_yy * (2 * mu + lmbd) + E_xx * lmbd From 6e1437e0d5bd3ca7bcd54939d27359ca7ce51c48 Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Mon, 2 Oct 2023 21:48:11 -0400 Subject: [PATCH 03/29] Fix format --- docs/demos/pinn_forward/elasticity.plate.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index 5ef4a9a91..0172f3458 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -119,7 +119,7 @@ Next, for better comparsion, we define a function which is the exact solution to Syy = E_yy * (2 * mu + lmbd) + E_xx * lmbd Sxy = 2 * E_xy * mu - return np.hstack((ux, uy, Sxx, Syy, Sxy)) + return np.hstack((ux, uy, Sxx, Syy, Sxy)) The displacement boundary conditions on the boundary are defined as follows. From 10f604f0e38426e9cbd6bc2572d3d83a36b97ae2 Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Tue, 3 Oct 2023 21:44:25 -0400 Subject: [PATCH 04/29] Update docs/demos/pinn_forward/elasticity.plate.rst Co-authored-by: pescap --- docs/demos/pinn_forward/elasticity.plate.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index 0172f3458..000ba952e 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -10,7 +10,7 @@ We will solve a 2D linear elasticity solid mechanic problem: \frac{\partial \sigma_{xy}}{\partial x} + \frac{\partial \sigma_{yy}}{\partial y} + f_y= 0, \qquad \Omega = [0, 1]^2, -where the linear elastic constitutive model is defined as, +where the linear elastic constitutive model is defined as .. math:: \sigma_{xx} = (\lambda + 2\mu)\epsilon_{xx} + \lambda\epsilon_{yy}, From cd798742070f8d757a5489d21673cbd00295f824 Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Tue, 3 Oct 2023 21:44:34 -0400 Subject: [PATCH 05/29] Update docs/demos/pinn_forward/elasticity.plate.rst Co-authored-by: pescap --- docs/demos/pinn_forward/elasticity.plate.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index 000ba952e..6c3fce09b 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -18,7 +18,7 @@ where the linear elastic constitutive model is defined as \sigma_{xy} = 2\mu\epsilon_{xy}, -with kinematic relation, +with kinematic relation .. math:: \epsilon_{xx} = \frac{\partial u_{x}}{\partial x}, \qquad \epsilon_{yy} = \frac{\partial u_{y}}{\partial y}, \qquad From f5a75ce59651f2fa4a4412469ab7b3751091bbc5 Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Tue, 3 Oct 2023 21:44:44 -0400 Subject: [PATCH 06/29] Update docs/demos/pinn_forward/elasticity.plate.rst Co-authored-by: pescap --- docs/demos/pinn_forward/elasticity.plate.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index 6c3fce09b..3de6318a4 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -24,7 +24,7 @@ with kinematic relation \epsilon_{yy} = \frac{\partial u_{y}}{\partial y}, \qquad \epsilon_{xy} = \frac{1}{2}(\frac{\partial u_{x}}{\partial y} + \frac{\partial u_{y}}{\partial x}). -The 2D square domain is subjected to body forces, +The 2D square domain is subjected to body forces: .. math:: f_x = \lambda[4\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3] + \mu[9\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3], From 7e041d7a3aefa0456967015db1c42090915fdff5 Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Tue, 3 Oct 2023 21:45:07 -0400 Subject: [PATCH 07/29] Update docs/demos/pinn_forward/elasticity.plate.rst Co-authored-by: pescap --- docs/demos/pinn_forward/elasticity.plate.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index 3de6318a4..222773b5b 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -38,7 +38,7 @@ and traction boundary conditions, .. math:: \sigma_{xx}(0, y)=0, \qquad \sigma_{xx}(1, y)=0, \qquad \sigma_{xx}(x, 1)=(\lambda + 2\mu)Qsin(\pi x). -The parameters :math:`\lambda = 1,` :math:`\mu = 0.5,` and :math:`Q = 4.` +We set parameters :math:`\lambda = 1,` :math:`\mu = 0.5,` and :math:`Q = 4.` The exact solution is :math:`u_x(x, y) = cos(2\pi x)sin(\pi y)` and :math:`u_y(x, y) = sin(\pi x)Qy^4/4.` From af3383fdcf8f96b7b98a505cdb4e5c331c45b656 Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Tue, 3 Oct 2023 21:45:15 -0400 Subject: [PATCH 08/29] Update docs/demos/pinn_forward/elasticity.plate.rst Co-authored-by: pescap --- docs/demos/pinn_forward/elasticity.plate.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index 222773b5b..552f64ffb 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -30,7 +30,7 @@ The 2D square domain is subjected to body forces: f_y = \lambda[-3sin(\pi x)Qy^2 + 2\pi^2sin(2\pi x) cos(\pi y)] + \mu[-6 sin(\pi x)Qy^2 + 2 \pi^2 sin(2\pi x)cos(\pi y) + \pi^2 sin(\pi x)Qy^4/4], -with displacement boundary conditions, +with displacement boundary conditions .. math:: u_y(0, y)=0, \qquad u_y(1, y)=0, \qquad u_x(x, 0)=u_y(x, 0) = 0, From e8a580e09dea96f7d000fa5eed520de5db62230e Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Tue, 3 Oct 2023 21:45:26 -0400 Subject: [PATCH 09/29] Update docs/demos/pinn_forward/elasticity.plate.rst Co-authored-by: pescap --- docs/demos/pinn_forward/elasticity.plate.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index 552f64ffb..c52135acf 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -34,7 +34,7 @@ with displacement boundary conditions .. math:: u_y(0, y)=0, \qquad u_y(1, y)=0, \qquad u_x(x, 0)=u_y(x, 0) = 0, -and traction boundary conditions, +and traction boundary conditions .. math:: \sigma_{xx}(0, y)=0, \qquad \sigma_{xx}(1, y)=0, \qquad \sigma_{xx}(x, 1)=(\lambda + 2\mu)Qsin(\pi x). From f4799ec07ac1b515acad7a36ac144d4b129f2022 Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Tue, 3 Oct 2023 21:52:34 -0400 Subject: [PATCH 10/29] Update elasticity.plate.rst format --- docs/demos/pinn_forward.rst | 1 + docs/demos/pinn_forward/elasticity.plate.rst | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/demos/pinn_forward.rst b/docs/demos/pinn_forward.rst index 573034671..0205c5eaa 100644 --- a/docs/demos/pinn_forward.rst +++ b/docs/demos/pinn_forward.rst @@ -29,6 +29,7 @@ Time-independent PDEs pinn_forward/poisson.Lshape pinn_forward/laplace.disk pinn_forward/eulerbeam + pinn_forward/elasticity.plate pinn_forward/helmholtz.2d.dirichlet pinn_forward/helmholtz.2d.dirichlet.hpo pinn_forward/helmholtz.2d.neumann.hole diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index c52135acf..cb8209057 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -26,9 +26,13 @@ with kinematic relation The 2D square domain is subjected to body forces: -.. math:: f_x = \lambda[4\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3] + \mu[9\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3], +.. math:: f_x = \lambda[4\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3] + - f_y = \lambda[-3sin(\pi x)Qy^2 + 2\pi^2sin(2\pi x) cos(\pi y)] + \mu[-6 sin(\pi x)Qy^2 + 2 \pi^2 sin(2\pi x)cos(\pi y) + \pi^2 sin(\pi x)Qy^4/4], + \mu[9\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3], + + f_y = \lambda[-3sin(\pi x)Qy^2 + 2\pi^2sin(2\pi x) cos(\pi y)] + + + \mu[-6 sin(\pi x)Qy^2 + 2 \pi^2 sin(2\pi x)cos(\pi y) + \pi^2 sin(\pi x)Qy^4/4], with displacement boundary conditions From f17f2a6a6b2b99ecf514153e38be1a49d04c1cf2 Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Tue, 3 Oct 2023 22:07:40 -0400 Subject: [PATCH 11/29] Update elasticity.plate.rst --- docs/demos/pinn_forward/elasticity.plate.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index cb8209057..472f0fc43 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -40,7 +40,7 @@ with displacement boundary conditions and traction boundary conditions -.. math:: \sigma_{xx}(0, y)=0, \qquad \sigma_{xx}(1, y)=0, \qquad \sigma_{xx}(x, 1)=(\lambda + 2\mu)Qsin(\pi x). +.. math:: \sigma_{xx}(0, y)=0, \qquad \sigma_{xx}(1, y)=0, \qquad \sigma_{yy}(x, 1)=(\lambda + 2\mu)Qsin(\pi x). We set parameters :math:`\lambda = 1,` :math:`\mu = 0.5,` and :math:`Q = 4.` From eef30d89af4aa2ad573c0c16d40ef9baeb54fb8a Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Wed, 11 Oct 2023 16:28:17 -0400 Subject: [PATCH 12/29] Update elasticity.plate.rst --- docs/demos/pinn_forward/elasticity.plate.rst | 21 ++++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index 472f0fc43..68476d5a7 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -6,37 +6,36 @@ Problem setup We will solve a 2D linear elasticity solid mechanic problem: -.. math:: \frac{\partial \sigma_{xx}}{\partial x} + \frac{\partial \sigma_{xy}}{\partial y} + f_x= 0, +.. math:: \frac{\partial \sigma_{xx}}{\partial x} + \frac{\partial \sigma_{xy}}{\partial y} + f_x= 0, \quad +\frac{\partial \sigma_{xy}}{\partial x} + \frac{\partial \sigma_{yy}}{\partial y} + f_y= 0, - \frac{\partial \sigma_{xy}}{\partial x} + \frac{\partial \sigma_{yy}}{\partial y} + f_y= 0, \qquad \Omega = [0, 1]^2, + x \in [-1, 1], \quad y \in [0, 1], where the linear elastic constitutive model is defined as -.. math:: \sigma_{xx} = (\lambda + 2\mu)\epsilon_{xx} + \lambda\epsilon_{yy}, - - \sigma_{yy} = (\lambda + 2\mu)\epsilon_{yy} + \lambda\epsilon_{xx}, - +.. math:: \sigma_{xx} = (\lambda + 2\mu)\epsilon_{xx} + \lambda\epsilon_{yy}, \quad + \sigma_{yy} = (\lambda + 2\mu)\epsilon_{yy} + \lambda\epsilon_{xx}, \quad \sigma_{xy} = 2\mu\epsilon_{xy}, with kinematic relation -.. math:: \epsilon_{xx} = \frac{\partial u_{x}}{\partial x}, \qquad - \epsilon_{yy} = \frac{\partial u_{y}}{\partial y}, \qquad +.. math:: \epsilon_{xx} = \frac{\partial u_{x}}{\partial x}, \quad + \epsilon_{yy} = \frac{\partial u_{y}}{\partial y}, \quad \epsilon_{xy} = \frac{1}{2}(\frac{\partial u_{x}}{\partial y} + \frac{\partial u_{y}}{\partial x}). The 2D square domain is subjected to body forces: .. math:: f_x = \lambda[4\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3] + - \mu[9\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3], +\mu[9\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3], f_y = \lambda[-3sin(\pi x)Qy^2 + 2\pi^2sin(2\pi x) cos(\pi y)] + - \mu[-6 sin(\pi x)Qy^2 + 2 \pi^2 sin(2\pi x)cos(\pi y) + \pi^2 sin(\pi x)Qy^4/4], +\mu[-6 sin(\pi x)Qy^2 + 2 \pi^2 sin(2\pi x)cos(\pi y) + \pi^2 sin(\pi x)Qy^4/4], with displacement boundary conditions -.. math:: u_y(0, y)=0, \qquad u_y(1, y)=0, \qquad u_x(x, 0)=u_y(x, 0) = 0, +.. math:: u_y(0, y)=0, \quad u_y(1, y)=0, \quad u_x(x, 0)=u_y(x, 0) = 0, and traction boundary conditions From 2fa3c64d141243c823533041166b2dc08c125f30 Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Wed, 11 Oct 2023 16:40:00 -0400 Subject: [PATCH 13/29] Update elasticity.plate.rst --- docs/demos/pinn_forward/elasticity.plate.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index 68476d5a7..8fb3fb385 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -6,8 +6,8 @@ Problem setup We will solve a 2D linear elasticity solid mechanic problem: -.. math:: \frac{\partial \sigma_{xx}}{\partial x} + \frac{\partial \sigma_{xy}}{\partial y} + f_x= 0, \quad -\frac{\partial \sigma_{xy}}{\partial x} + \frac{\partial \sigma_{yy}}{\partial y} + f_y= 0, +.. math:: \frac{\partial \sigma_{xx}}{\partial x} + \frac{\partial \sigma_{xy}}{\partial y} + f_x= 0, \quad + \frac{\partial \sigma_{xy}}{\partial x} + \frac{\partial \sigma_{yy}}{\partial y} + f_y= 0, x \in [-1, 1], \quad y \in [0, 1], @@ -27,11 +27,11 @@ The 2D square domain is subjected to body forces: .. math:: f_x = \lambda[4\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3] + -\mu[9\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3], + \mu[9\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3], f_y = \lambda[-3sin(\pi x)Qy^2 + 2\pi^2sin(2\pi x) cos(\pi y)] + -\mu[-6 sin(\pi x)Qy^2 + 2 \pi^2 sin(2\pi x)cos(\pi y) + \pi^2 sin(\pi x)Qy^4/4], + \mu[-6 sin(\pi x)Qy^2 + 2 \pi^2 sin(2\pi x)cos(\pi y) + \pi^2 sin(\pi x)Qy^4/4], with displacement boundary conditions @@ -39,7 +39,7 @@ with displacement boundary conditions and traction boundary conditions -.. math:: \sigma_{xx}(0, y)=0, \qquad \sigma_{xx}(1, y)=0, \qquad \sigma_{yy}(x, 1)=(\lambda + 2\mu)Qsin(\pi x). +.. math:: \sigma_{xx}(0, y)=0, \quad \sigma_{xx}(1, y)=0, \quad \sigma_{yy}(x, 1)=(\lambda + 2\mu)Qsin(\pi x). We set parameters :math:`\lambda = 1,` :math:`\mu = 0.5,` and :math:`Q = 4.` From 0628fee70799ecd88fe231ccf6b0710bddf97777 Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Wed, 11 Oct 2023 16:56:38 -0400 Subject: [PATCH 14/29] Update elasticity.plate.rst Center equations --- docs/demos/pinn_forward/elasticity.plate.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index 8fb3fb385..0cadbde14 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -9,7 +9,7 @@ We will solve a 2D linear elasticity solid mechanic problem: .. math:: \frac{\partial \sigma_{xx}}{\partial x} + \frac{\partial \sigma_{xy}}{\partial y} + f_x= 0, \quad \frac{\partial \sigma_{xy}}{\partial x} + \frac{\partial \sigma_{yy}}{\partial y} + f_y= 0, - x \in [-1, 1], \quad y \in [0, 1], +.. math:: x \in [-1, 1], \quad y \in [0, 1], where the linear elastic constitutive model is defined as @@ -27,11 +27,11 @@ The 2D square domain is subjected to body forces: .. math:: f_x = \lambda[4\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3] + - \mu[9\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3], +.. math:: \mu[9\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3], - f_y = \lambda[-3sin(\pi x)Qy^2 + 2\pi^2sin(2\pi x) cos(\pi y)] + +.. math:: f_y = \lambda[-3sin(\pi x)Qy^2 + 2\pi^2sin(2\pi x) cos(\pi y)] + - \mu[-6 sin(\pi x)Qy^2 + 2 \pi^2 sin(2\pi x)cos(\pi y) + \pi^2 sin(\pi x)Qy^4/4], +.. math:: \mu[-6 sin(\pi x)Qy^2 + 2 \pi^2 sin(2\pi x)cos(\pi y) + \pi^2 sin(\pi x)Qy^4/4], with displacement boundary conditions From dd426b1bbd5c2a4b24bb009cef4fe309fcb13c1a Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Wed, 11 Oct 2023 17:04:31 -0400 Subject: [PATCH 15/29] Update elasticity.plate.rst --- docs/demos/pinn_forward/elasticity.plate.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index 0cadbde14..9ec56478f 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -9,7 +9,7 @@ We will solve a 2D linear elasticity solid mechanic problem: .. math:: \frac{\partial \sigma_{xx}}{\partial x} + \frac{\partial \sigma_{xy}}{\partial y} + f_x= 0, \quad \frac{\partial \sigma_{xy}}{\partial x} + \frac{\partial \sigma_{yy}}{\partial y} + f_y= 0, -.. math:: x \in [-1, 1], \quad y \in [0, 1], +.. math:: x \in [0, 1], \quad y \in [0, 1], where the linear elastic constitutive model is defined as From 80d9119910cc31badda3c7b4d0d669bde122c7d4 Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Wed, 11 Oct 2023 17:11:10 -0400 Subject: [PATCH 16/29] Update elasticity.plate.rst Edit displacement boundary conditions --- docs/demos/pinn_forward/elasticity.plate.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index 9ec56478f..340d1cbe8 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -35,7 +35,8 @@ The 2D square domain is subjected to body forces: with displacement boundary conditions -.. math:: u_y(0, y)=0, \quad u_y(1, y)=0, \quad u_x(x, 0)=u_y(x, 0) = 0, +.. math:: u_x(x, 0) = u_x(x, 1) = 0, +.. math:: u_y(0, y) = u_y(1, y) = u_y(x, 0) = 0, and traction boundary conditions From 9b9613d984e0deb9ef26dee6451ae146a45557ea Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Thu, 12 Oct 2023 17:58:52 -0400 Subject: [PATCH 17/29] Delete .DS_Store --- docs/.DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 docs/.DS_Store diff --git a/docs/.DS_Store b/docs/.DS_Store deleted file mode 100644 index ca3979d9318e7eae42d847d73f38db29fae2c221..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~JqiLr422VaK(Mj2oW=uqgF*BJUO;s1lr6-5j_%73f~&QNyg>41GKsQZv9l2o z-Q2si$U;PBa8p@X7?@%|l}^rbm0oV$?Q}Wz{l%+BS!*?L{Ko5f9#cqw1W14cNPq-> zh=ASOu-QD6kpxJ91fB%!{ZQbhHMNEMs{_GD0O$m1H>`b@fEG(YYibKc2By&pjaKzB z#PZ$_Em>DnTWGY4=J28U&uUW)Oru@2U<1?Y!axEfFd#6F{lf159sJY$KWO2W1W4e| z2 Date: Fri, 13 Oct 2023 19:28:26 -0400 Subject: [PATCH 18/29] Update elasticity_plate_2d.py --- examples/pinn_forward/elasticity_plate_2d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/pinn_forward/elasticity_plate_2d.py b/examples/pinn_forward/elasticity_plate_2d.py index 38d9593d6..9985ddf2c 100644 --- a/examples/pinn_forward/elasticity_plate_2d.py +++ b/examples/pinn_forward/elasticity_plate_2d.py @@ -1,6 +1,6 @@ """Backend supported: tensorflow.compat.v1, paddle -Implementation of the linear elasticity 2D example in paper https://www.sciencedirect.com/science/article/pii/S0045782521000773?casa_token=cqzZTCdxm9kAAAAA:FWwk9lkEaLJMUCq_m_ZY0J2YhZp-uA9_UdxS8DmUqTF-dz1BObM25uUGJKRbtkG-q1O-OAdhpQ. +Implementation of the linear elasticity 2D example in paper https://doi.org/10.1016/j.cma.2021.113741. References: https://github.com/sciann/sciann-applications/blob/master/SciANN-Elasticity/Elasticity-Forward.ipynb. """ From 0180dd10132ad29b673f3f5d481d1b25eefc7e2b Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Fri, 13 Oct 2023 21:38:38 -0400 Subject: [PATCH 19/29] Update elasticity_plate_2d.py --- examples/pinn_forward/elasticity_plate_2d.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/pinn_forward/elasticity_plate_2d.py b/examples/pinn_forward/elasticity_plate_2d.py index 9985ddf2c..1b6732f7c 100644 --- a/examples/pinn_forward/elasticity_plate_2d.py +++ b/examples/pinn_forward/elasticity_plate_2d.py @@ -1,12 +1,12 @@ """Backend supported: tensorflow.compat.v1, paddle -Implementation of the linear elasticity 2D example in paper https://doi.org/10.1016/j.cma.2021.113741. +Implementation of the linear elasticity 2D example in paper https://doi.org/10.1016/j.cma.2021.113741. References: https://github.com/sciann/sciann-applications/blob/master/SciANN-Elasticity/Elasticity-Forward.ipynb. """ import deepxde as dde import numpy as np -from deepxde.backend import torch +import torch lmbd = 1.0 mu = 0.5 From c8e91f0a61ca9e5acd11d057c32ad46d10f0b649 Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Sat, 14 Oct 2023 17:39:00 -0400 Subject: [PATCH 20/29] Update elasticity_plate_2d.py --- examples/pinn_forward/elasticity_plate_2d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/pinn_forward/elasticity_plate_2d.py b/examples/pinn_forward/elasticity_plate_2d.py index 1b6732f7c..c7ec970bb 100644 --- a/examples/pinn_forward/elasticity_plate_2d.py +++ b/examples/pinn_forward/elasticity_plate_2d.py @@ -1,4 +1,4 @@ -"""Backend supported: tensorflow.compat.v1, paddle +"""Backend supported: pytorch Implementation of the linear elasticity 2D example in paper https://doi.org/10.1016/j.cma.2021.113741. References: From 8ea354a723a2649134b1c1836314cbe4f8efdea5 Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Sat, 14 Oct 2023 20:06:38 -0400 Subject: [PATCH 21/29] Update docs/demos/pinn_forward/elasticity.plate.rst Co-authored-by: pescap --- docs/demos/pinn_forward/elasticity.plate.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index 340d1cbe8..906926b6a 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -148,7 +148,7 @@ Similarly, the traction boundary conditions are defined as, component=3, ) -Next, we define the body forces, +Next, we define the body forces .. code-block:: python From 5d18bb97e1398941bd26113cb2de6da99da30973 Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Sat, 14 Oct 2023 20:06:50 -0400 Subject: [PATCH 22/29] Update docs/demos/pinn_forward/elasticity.plate.rst Co-authored-by: pescap --- docs/demos/pinn_forward/elasticity.plate.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index 906926b6a..b8ea636c6 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -27,7 +27,7 @@ The 2D square domain is subjected to body forces: .. math:: f_x = \lambda[4\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3] + -.. math:: \mu[9\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3], +.. math:: +\mu[9\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3], .. math:: f_y = \lambda[-3sin(\pi x)Qy^2 + 2\pi^2sin(2\pi x) cos(\pi y)] + From cb7f0eb4a0deb9a4365f9866621e4758bdb474db Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Sat, 14 Oct 2023 20:11:57 -0400 Subject: [PATCH 23/29] Update elasticity.plate.rst --- docs/demos/pinn_forward/elasticity.plate.rst | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index b8ea636c6..dae61a5e3 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -25,13 +25,15 @@ with kinematic relation The 2D square domain is subjected to body forces: -.. math:: f_x = \lambda[4\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3] + +.. math:: -.. math:: +\mu[9\pi^2cos(2\pi x)sin(\pi y) - \pi cos(\pi x)Qy^3], + f_x = & \lambda[4\pi^2\cos(2\pi x)\sin(\pi y) - \pi \cos(\pi x)Qy^3] \\\\ -.. math:: f_y = \lambda[-3sin(\pi x)Qy^2 + 2\pi^2sin(2\pi x) cos(\pi y)] + + & +\mu[9\pi^2\cos(2\pi x)sin(\pi y) - \pi \cos(\pi x)Qy^3], + + f_y = & \lambda[-3\sin(\pi x)Qy^2 + 2\pi^2\sin(2\pi x) \cos(\pi y)] \\\\ -.. math:: \mu[-6 sin(\pi x)Qy^2 + 2 \pi^2 sin(2\pi x)cos(\pi y) + \pi^2 sin(\pi x)Qy^4/4], + & +\mu[-6 \sin(\pi x)Qy^2 + 2 \pi^2 \sin(2\pi x)\cos(\pi y) + \pi^2 \sin(\pi x)Qy^4/4], with displacement boundary conditions @@ -44,7 +46,7 @@ and traction boundary conditions We set parameters :math:`\lambda = 1,` :math:`\mu = 0.5,` and :math:`Q = 4.` -The exact solution is :math:`u_x(x, y) = cos(2\pi x)sin(\pi y)` and :math:`u_y(x, y) = sin(\pi x)Qy^4/4.` +The exact solution is :math:`u_x(x, y) = \cos(2\pi x)\sin(\pi y)` and :math:`u_y(x, y) = \sin(\pi x)Qy^4/4.` Implementation -------------- From 1a075b4f8840c88179d73bda835e41bcc2e2cb02 Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Sat, 14 Oct 2023 20:20:54 -0400 Subject: [PATCH 24/29] Update elasticity.plate.rst --- docs/demos/pinn_forward/elasticity.plate.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index dae61a5e3..1cb93431f 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -26,14 +26,14 @@ with kinematic relation The 2D square domain is subjected to body forces: .. math:: + :nowrap: + \\begin{eqnarray} f_x = & \lambda[4\pi^2\cos(2\pi x)\sin(\pi y) - \pi \cos(\pi x)Qy^3] \\\\ - - & +\mu[9\pi^2\cos(2\pi x)sin(\pi y) - \pi \cos(\pi x)Qy^3], - + + & \mu[9\pi^2\cos(2\pi x)sin(\pi y) - \pi \cos(\pi x)Qy^3], \\\\ f_y = & \lambda[-3\sin(\pi x)Qy^2 + 2\pi^2\sin(2\pi x) \cos(\pi y)] \\\\ - - & +\mu[-6 \sin(\pi x)Qy^2 + 2 \pi^2 \sin(2\pi x)\cos(\pi y) + \pi^2 \sin(\pi x)Qy^4/4], + + & \mu[-6 \sin(\pi x)Qy^2 + 2 \pi^2 \sin(2\pi x)\cos(\pi y) + \pi^2 \sin(\pi x)Qy^4/4], + \\end{eqnarray} with displacement boundary conditions @@ -42,7 +42,7 @@ with displacement boundary conditions and traction boundary conditions -.. math:: \sigma_{xx}(0, y)=0, \quad \sigma_{xx}(1, y)=0, \quad \sigma_{yy}(x, 1)=(\lambda + 2\mu)Qsin(\pi x). +.. math:: \sigma_{xx}(0, y)=0, \quad \sigma_{xx}(1, y)=0, \quad \sigma_{yy}(x, 1)=(\lambda + 2\mu)Q\sin(\pi x). We set parameters :math:`\lambda = 1,` :math:`\mu = 0.5,` and :math:`Q = 4.` @@ -240,7 +240,7 @@ Now, we have specified the geometry, PDE residuals, and boundary conditions. We The number 500 is the number of training residual points sampled inside the domain, and the number 500 is the number of training points sampled on the boundary. The argument ``solution=func`` is the reference solution to compute the error of our solution, and can be ignored if we don't have a reference solution. We use 100 residual points for testing the PDE residual. -Next, we choose the network. Here, we use 5 fully connected independent neural network of depth 5 (i.e., 4 hidden layers) and width 40: +Next, we choose the network. Here, we use 5 fully connected independent neural networks of depth 5 (i.e., 4 hidden layers) and width 40: .. code-block:: python From 0a1c89d3db88e9cec98fdfb4e0c1a79d6e0709c4 Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Sat, 14 Oct 2023 20:31:12 -0400 Subject: [PATCH 25/29] Update elasticity.plate.rst --- docs/demos/pinn_forward/elasticity.plate.rst | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index 1cb93431f..acb52108c 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -25,15 +25,10 @@ with kinematic relation The 2D square domain is subjected to body forces: -.. math:: - :nowrap: - - \\begin{eqnarray} - f_x = & \lambda[4\pi^2\cos(2\pi x)\sin(\pi y) - \pi \cos(\pi x)Qy^3] \\\\ - + & \mu[9\pi^2\cos(2\pi x)sin(\pi y) - \pi \cos(\pi x)Qy^3], \\\\ - f_y = & \lambda[-3\sin(\pi x)Qy^2 + 2\pi^2\sin(2\pi x) \cos(\pi y)] \\\\ - + & \mu[-6 \sin(\pi x)Qy^2 + 2 \pi^2 \sin(2\pi x)\cos(\pi y) + \pi^2 \sin(\pi x)Qy^4/4], - \\end{eqnarray} +.. math:: f_x = \lambda[4\pi^2\cos(2\pi x)\sin(\pi y) - \pi \cos(\pi x)Qy^3] +.. math:: + \mu[9\pi^2\cos(2\pi x)sin(\pi y) - \pi \cos(\pi x)Qy^3], +.. math:: f_y = \lambda[-3\sin(\pi x)Qy^2 + 2\pi^2\sin(2\pi x) \cos(\pi y)] +.. math:: + \mu[-6 \sin(\pi x)Qy^2 + 2 \pi^2 \sin(2\pi x)\cos(\pi y) + \pi^2 \sin(\pi x)Qy^4/4], with displacement boundary conditions From 8829737b7937d6e913616a297add2ff2971ed7ea Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Sat, 14 Oct 2023 20:37:05 -0400 Subject: [PATCH 26/29] Update elasticity.plate.rst --- docs/demos/pinn_forward/elasticity.plate.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index acb52108c..3d3330ec5 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -25,10 +25,12 @@ with kinematic relation The 2D square domain is subjected to body forces: -.. math:: f_x = \lambda[4\pi^2\cos(2\pi x)\sin(\pi y) - \pi \cos(\pi x)Qy^3] -.. math:: + \mu[9\pi^2\cos(2\pi x)sin(\pi y) - \pi \cos(\pi x)Qy^3], -.. math:: f_y = \lambda[-3\sin(\pi x)Qy^2 + 2\pi^2\sin(2\pi x) \cos(\pi y)] -.. math:: + \mu[-6 \sin(\pi x)Qy^2 + 2 \pi^2 \sin(2\pi x)\cos(\pi y) + \pi^2 \sin(\pi x)Qy^4/4], +.. math:: + + f_x & = \lambda[4\pi^2\cos(2\pi x)\sin(\pi y) - \pi \cos(\pi x)Qy^3] \\ + & + \mu[9\pi^2\cos(2\pi x)sin(\pi y) - \pi \cos(\pi x)Qy^3], \\ + f_y & = \lambda[-3\sin(\pi x)Qy^2 + 2\pi^2\sin(2\pi x) \cos(\pi y)] \\ + & + \mu[-6 \sin(\pi x)Qy^2 + 2 \pi^2 \sin(2\pi x)\cos(\pi y) + \pi^2 \sin(\pi x)Qy^4/4], with displacement boundary conditions From 6059f675554da78781aa2c162bdd8c375b085196 Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Sat, 14 Oct 2023 20:40:26 -0400 Subject: [PATCH 27/29] Update elasticity.plate.rst --- docs/demos/pinn_forward/elasticity.plate.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index 3d3330ec5..824ddc409 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -27,10 +27,10 @@ The 2D square domain is subjected to body forces: .. math:: - f_x & = \lambda[4\pi^2\cos(2\pi x)\sin(\pi y) - \pi \cos(\pi x)Qy^3] \\ - & + \mu[9\pi^2\cos(2\pi x)sin(\pi y) - \pi \cos(\pi x)Qy^3], \\ - f_y & = \lambda[-3\sin(\pi x)Qy^2 + 2\pi^2\sin(2\pi x) \cos(\pi y)] \\ - & + \mu[-6 \sin(\pi x)Qy^2 + 2 \pi^2 \sin(2\pi x)\cos(\pi y) + \pi^2 \sin(\pi x)Qy^4/4], + f_x & = \lambda[4\pi^2\cos(2\pi x)\sin(\pi y) - \pi\cos(\pi x)Qy^3] \\ + & + \mu[9\pi^2\cos(2\pi x)\sin(\pi y) - \pi\cos(\pi x)Qy^3], \\ + f_y & = \lambda[-3\sin(\pi x)Qy^2 + 2\pi^2\sin(2\pi x)\cos(\pi y)] \\ + & + \mu[-6 \sin(\pi x)Qy^2 + 2 \pi^2\sin(2\pi x)\cos(\pi y) + \pi^2\sin(\pi x)Qy^4/4], with displacement boundary conditions From 1aaf56bd3ac79094e0145c48e36eaccdce2c8e52 Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Sun, 15 Oct 2023 20:44:28 -0400 Subject: [PATCH 28/29] Update filename --- docs/demos/pinn_forward/elasticity.plate.rst | 2 +- .../{elasticity_plate_2d.py => elasticity_plate.py} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename examples/pinn_forward/{elasticity_plate_2d.py => elasticity_plate.py} (100%) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index 824ddc409..1ec2e7ff1 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -262,5 +262,5 @@ We then train the model for 5000 iterations: Complete code -------------- -.. literalinclude:: ../../../examples/pinn_forward/elasticity_plate_2d.py +.. literalinclude:: ../../../examples/pinn_forward/elasticity_plate.py :language: python diff --git a/examples/pinn_forward/elasticity_plate_2d.py b/examples/pinn_forward/elasticity_plate.py similarity index 100% rename from examples/pinn_forward/elasticity_plate_2d.py rename to examples/pinn_forward/elasticity_plate.py From 8471ed224623cfc1704bd7745c1874b85987c83d Mon Sep 17 00:00:00 2001 From: Wensi Wu Date: Mon, 16 Oct 2023 09:03:12 -0400 Subject: [PATCH 29/29] Update elasticity.plate.rst --- docs/demos/pinn_forward/elasticity.plate.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/demos/pinn_forward/elasticity.plate.rst b/docs/demos/pinn_forward/elasticity.plate.rst index 1ec2e7ff1..25af229e3 100644 --- a/docs/demos/pinn_forward/elasticity.plate.rst +++ b/docs/demos/pinn_forward/elasticity.plate.rst @@ -56,7 +56,7 @@ First, the DeepXDE, NumPy (``np``) and PyTorch (``torch``) modules are imported: import deepxde as dde import numpy as np - from deepxde.backend import torch + import torch We begin by defining the general parameters for the problem.