⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1单层单负场强.cpp

📁 Compute the Electric_Field of the single interface contains the single negative materials
💻 CPP
字号:
#include <iostream.h>
#include <iomanip.h>
#include "fstream.h"
#include "math.h"
#include <complex.h>
#define PI 3.14159265358979323846264338328
#define S 0.0001



void main()
{

  ofstream out("1.dat");

  complex ImUnit;
  ImUnit=complex(0,1);
  double M,theta,ep2,mu1,omg,d1,d2,d;
  int num=1000;

  theta=0;
  omg=1;
  mu1=3.0;
  d1=0.020;


  complex r,t,E01,E02,Ed,Md;
  double ep1,mu2,n1,n2,k1,k2,R,T,Edd,Mdd;
  double A[4],B[4],C[4],D[4],F[4],G[4];

  ep1=1-100/(2*PI*omg*2*PI*omg);
  n1=sqrt(fabs(ep1*mu1));
  k1=(2*PI*omg*10/3)*n1;


  A[0]=cosh(k1*d1);
  A[1]=mu1*sinh(k1*d1)/n1;
  A[2]=n1*sinh(k1*d1)/mu1;
  A[3]=cosh(k1*d1);


  r=((A[3]-A[0])*cos(theta)+ImUnit*(A[1]*cos(theta)*cos(theta)+A[2]))/((A[3]+A[0])*cos(theta)+ImUnit*(A[1]*cos(theta)*cos(theta)-A[2]));

   for(int j=0;j<=num;j++)
  {
   M=j*d1/num;

   G[0]=cosh(k1*M);
   G[1]=mu1*sinh(k1*M)/n1;
   G[2]=n1*sinh(k1*M)/mu1;
   G[3]=cosh(k1*M);

   E01=1+r;
   E02=-ImUnit*(1-r);
   Ed=G[0]*E01+G[1]*E02;
   Md=G[2]*E01+G[3]*E02;

   Edd=norm(Ed);
   Mdd=norm(Md);
   out<<M<<"  "<<Edd<<"  "<<Mdd<<endl;
     }

 }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -