You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At present, Field objects are evaluated on an entire coordinate grid before been passed to a Simulator. More specifically, the get_field method (which relies on the user defined compute_field method) will always return a Quantity array evaluated over the whole coordinate grid that was provided.
This design choice was based on simplicity (it is easy to visualise pre-evaluating everything on a fixed grid) and the present way that Hammurabi works (it can read gridded fields from binary files). In the future, however, there may be room for fields which are only evaluated in the specific points where Simulator needs them. Below a draft design specification of this future feature:
Specification
Field's should have an attribute function_field which, when False falls back to the current behaviour
If function_field==True
The subclass has to include a standardized function (or similar name) method, which takes a coordinate point as argument and returns the evaluated field on that specific point
The get_field method will keep backwards compatibility, simply evaluating the function method, instead of relying on compute_field
The Simulator will have an attribute indicating whether or not it supports "function fields"
If it does support, instead of evaluating and summing the fields, a list of functions is passed to the simulator (which will be able to evaluate them wherever it wants)
There is room for Simulators sublcasses which support only "grid fields" (the present behaviour), "grid and function fields" and "only function fields"
If a particular Simulator subclass supports only "grid fields", any "function fields" will be evaluated on the grid before being handed to it.
If for a particular Simulator only "function fields" are supported, a fake "function field" can be automatically constructed from any "grid-only fields" using interpolation
In the case both "grid" and "function fields" are supported, both are provided to the subclasses
Field dependencies are expected to be a major technical challenge to this implementation. For example: a "grid field" which depends on a field type should force all the "function fields" to behave as "grid fields" (or is there a better alternative?).
The text was updated successfully, but these errors were encountered:
A boolean class attribute GRID_FIELD will define the behaviour of compute_field. If True, compute_field returns an array. If False, it returns a function which takes the coordinates as arguments. The simulator class will be adjusted accordingly.
At present,
Field
objects are evaluated on an entire coordinate grid before been passed to aSimulator
. More specifically, theget_field
method (which relies on the user definedcompute_field
method) will always return aQuantity
array evaluated over the whole coordinate grid that was provided.This design choice was based on simplicity (it is easy to visualise pre-evaluating everything on a fixed grid) and the present way that
Hammurabi
works (it can read gridded fields from binary files). In the future, however, there may be room for fields which are only evaluated in the specific points whereSimulator
needs them. Below a draft design specification of this future feature:Specification
Field
's should have an attributefunction_field
which, whenFalse
falls back to the current behaviourfunction_field==True
function
(or similar name) method, which takes a coordinate point as argument and returns the evaluated field on that specific pointget_field
method will keep backwards compatibility, simply evaluating thefunction
method, instead of relying oncompute_field
Simulator
will have an attribute indicating whether or not it supports "function fields"Simulator
s sublcasses which support only "grid fields" (the present behaviour), "grid and function fields" and "only function fields"Simulator
subclass supports only "grid fields", any "function fields" will be evaluated on the grid before being handed to it.Simulator
only "function fields" are supported, a fake "function field" can be automatically constructed from any "grid-only fields" using interpolationField dependencies are expected to be a major technical challenge to this implementation. For example: a "grid field" which depends on a field type should force all the "function fields" to behave as "grid fields" (or is there a better alternative?).
The text was updated successfully, but these errors were encountered: