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

Method integrate2_field_function

python/simulation.py:4386–4419  ·  view source on GitHub ↗

Similar to `integrate_field_function`, but takes additional parameters `fields2` and `cs2`. `fields2` is a `meep::fields*` object similar to the global `fields` variable (see below) specifying the fields from another simulation. `cs1` is a list of components to integ

(
        self, fields2, cs1, cs2, func, where=None, center=None, size=None
    )

Source from the content-addressed store, hash-verified

4384 return self.fields.integrate([cs, func], where)
4385
4386 def integrate2_field_function(
4387 self, fields2, cs1, cs2, func, where=None, center=None, size=None
4388 ):
4389 """
4390 Similar to `integrate_field_function`, but takes additional parameters `fields2`
4391 and `cs2`. `fields2` is a `meep::fields*` object similar to the global `fields`
4392 variable (see below) specifying the fields from another simulation. `cs1` is a
4393 list of components to integrate with from the `meep::fields` instance in
4394 `Simulation.fields`, as for `integrate_field_function`, while `cs2` is a list of
4395 components to integrate from `fields2`. Similar to `integrate_field_function`,
4396 `func` is a function that returns an number given arguments consisting of: the
4397 position vector, followed by the values of the components specified by `cs1` (in
4398 order), followed by the values of the components specified by `cs2` (in order).
4399 The volume can optionally be specified via the `center` and `size` arguments.
4400
4401 To get two fields in memory at once for `integrate2_field_function`, the easiest
4402 way is to run one simulation within a given Python file, then save the results in
4403 another fields variable, then run a second simulation. This would look something
4404 like:
4405
4406 ```py
4407 ...set up and run first simulation...
4408 fields2 = sim.fields # save the fields in a variable
4409 sim.fields = None # prevent the fields from getting deallocated by reset-meep
4410 sim.reset_meep()
4411 ...set up and run second simulation...
4412 ```
4413
4414 It is also possible to timestep both fields simultaneously (e.g. doing one
4415 timestep of one simulation then one timestep of another simulation, and so on, but
4416 this requires you to call much lower-level functions like `fields_step()`.
4417 """
4418 where = self._get_field_function_volume(where, center, size)
4419 return self.fields.integrate2(fields2, [cs1, cs2, func], where)
4420
4421 def max_abs_field_function(self, cs, func, where=None, center=None, size=None):
4422 """

Callers 2

Calls 2

integrate2Method · 0.80

Tested by 1