pisces.extensions.simulation.core.initial_conditions.InitialConditions2DCartesian.add_model#
- InitialConditions2DCartesian.add_model(name: str, model: str | Path | BaseModel, model_config: dict[str, Any], file_processing_mode: str = 'copy', overwrite: bool = False, **kwargs)#
Add a new model to the initial conditions set.
This method can be used to incorporate a new model into the initial conditions. In doing so, the model is validated to ensure that it satisfies the conditions for inclusion in the ICs and then is added in the same way that the original dataset was generated. This includes copying or moving the model file into the IC directory and updating the configuration file.
- Parameters:
name (
str) – The name of the model being added.model (
str,PathorBaseModel) –The model to add, specified as either:
Path-like (str or Path): Path to the model file on disk. The file will be copied or moved into the initial conditions directory according to
file_processing_mode.BaseModel instance: An already loaded model object. Its source file path will be obtained from the model’s metadata.
In both cases, the model file must exist and be accessible before calling this method.
model_config (
tuple) –A tuple specifying the model configuration settings. This may vary from code to code and should be documented in the subclass. Commonly, this includes parameters such as:
position: unyt array or sequence of lengthndimvelocity: unyt array or sequence of lengthndimorientation: sequence or array defining orientation vectorspin: scalar float
- file_processing_mode{“copy”, “move”}, default=”copy”
Determines how the provided model file is placed into the initial conditions directory:
"copy": The source file is copied into the IC directory, preserving the original file in its current location."move": The source file is moved into the IC directory, removing it from its original location.
- overwritebool, optional
If
True, an existing model entry with the samenamewill be replaced, and any associated files will be deleted or overwritten as needed. IfFalse(default), attempting to add a model with a duplicate name will raise aValueError.- kwargs:
Additional keyword arguments passed to the model processing function. This may include options specific to the subclass or model type.