基于matlab实现的平面波展开法二维声子晶体能带计算程序

Matlab 平面波展开法计算二维声子晶体二维声子晶体带结构计算,材料是铅柱在橡胶基体中周期排列,格子为正方形。采用PWE方法计算

完整程序:

%%%%%%%%%%%%%%%%%%%%%%%%%
clear;clc;tic;epssys=1.0e-6; %设定一个最小量,避免系统截断误差或除零错误
 
%%%%%%%%%%%%%%%%%%%%%%%%%%

%定义实际的正空间格子基矢
%%%%%%%%%%%%%%%%%%%%%%%%%%
a=0.02;
a1=a*[1 0];
a2=a*[0 1];
%%%%%%%%%%%%%%%%%%%%%%%%%%

%定义晶格的参数
%%%%%%%%%%%%%%%%%%%%%%%%%%
rho1=11600;E1=4.08e10;mju1=1.49e10;lambda1=mju1*(E1-2*mju1)/(3*mju1-E1); %散射体的材料参数
rho2=1300;E2=1.175e5;mju2=4e4;lambda2=mju2*(E2-2*mju2)/(3*mju2-E2); %基体的材料参数
Rc=0.006; %散射体截面半径
Ac=pi*(Rc)^2; %散射体截面面积
Au=a^2; %二维格子原胞面积
Pf=Ac/Au; %填充率
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%生成倒格基矢
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
b1=2*pi/a*[1 0];
b2=2*pi/a*[0 1];
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%选定参与运算的倒空间格矢量,即参与运算的平面波数量
%设定一个l,m的取值范围,变化l,m即可得出参与运算的平面波集合
NrSquare=10; %选定倒空间的尺度,即l,m(倒格矢G=l*b1+m*b2)的取值范围。
             %NrSquare确定后,使用Bloch波数目可能为(2*NrSquare+1)^2
G=zeros((2*NrSquare+1)^2,2); %初始化可能使用的倒格矢矩阵
i=1;
for l=-NrSquare:NrSquare
    for m=-NrSquare:NrSquare
        G(i,:)=l*b1+m*b2;
        i=i+1;
    end;
end;
NG=i-1; %实际使用的Bloch波数目
G=G(1:NG,:); 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%生成k空间的rho(Gi-Gj),mju(Gi-Gj),lambda(Gi-Gj)值,i,j从1到NG。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
rho=zeros(NG,NG);mju=zeros(NG,NG);lambda=zeros(NG,NG);
for i=1:NG
    for j=1:NG
        Gij=norm(G(j,:)-G(i,:));
        if (Gij<epssys)
            rho(i,j)=rho1*Pf+rho2*(1-Pf);
            mju(i,j)=mju1*Pf+mju2*(1-Pf);
            lambda(i,j)=lambda1*Pf+lambda2*(1-Pf);
        else
            rho(i,j)=(rho1-rho2)*2*Pf*besselj(1,Gij*Rc)/(Gij*Rc);
            mju(i,j)=(mju1-mju2)*2*Pf*besselj(1,Gij*Rc)/(Gij*Rc);
            lambda(i,j)=(lambda1-lambda2)*2*Pf*besselj(1,Gij*Rc)/(Gij*Rc);
        end;
    end;
