@@ -115,6 +115,11 @@ class MicroSimulation: # Name is fixed
115115 It will be called with frequency set by configuration option `simulation_params: micro_output_n`
116116 This function is *optional*.
117117 """
118+
119+ def get_global_id (self ):
120+ """
121+ Return the assigned global id.
122+ """
118123```
119124
120125For this the default MicroSimulation still serves as the model interface, while the ` (set)|(get)_state() ` methods
@@ -124,40 +129,43 @@ is likely to be the full order model, while subsequent ones are ROMs.
124129
125130``` python
126131def switching_function (
127- resolutions : np.ndarray ,
128- locations : np.ndarray,
132+ resolution : int ,
133+ location : np.ndarray,
129134 t : float ,
130- inputs : list[ dict ] ,
135+ input : dict ,
131136 prev_output : dict ,
132- active : np.ndarray,
133- ) -> np.ndarray:
137+ ) -> int :
134138 """
135139 Switching interface function, use as reference
136140
137141 Parameters
138142 ----------
139- resolutions : np.array - shape(N,)
140- Array with resolution information as get_sim_class_resolution would return for a sim obj.
141- locations : np.array - shape(N,D )
142- Array with gaussian points for all sims. D is the mesh dimension .
143+ resolution : int
144+ Current resolution as get_sim_class_resolution would return for the respective sim obj.
145+ location : np.array - shape(D, )
146+ Array with gaussian points.
143147 t : float
144148 Current time in simulation.
145- inputs : list[ dict]
146- List of input objects .
147- prev_output : [None, dict-like ]
149+ input : dict
150+ Input object .
151+ prev_output : [None, dict]
148152 Contains the outputs of the previous model evaluation.
149- active : np.array - shape(N,)
150- Bool array indicating whether the model is active or not.
151153
154+ Returns
155+ -------
156+ switch_direction: int
157+ 0 if resolution should not change
158+ -1 if resolution should increase
159+ 1 if resolution should decrease
152160 """
153- return np.zeros_like(resolutions)
161+ return 0
154162```
155163
156- The switching of models is governed by the ` switching_function ` .
157- The output is expected to be a np.ndarray of shape (N,) and is interpreted in the following manner:
164+ The switching of models is governed by the ` switching_function ` , which is evaluated for each micro simulation .
165+ The output is expected to be an integer and is interpreted in the following manner:
158166
159- Value | Action
160- --- | ---
161- 0 | No resolution change
162- -1 | Increase model fidelity by one (go back one in list)
163- 1 | Decrease model fidelity by one (go one ahead in list)
167+ | Value | Action |
168+ | ------- | ------------------------------------------------------- |
169+ | 0 | No resolution change |
170+ | -1 | Increase model fidelity by one (go back one in list) |
171+ | 1 | Decrease model fidelity by one (go one ahead in list) |
0 commit comments