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

📄 mesh.java

📁 该内容是关于fdtd的源码,我用过,ok!不错!
💻 JAVA
字号:
/* 3D FDTD PACKAGE in Java by Stephen Kirkup
  ==========================================
  MARK 1. Released January 2005

  This file: Mesh.java (part of the pre-processor) FDTDpre.java

  This is a shareware java source code that carries out the FDTD (finite difference time domain)
  algorithm. The code is available for general use. The copyright remains with the author; the
  program should not be passed on to others, even in revised form, without the permission of the
  author. The author would be pleased to hear of any interesting applications of the code, ideas
  for future development, links to the website, or bugs in the code.

  The author can be contacted on smk@electromagnetics.info

  The webpages maintaining this code is www.fdtd.electromagnetics.info please refer to
  it for downloads or any news or updates.

  The java compiler/interpreter can be downloaded free from wwww.java.sun.com

  The FDTD algorithm is the most popular method for transient electromagnetic simulation.

  FDTD is also very computationally-intensive hence the program has been divided into two parts: a
  pre-processor (FDTDpre.java) that carries out the computation and stores relevant results and
  a post-processor (FDTDpost.java) that carries out a simple visualisation of the results.
  The test problem is input using the .DAT file and output to .OUT files. The .MON (monitor)
  file monitors the program (to be viewed soon after the start of the program to
  check that everything is as you expected and that the program will run in a reasonable time.

  */

  public class Mesh
{
	static public double xlength, ylength, zlength;
	static public double dl;
	static public double dt;
	static public double time;
	static public int Nx, Ny, Nz;
	static public int Nt;

	public Mesh(double xlength, double ylength, double zlength, double dl, double time)
	{
        PhysicalConstants Const = new PhysicalConstants();
		double eps=0.00000000001;
		  Array A = new Array();
		this.xlength=xlength;
		this.ylength=ylength;
		this.zlength=zlength;
		this.dl=dl;
		this.Nx=(int)Math.round(xlength/dl);
		this.Ny=(int)Math.round(ylength/dl);
		this.Nz=(int)Math.round(zlength/dl);
		this.dt=dl/Const.c0/Math.sqrt(3.0)/1.1;
		this.Nt=(int)Math.round(time/dt);

 		if (!A.DimensionsOK(Nx,Ny,Nz))
 		{
		 System.out.println("Mesh is not OK");
		}
 		if (Math.abs(Nx*dl-xlength)>eps)
  		{ System.out.println("x-dimension of domain must be compatable with cell size");
		}
		if (Math.abs(Ny*dl-ylength)>eps)
 		{ System.out.println("y-dimension of domain must be compatable with cell size");
 		}
  		if (Math.abs(Nz*dl-zlength)>eps)
  		{ System.out.println("z-dimension of domain must be compatable with cell size");
  		}

	}
}


⌨️ 快捷键说明

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