end;
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%定义简约布里渊区的各高对称点
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
T=(2*pi/a)*[epssys 0];
M=(2*pi/a)*[1/2 1/2];
X=(2*pi/a)*[1/2 0];
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%对于简约布里渊区边界上的每个k,求解其特征频率
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
THETA_A=zeros(NG,NG); %待解的本征方程A矩阵
THETA_B=zeros(NG,NG); %待解的本征方程B矩阵
Nkpoints=10; %每个方向上取的点数
stepsize=0:1/(Nkpoints-1):1; %每个方向上步长
TX_eig=zeros(Nkpoints,NG); %沿TX方向的波的待解的特征频率矩阵
XM_eig=zeros(Nkpoints,NG); %沿XM方向的波的待解的特征频率矩阵
MT_eig=zeros(Nkpoints,NG); %沿MT方向的波的待解的特征频率矩阵
for n=1:Nkpoints
    fprintf(['\n k-point:',int2str(n),'of',int2str(Nkpoints),'.\n']);
     
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %对于TX(正方格子)方向上的每个k值,求解其特征频率
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    TX_step=stepsize(n)*(X-T)+T;
     
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %n 求本征矩阵的元素
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    for i=1:NG
        for j=1:NG
            kGi=TX_step+G(i,:);
            kGj=TX_step+G(j,:);
            THETA_A(i,j)=mju(i,j)*dot(kGi,kGj);
            THETA_B(i,j)=rho(i,j); 
        end;
    end;
     
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %求解TX(正方格子)方向上的k矩阵的特征频率
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    TX_eig(n,:)=sort(sqrt(eig(THETA_A,THETA_B))).';
    
    
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %对于XM(正方格子)方向上的每个k值,求解其特征频率
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    XM_step=stepsize(n)*(M-X)+X;
     
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %n 求本征矩阵的元素
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    for i=1:NG
        for j=1:NG
            kGi=XM_step+G(i,:);
            kGj=XM_step+G(j,:);
            THETA_A(i,j)=mju(i,j)*dot(kGi,kGj);
            THETA_B(i,j)=rho(i,j); 
        end;
    end;
     
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %求解XM(正方格子)方向上的k矩阵的特征频率
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    XM_eig(n,:)=sort(sqrt(eig(THETA_A,THETA_B))).';
    
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %对于MT(正方格子)方向上的每个k值,求解其特征频率
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    MT_step=stepsize(n)*(T-M)+M;
     
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %n 求本征矩阵的元素
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    for i=1:NG
        for j=1:NG
            kGi=MT_step+G(i,:);
            kGj=MT_step+G(j,:);
            THETA_A(i,j)=mju(i,j)*dot(kGi,kGj);      
            THETA_B(i,j)=rho(i,j); 
        end;
    end;
     
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %求解MT(正方格子)方向上的k矩阵的特征频率
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    MT_eig(n,:)=sort(sqrt(eig(THETA_A,THETA_B))).';  
end;
fprintf('\n Calculation Time:%d sec',toc);
save pbs2D
     
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%绘制声子晶体能带结构图
%首先将特定方向(正方格子:TX,XM,MT)离散化
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
kaxis=0;
TXaxis=kaxis:norm(T-X)/(Nkpoints-1):(kaxis+norm(T-X));
kaxis=kaxis+norm(T-X);
XMaxis=kaxis:norm(M-X)/(Nkpoints-1):(kaxis+norm(X-M));
kaxis=kaxis+norm(X-M);
MTaxis=kaxis:norm(T-M)/(Nkpoints-1):(kaxis+norm(T-M));
kaxis=kaxis+norm(T-M);
 
Ntraject=3; %所需绘制的特定方向的数目
EigFreq=zeros(Ntraject*Nkpoints,1);
figure(1)
hold on;
Nk=Nkpoints;
 
 
for k=1:NG 
    for i=1:Nkpoints 
        EigFreq(i+0*Nk)=TX_eig(i,k)/(2*pi); 
        EigFreq(i+1*Nk)=XM_eig(i,k)/(2*pi); 
        EigFreq(i+2*Nk)=MT_eig(i,k)/(2*pi); 
    end; 
    plot(TXaxis(1:Nk),EigFreq(1+0*Nk:1*Nk),'b',... 
         XMaxis(1:Nk),EigFreq(1+1*Nk:2*Nk),'b',... 
         MTaxis(1:Nk),EigFreq(1+2*Nk:3*Nk),'b'); 
end;
grid on;
hold off;
titlestr='传统平面波展开法计算得到的二维声子晶体能带结构图';
title(titlestr);
xlabel('波矢k');
ylabel('频率f/Hz');
 
axis([0 MTaxis(Nkpoints) 0 800]);
set(gca,'XTick',[TXaxis(1) TXaxis(Nkpoints) XMaxis(Nkpoints) MTaxis(Nkpoints)]);
xtixlabel=char('T','X','M','T');
set(gca,'XTickLabel',xtixlabel);
 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/109908.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

哨兵1号(Sentinel-1)SAR卫星介绍

1. 哥白尼计划 说起欧空局的哨兵1号&#xff0c;就不得不先说一下欧空局的“哥白尼计划”。 欧空局的哥白尼计划&#xff08;Copernicus Programme&#xff09;是欧空局与欧盟合作的一项极其重要的地球观测计划。该计划旨在提供免费开放的、可持续的地球观测数据&#xff0c…

算法训练营day48|动态规划 part09:打家劫舍(LeetCode 198.打家劫舍、213.打家劫舍II、337.打家劫舍 III)

文章目录 198.打家劫舍思路分析代码实现思考总结 213.打家劫舍II思路分析代码实现 337.打家劫舍 III (树形DP)思路分析代码实现思考总结 198.打家劫舍 题目链接&#x1f525;&#x1f525; 你是一个专业的小偷&#xff0c;计划偷窃沿街的房屋。每间房内都藏有一定的现金&#…

[面试] 15道最典型的k8s面试题

文章目录 在 Kubernetes 中&#xff0c;有以下常见的资源对象&#xff1a;1.什么是 Kubernetes&#xff1f;它的主要特点是什么&#xff1f;2. Kubernetes 中的 Pod 是什么&#xff1f;它的作用是什么&#xff1f;3.Kubernetes 中的 Deployment 和 StatefulSet 有何区别&#x…

大数据技术之Hive:先导篇(一)

目录 一、什么是Hive 二、思考如何设计出Hive功能 2.1 提问 2.2 案例分析 2.3 小结 三、掌握Hive的基础架构 3.1 Hive组件 - 元数据存储 3.2 Hive组件 - Driver驱动程序 3.3 Hive组件 - 用户接口 一、什么是Hive 什么是分布式SQL计算 我们知道&#xff0c;在进行数据统…

C# 辗转相除法求最大公约数

辗转相除法求最大公约数 public static void CalcGCD(int largeNumber, int smallNumber, out int GCD){GCD 1;int remain -1;while (remain ! 0){remain largeNumber % smallNumber;GCD smallNumber;largeNumber smallNumber;smallNumber remain;}}

Python爬虫基础(四):使用更方便的requests库

文章目录 系列文章索引一、requests库的使用1、官方文档2、安装requests库3、简单使用4、使用get请求5、使用post请求6、使用代理 二、实战1、实战&#xff1a;实现古诗文网的登录&#xff08;1&#xff09;找到登录页面&#xff08;2&#xff09;登录操作需要的数据&#xff0…

MongoDB的搭建 和crud操作

MongoDB docker 下载 docker run --restartalways -d --name mongo -v /docker/mongodb/data:/data/db -p 27017:27017 mongo:4.0.6使用navcat工具使用MongoDB Crud操作 jar包 <dependency><groupId>org.projectlombok</groupId><artifactId>lom…

Web安全与攻防

Web安全概述 在Internet大众化及Web技术飞速演变的今天&#xff0c;在线安全所面临的挑战日益严峻。伴随着在线信息和服务的可用性的提升&#xff0c;以及基于Web的攻击和破坏的增长&#xff0c;安全风险达到了前所未有的高度。Web安全可以从以下三个方面进行考虑&#xff1a;…

负载均衡-ribbon源码解析

负载均衡-ribbon源码解析 1 LoadBalanced注解 /*** 基于ribbon调用服务及负载均衡* return*/ LoadBalanced Bean public RestTemplate restTemplate(){return new RestTemplate(); }Bean ConditionalOnMissingBean public RestTemplateCustomizer restTemplateCustomizer(fin…

基于element-ui的年份范围选择器

基于element-ui的年份范围选择器 element-ui官方只有日期范围和月份范围选择器&#xff0c;根据需求场景需要&#xff0c;支持年份选择器&#xff0c;原本使用两个分开的年份选择器实现的&#xff0c;但是往往有些是不能接受的。在网上找了很多都没有合适的&#xff0c;所以打…

记录一次部署Hugo主题lotusdocs到Github Pages实践

引言 随着开源项目的越来越复杂&#xff0c;项目文档的重要性日渐突出。一个好的项目要有一个清晰明了的文档来帮助大家使用。最近一直有在找寻一个简洁明了的文档主题来放置项目的各种相关文档。最终找到这次的主角&#xff1a;Lotus Docs 基于Hugo的主题。Lotus Docs的样子&…

Axure原型设计累加器计时器设计效果(职业院校技能大赛物联网技术应用项目原型设计题目)

目录 前言 一、本题实现效果 二、操作步骤 1.新建文件 2.界面设计 2.1文本框 2.2 按钮 2.3设计界面完成 3.交互 3.1启动交互设置 3.2 分别设置三个属性 3.2.1 设置值为“0” 3.2.2 文字于文本框 3.2.3 获取焦点时 3.3 停止按钮的交互动作 3.3.1 设置变量值 3.4 重…