Giter Club home page Giter Club logo

akohta / bem3_emf_b1 Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 70.67 MB

This is the three-dimensional electromagnetic field analysis program for arbitrary object irradiated by arbitrary beams. The radiation force acting on the object can be analyzed. This is based on boundary element method, the own developed numerical solution is used.

License: GNU General Public License v3.0

Makefile 0.64% Gnuplot 1.31% C 93.76% GLSL 4.02% Shell 0.27%
electromagnetic-simulation electromagnetic-wave boundary-element-method radiation-force

bem3_emf_b1's Introduction

bem3_emf_b1

This is the three-dimensional electromagnetic field analysis program for arbitrary object irradiated by arbitrary beams. This is based on boundary element method, the own developed numerical solution is used. This is the full vector field three-dimensional analysis, the corner probrem free. Intel Math Kernel Library and libpng are required. Gmsh is used for create a mesh data of object. The electromagnetic field analysis program "multi_fbeam" is used for analyze incident field.

Usage of example code

  1. type 'make' command to compile.
    The executable d3b1_bv_solver, example1.out, example2.out, example3.out, example4.out are created. The executable d3b1_bv_solver is the main solver of boundary integral equations. The example1.out is the executable of source code example1.c, it shows a simplest example using "bem3_emf_b1". The example2.out is the execubable of source code example2.c, it shows a example of electromagnetic field intensity analysis. The example3.out is the executable of source code example3.c, it shows a example of outputting the instantaneous value of electromagnetic field as an image. The example4.out is the executable of source code example4.c, it shows a example of far-field intensity analysis.

  2. type './d3b1_bv_solver' with arguments of medium datafile name, mesh datafile name and output dafafile name.
    For example, './d3b1_bv_solver medium_data.txt sphere_m1.msh ex.dat'. The medium_data.txt is the sample of medium datafile, two mediums are defined in it. The domain numbers are assigned to the medium from 1 in order. The sphere_m1.msh is the example of mesh datafile, it is a sphere consists of two hemispheres. It was created by Gmsh geometry file sphere_m1.geo in the mesh_sample folder. The sphere_m1_image.png is the visulalization result of the sphere_m1.msh. The d3b1_bv_solver solves boundary integral equations with the specified datafiles, outputs the results to binary file with the output datafile name. The ipw.txt is the sample of incident field datafile, a plane-wave is defined in it. Please refer to "multi_fbeam" for detail. This sample requires about 32GB of memory to solve boundary integral equations (required to run d3b1_bv_solver). The d3b1_bv_solver has optional arguments for rotation and translation of the object. When the vector defining rotation axis is (rx, ry, rz), the rotation angle is theta, the translation vector is (tx, ty, tz), the arguments are './d3b1_bv_solver medium_data.txt sphere_m1.msh ex.dat rx ry rz theta tx ty tz'. Rodrigues' rotation formula is used. As a simple representation of the analysis model, the nodes used for the surface integral are output as point cloud data. In this example, the file ex.particles is output, and the visualization result is ex_particle.png. The image was created using gnuplot script "gscript_particles.plt" and converted eps to png by using ImageMagick.

  3. type './example1.out' with an argument of datafile name output by d3b1_bv_solver.
    For example, './example1.out ex.dat'. This executable calculates electromagnetic field, radiation force and torque.

  4. type './example2.out' with an argument of datafile name output by d3b1_bv_solver.
    For example, './example2.out ex.dat'. This executable calculates electromagnetic field intensity distributions, outputs them to text files. The I_example2.png is the visualization result of intensity distributions, created by using gnuplot script gscript_example2.plt.

  5. type './example3.out' with an argument of datafile name output by d3b1_bv_solver.
    For example, './example3.out ex.dat'. This executable calculates instantaneous value of the electromagnetic fields, outputs them to png image files. The image files are output to the folder which has a name adding "images" to the datafile name specified in the argument (file-extension is excluded). Each image file has a name that indicates the cross section, field component, and number of time steps (ex. xz_Ex_014.png). The color bar is output as color_bar.png in the same folder. The range of color bar in each cross section is output to the info.txt file (ex. xy_info.txt for z=0 plane). The xz_Ex.gif, yz_Ex.gif and xy_Ex.gif are animated gifs that concatenate the png files created by using the shell script gif_animation.sh.

  6. type './example4.out' with an argument of datafile name output by d3b1_bv_solver.
    For example, './example4.out ex.dat'. This executable calculates far-field intensity distributions and outputs them to text files. The I_example4.png is the visualization result of electric field intensity distributions, created by gnuplot script gscript_example4.plt.

Please see d3b1_src/bem3_emf_b1.h for detail of functions. The main parts of the code are parallelized by using OpenMP. The number of threads is controlled by the environment variable OMP_NUM_THREADS. The additional analysis examples are in the folder analysis_sample1 ~ analysis_sample4.

mesh 0
point cloud data 0 intensity distributions 0 xz_Ex.gifyz_Ex.gif
xy_Ex.gif
far-field 0

Analysis sample 1 ( in the folder analysis_sample1 )

This is the analysis result of plane wave scattering by the cone shaped metal.

mesh 1
point cloud data 1 intensity distributions 1
xz_Ex.gif 1yz_Ex.gif 1   xy_Ex.gif 1   far-field 1  

Verifications

Verification 1

The verification result using "emf_mie_mmls" is in the folder verification1. It is the analysis result of plane wave scattering by the two-layered sphere. The sphere_m2_image.png is the visualization result of mesh datafile. The I_example2.png is the visualization result of intensity distributions. The result of "emf_mie_mmls" is in the folder emf_mie_mmls_result.

mesh v1

Verification 2

The verification result using "emf_mie_ms" is in the folder verification2. It is the analysis result of plane wave scattering by the three arranged spheres. The sphere_m3_image.png is the visualization result of mesh datafile. The I_example2.png is the visualization result of intensity distributions. The result of "emf_mie_ms" is in the folder emf_mie_ms_result.

mesh v2

About mesh file

This code can use quadrangular ( bi-linear ) and triangular ( linear triangular ) elements. I recommend using quadrangular element for reduce required memory. The samples of mesh data are in the folder mesh_sample. The file with extension .geo is the Gmsh geometry file. The file with extension .msh is the mesh datafile created by Gmsh geometry file. These mesh files are created by the command 'gmsh -2 -tol 1.0e-15 -format msh2 xxxx.geo' in command line ( xxxx.geo is a geometry file). The msh file format must be version 2. The domain number ( Physical Surface ) 99 is assigned to the open region in Gmsh geometry file, because Gmsh can't use the number 0 (assigned to open region in the code). Please refer to the manual of Gmsh for detail of geometry file.

System of units

This program use the own defined system of units (OSU), optimized for optics. The system of units is defined as ( speed of light in vacuum ), ( permeability of vacuum ). For the conversion from OSU to MKSA system of units, the unit of length in OSU is defined as [m] in MKSA, the unit of power in OSU is defined as [W] in MKSA. The conversions of base unit are follows.
,
,
,
,
,
.
Please see com_src/osu_mksa.h and com_src/osu_mksa.c for detail of conversions.

References

  1. Intel Math Kernel Library MKL
  2. The official PNG reference library libpng
  3. Three-dimensional mesh generator Gmsh
  4. The command-line driven graphing utility gnuplot
  5. The utilities for manipulating images ImageMagick
  6. The electromagnetic field analysis program multi_fbeam
  7. The electromagnetic field analysis program emf_mie_mmls
  8. The electromagnetic field analysis program emf_mie_ms

bem3_emf_b1's People

Contributors

akohta avatar

Watchers

 avatar

Forkers

hesslery

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.