Skip to content

Commit 5d07458

Browse files
committed
add local_gradient to ComponentModeler
1 parent 6ce5b98 commit 5d07458

File tree

1 file changed

+14
-1
lines changed
  • tidy3d/plugins/smatrix/component_modelers

1 file changed

+14
-1
lines changed

tidy3d/plugins/smatrix/component_modelers/base.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,14 @@ class AbstractComponentModeler(ABC, Tidy3dBaseModel):
109109
"fields that were not used to create the task will cause errors.",
110110
)
111111

112+
local_gradient: bool = pd.Field(
113+
False,
114+
title="Local Gradient",
115+
description="Whether to run the gradient calculation locally. By default it is run through "
116+
"the server to save data transfer. In some cases, such as debugging, it is useful to run "
117+
"locally instead.",
118+
)
119+
112120
@pd.root_validator(pre=False)
113121
def _warn_deprecation_2_10(cls, values):
114122
log.warning(
@@ -219,7 +227,12 @@ def batch_data(self) -> BatchData:
219227
"simulations",
220228
}
221229
)
222-
return run_async(batch.simulations, **run_async_kwargs, path_dir=self.path_dir)
230+
return run_async(
231+
batch.simulations,
232+
**run_async_kwargs,
233+
local_gradient=self.local_gradient,
234+
path_dir=self.path_dir,
235+
)
223236

224237
def get_path_dir(self, path_dir: str) -> None:
225238
"""Check whether the supplied 'path_dir' matches the internal field value."""

0 commit comments

Comments
 (0)