你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 04:56:51 +08:00
Moved creation of new material for resistive voltage source to voltage source class.
这个提交包含在:
@@ -16,6 +16,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from copy import deepcopy
|
||||
import numpy as np
|
||||
|
||||
from gprMax.constants import c, floattype
|
||||
@@ -73,6 +74,33 @@ class VoltageSource:
|
||||
else:
|
||||
Ez[i, j, k] = -1 * waveform.amp * waveform.calculate_value(time, G.dt) / G.dz
|
||||
|
||||
def create_material(self, G):
|
||||
"""Create a new material at the voltage source location that adds the voltage source conductivity to the underlying parameters.
|
||||
|
||||
Args:
|
||||
G (class): Grid class instance - holds essential parameters describing the model.
|
||||
"""
|
||||
|
||||
if self.resistance != 0:
|
||||
ID = 'E' + self.polarisation
|
||||
requirednumID = G.ID[G.IDlookup[ID], self.xcoord, self.ycoord, self.zcoord]
|
||||
material = next(x for x in G.materials if x.numID == requirednumID)
|
||||
newmaterial = deepcopy(material)
|
||||
newmaterial.ID = material.ID + '+VoltageSource_' + str(self.resistance)
|
||||
newmaterial.numID = len(G.materials)
|
||||
newmaterial.average = False
|
||||
|
||||
# Add conductivity of voltage source to underlying conductivity
|
||||
if self.polarisation == 'x':
|
||||
newmaterial.se += G.dx / (self.resistance * G.dy * G.dz)
|
||||
elif self.polarisation == 'y':
|
||||
newmaterial.se += G.dy / (self.resistance * G.dx * G.dz)
|
||||
elif self.polarisation == 'z':
|
||||
newmaterial.se += G.dz / (self.resistance * G.dx * G.dy)
|
||||
|
||||
G.ID[G.IDlookup[ID], self.xcoord, self.ycoord, self.zcoord] = newmaterial.numID
|
||||
G.materials.append(newmaterial)
|
||||
|
||||
|
||||
class HertzianDipole:
|
||||
"""The Hertzian dipole is an additive source (electric current density)."""
|
||||
|
在新工单中引用
屏蔽一个用户