Update to use Python API

这个提交包含在:
Craig Warren
2023-03-30 16:23:04 +01:00
父节点 e38ad654b8
当前提交 90cd5801ca
共有 2 个文件被更改,包括 73 次插入27 次删除

查看文件

@@ -1,27 +0,0 @@
#python:
from gprMax.input_cmd_funcs import *
title = 'antenna_bowtie_fs'
print('#title: {}'.format(title))
domain = domain(0.200, 0.200, 0.100)
dxdydz = dx_dy_dz(0.001, 0.001, 0.001)
time_window = time_window(30e-9)
bowtie_dims = (0.050, 0.100) # Length, height
tx_pos = (domain[0]/2, domain[1]/2, domain[2]/2)
# Source excitation and type
print('#waveform: gaussian 1 1.5e9 mypulse')
print('#transmission_line: x {:g} {:g} {:g} 50 mypulse'.format(tx_pos[0], tx_pos[1], tx_pos[2]))
# Bowtie - upper x half
triangle(tx_pos[0], tx_pos[1], tx_pos[2], tx_pos[0] + bowtie_dims[0] + 2 * dxdydz[0], tx_pos[1] - bowtie_dims[1]/2, tx_pos[2], tx_pos[0] + bowtie_dims[0] + 2 * dxdydz[0], tx_pos[1] + bowtie_dims[1]/2, tx_pos[2], 0, 'pec')
# Bowtie - lower x half
triangle(tx_pos[0] + dxdydz[0], tx_pos[1], tx_pos[2], tx_pos[0] - bowtie_dims[0], tx_pos[1] - bowtie_dims[1]/2, tx_pos[2], tx_pos[0] - bowtie_dims[0], tx_pos[1] + bowtie_dims[1]/2, tx_pos[2], 0, 'pec')
# Detailed geometry view around bowtie and feed position
geometry_view(tx_pos[0] - bowtie_dims[0] - 2*dxdydz[0], tx_pos[1] - bowtie_dims[1]/2 - 2*dxdydz[1], tx_pos[2] - 2*dxdydz[2], tx_pos[0] + bowtie_dims[0] + 2*dxdydz[0], tx_pos[1] + bowtie_dims[1]/2 + 2*dxdydz[1], tx_pos[2] + 2*dxdydz[2], dxdydz[0], dxdydz[1], dxdydz[2], title + '_pcb', type='f')
#end_python:

查看文件

@@ -0,0 +1,73 @@
from pathlib import Path
import gprMax
# File path for output
fn = Path(__file__)
# Discretisation
dl = 0.001
# Domain
x = 0.200
y = 0.200
z = 0.100
scene = gprMax.Scene()
title = gprMax.Title(name=fn.with_suffix('').name)
domain = gprMax.Domain(p1=(x, y, z))
dxdydz = gprMax.Discretisation(p1=(dl, dl, dl))
time_window = gprMax.TimeWindow(time=30e-9)
scene.add(title)
scene.add(domain)
scene.add(dxdydz)
scene.add(time_window)
bowtie_dims = (0.050, 0.100) # Length, height
tx_pos = (x/2, y/2, z/2)
# Source excitation and type
wave = gprMax.Waveform(wave_type='gaussian', amp=1, freq=1.5e9, id='mypulse')
tl = gprMax.TransmissionLine(p1=(tx_pos[0], tx_pos[1], tx_pos[2]),
polarisation='x', resistance=50, waveform_id='mypulse')
scene.add(wave)
scene.add(tl)
# Bowtie - upper x half
t1 = gprMax.Triangle(p1=(tx_pos[0], tx_pos[1], tx_pos[2]),
p2=(tx_pos[0] + bowtie_dims[0] + 2 * dl,
tx_pos[1] - bowtie_dims[1]/2,
tx_pos[2]),
p3=(tx_pos[0] + bowtie_dims[0] + 2 * dl,
tx_pos[1] + bowtie_dims[1]/2,
tx_pos[2]),
thickness=0, material_id='pec')
# Bowtie - lower x half
t2 = gprMax.Triangle(p1=(tx_pos[0] + dl, tx_pos[1], tx_pos[2]),
p2=(tx_pos[0] - bowtie_dims[0],
tx_pos[1] - bowtie_dims[1]/2,
tx_pos[2]),
p3=(tx_pos[0] - bowtie_dims[0],
tx_pos[1] + bowtie_dims[1]/2,
tx_pos[2]),
thickness=0, material_id='pec')
scene.add(t1)
scene.add(t2)
# Detailed geometry view around bowtie and feed position
gv1 = gprMax.GeometryView(p1=(tx_pos[0] - bowtie_dims[0] - 2*dl,
tx_pos[1] - bowtie_dims[1]/2 - 2*dl,
tx_pos[2] - 2*dl),
p2=(tx_pos[0] + bowtie_dims[0] + 2*dl,
tx_pos[1] + bowtie_dims[1]/2 + 2*dl,
tx_pos[2] + 2*dl),
dl=(dl, dl, dl), filename='antenna_bowtie_fs_pcb',
output_type='f')
scene.add(gv1)
# Run model
gprMax.run(scenes=[scene], geometry_only=False, outputfile=fn, gpu=None)