Open bclyons12 opened 9 months ago
Maybe this could be automated if we already track any dd quantity that's a dimension? We would need to be careful of multithreading of course
@bclyons12 can you please take a look at the temporary
IDS and see if it could be used for this purpose?
It looks like it can support 0D...6D data both time dependent and not.
IMASDD.temporary Storage of undeclared data model components
├─ constant_float0d[:] [mixed] Constant 0D float
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value Value
├─ constant_float1d[:] [mixed] Constant 1D float
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value Value
├─ constant_float2d[:] Constant 2D float
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value [mixed] Value
├─ constant_float3d[:] Constant 3D float
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value [mixed] Value
├─ constant_float4d[:] Constant 4D float
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value [mixed] Value
├─ constant_float5d[:] Constant 5D float
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value [mixed] Value
├─ constant_float6d[:] Constant 6D float
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value [mixed] Value
├─ constant_integer0d[:] Constant 0D integer
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value Value
├─ constant_integer1d[:] Constant 1D integer
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value Value
├─ constant_integer2d[:] Constant 2D integer
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value Value
├─ constant_integer3d[:] Constant 3D integer
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value Value
├─ constant_string0d[:] Constant 0D string
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value Value
├─ constant_string1d[:] Constant 1D string
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value Value
├─ dynamic_float1d[:] Dynamic 1D float
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value [mixed] Value
│ ├─ data [mixed] Data
│ └─ time [s] Time
├─ dynamic_float2d[:] Dynamic 2D float
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value [mixed] Value
│ ├─ data [mixed] Data
│ └─ time [s] Time
├─ dynamic_float3d[:] Dynamic 3D float
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value [mixed] Value
│ ├─ data [mixed] Data
│ └─ time [s] Time
├─ dynamic_float4d[:] Dynamic 4D float
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value [mixed] Value
│ ├─ data [mixed] Data
│ └─ time [s] Time
├─ dynamic_float5d[:] Dynamic 5D float
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value [mixed] Value
│ ├─ data [mixed] Data
│ └─ time [s] Time
├─ dynamic_float6d[:] Dynamic 6D float
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value [mixed] Value
│ ├─ data [mixed] Data
│ └─ time [s] Time
├─ dynamic_integer1d[:] Dynamic 1D integer
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value Value
│ ├─ data Data
│ └─ time [s] Time
├─ dynamic_integer2d[:] Dynamic 2D integer
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value Value
│ ├─ data Data
│ └─ time [s] Time
├─ dynamic_integer3d[:] Dynamic 3D integer
│ ├─ identifier Description of the quantity using the standard identifier structure
│ │ ├─ description Verbose description
│ │ ├─ index Integer identifier (enumeration index within a list). Private identifier values must be indicated by a negative
│ │ │ index.
│ │ └─ name Short string identifier
│ └─ value Value
│ ├─ data Data
│ └─ time [s] Time
Not quite what I had in mind. My idea is the preallocate the temporary arrays once the size of the dimensions are known. You would need a separate one for each dimension.
Perhaps we could use the temporary
IDS if we wanted to allocate on the fly and check dimensions each time, reallocating if they're wrong. At least then you only allocate once if it's in a loop or something. Some clever macros or functions to handle that would help.
Ok, I think I get it. Essentially in your example you'd like to do .=
:
bd.oh.flattop_duration .= bd.flux_swing.flattop / abs(integrate(cp1d.grid.area, cp1d.j_ohmic ./ cp1d.conductivity_parallel))
Often times in FUSE and such we need to create intermediary arrays, e.g. https://github.com/ProjectTorreyPines/FUSE.jl/blob/d7b49e00f733b363c33f1287a680666001727842/src/actors/build/oh_magnet.jl#L80 What if we imbedded some temporary arrays within the dd, e.g., inside
core_profiles.profiles_1d[]
and the like? Then we could do these calculations without allocations.