当前位置: 首页 > news >正文

PINN求解固体力学问题——论文加代码

PINN求解固体力学问题——论文加代码

  • 1. 训练
  • 2. 可视化

论文:Physics-Informed Deep Learning and its Application in Computational Solid and Fluid Mechanics

基本问题:

在这里插入图片描述

网格:
在这里插入图片描述

1. 训练

# %load Plane_Stress_W-PINNs.py
"""
Forward Problem for Plane Stress Linear Elasticity Boundary Value Problem
Weighted-Physics-Informed Neural Networks (W-PINNs)
Author: Alexandros D.L Papados

In this code we solve for the deformation of a material with Young's Modulus
of E = 1.0 GPA and Poisson Ratio of nu = 0.3. The deformation are represented
by u and v in the x and y directions respectively. We solve the following PDE using
W-PINNs:

                    G[u_xx + u_yy] + G((1+nu)/(1-nu))[u_xx + v_yx] = sin(2pi*x)sin(2pi*y)
                    G[v_xx + v_yy] + G((1+nu)/(1-nu))[v_yy + u_xy] = sin(pi*x)+ sin(2pi*y)

with Dirichlet boundary conditions.

The Neural Network is constructed as follows:
                                                         ( sigma(x,y,theta) )
                                                                                                       (  u(x,y)  )
                       ( x )                             ( sigma(x,y,theta) )                          (          )
             Input:            ----> Activation Layers:          .               ----> Output Layer:   (          )
                       ( y )                                     .                                     (          )
                                                                 .                                     (  v(x,y)  )
                                                         ( sigma(x,y,theta) )

The final output will be [x,y,u,v,e_x,e_y], where e_x and e_y are the strains in the x and y directions
respectively.

Default example is Domain I (Square Domain, [0,1]^2)
"""
import torch
import torch.nn as nn
import numpy as np
import time
import scipy.io

torch.manual_seed(123456)
np.random.seed(123456)

E = 1                                       # Young's Modulus
nu = 0.3                                    # Poisson Ratio
G = ((E/(2*(1+nu))))                        # LEBVP coefficient

class Model(nn.Module):
    def __init__(self):
        super(Model, self).__init__()
        self.net = nn.Sequential()                                                  # Define neural network
        self.net.add_module('Linear_layer_1', nn.Linear(2, 30))                     # First linear layer
        self.net.add_module('Tanh_layer_1', nn.Tanh())                              # First activation Layer
        for num in range(2, 7):                                                     # Number of layers (2 through 7)
            self.net.add_module('Linear_layer_%d' % (num), nn.Linear(30, 30))       # Linear layer
            self.net.add_module('Tanh_layer_%d' % (num), nn.Tanh())                 # Activation Layer
        self.net.add_module('Linear_layer_final', nn.Linear(30, 3))                 # Output Layer

    # Forward Feed
    def forward(self, x):
        return self.net(x)

    # Loss of PDE and BCs
    def loss(self, x, x_b, b_u,b_v,epoch):
        y = self.net(x)                             # Interior Solution
        y_b= (self.net(x_b))                        # Boundary Solution
        u_b, v_b = y_b[:, 0], y_b[:, 1]             # u and v boundary
        u,v = y[:,

相关文章:

  • php 对接mqtt 完整版本,订阅消息,发送消息
  • vue实现根据点击或滑动展示对应高亮
  • 【Rust中级教程】2.10. API设计原则之受约束性(constrained) Pt.1:对类型进行修改、`#[non_exhaustive]`注解
  • QT中的事件
  • 基于Java+SpringBoot+Vue的前后端分离的租房网站
  • Shell基础
  • 2011-2019年各省人口数数据
  • vue3动态引入图片
  • 前端依赖nrm镜像管理工具
  • 软考程序员考试内容和备考策略
  • 补充:文件上传、下载传输给前端之直接传递图片二进制数据:网络中的图片、音频、视频等非字符数据的传输
  • 港科大提出开放全曲音乐生成基础模型YuE:可将歌词转换成完整歌曲
  • 每日Attention学习24——Strip Convolution Block
  • 嵌入式开发工程师笔试面试指南-Linux系统移植
  • 计算机组成与接口10
  • 深入探索C语言中的sscanf和sprintf函数
  • 【C++笔记】C++11智能指针的使用及其原理
  • 2025年SCI1区TOP:真菌生长优化算法FGO,深度解析+性能实测
  • java23种设计模式-观察者模式
  • Spring MVC框架六:Ajax技术
  • 一般学校网站的后台用什么做/百度小说风云榜首页
  • 东莞网站建站公司/怎么在百度发布个人简介
  • 重庆论坛网站建设/关键词搜索指数查询工具
  • 芜湖市网站建设/有站点网络营销平台
  • 区块链网站建设/分销渠道
  • 企业网站建设工作总结/免费网站安全检测