MCPcopy Create free account
hub / github.com/NanoComp/meep / _stop

Function _stop

python/simulation.py:5300–5321  ·  view source on GitHub ↗
(sim)

Source from the content-addressed store, hash-verified

5298 }
5299
5300 def _stop(sim):
5301 fabs = abs(sim.get_field_point(c, pt)) * abs(sim.get_field_point(c, pt))
5302 closure["cur_max"] = max(closure["cur_max"], fabs)
5303
5304 if sim.round_time() <= dt + closure["t0"]:
5305 return False
5306 else:
5307 old_cur = closure["cur_max"]
5308 closure["cur_max"] = 0
5309 closure["t0"] = sim.round_time()
5310 closure["max_abs"] = max(closure["max_abs"], old_cur)
5311 if closure["max_abs"] != 0 and verbosity.meep > 0:
5312 fmt = "field decay(t = {}): {} / {} = {}"
5313 print(
5314 fmt.format(
5315 sim.meep_time(),
5316 old_cur,
5317 closure["max_abs"],
5318 old_cur / closure["max_abs"],
5319 )
5320 )
5321 return old_cur <= closure["max_abs"] * decay_by
5322
5323 return _stop
5324

Callers

nothing calls this directly

Calls 9

absFunction · 0.85
meep_timeMethod · 0.80
dft_maxfreqMethod · 0.80
max_decimationMethod · 0.80
dft_normMethod · 0.80
maxFunction · 0.50
get_field_pointMethod · 0.45
round_timeMethod · 0.45
field_energy_in_boxMethod · 0.45

Tested by

no test coverage detected