@@ -188,17 +188,6 @@ def check_interpolator_filename(self) -> Self:
188188 # raise ValueError("z needs to be None if seed_seafloor is True.")
189189 # return self
190190
191- # this is not true! For example, OpenOil has by default no vertical advection but yes vertical mixing
192- # @model_validator(mode="after")
193- # def check_config_do3D(self) -> Self:
194- # """Check if do3D is set correctly."""
195- # if hasattr(self, "vertical_mixing"):
196- # if not self.do3D and self.vertical_mixing:
197- # raise ValueError(
198- # "If do3D is False, vertical_mixing must also be False."
199- # )
200- # return self
201-
202191 @model_validator (mode = "after" )
203192 def setup_interpolator (self ) -> Self :
204193 """Setup interpolator."""
@@ -497,7 +486,7 @@ class OceanDriftModelConfig(OpenDriftConfig):
497486 )
498487
499488 vertical_mixing_at_surface : bool = Field (
500- default = True ,
489+ default = False ,
501490 description = "If vertical mixing is activated, surface elements (z=0) can only be mixed (downwards) if this setting it True." ,
502491 title = "Vertical Mixing At Surface" ,
503492 json_schema_extra = {
@@ -507,7 +496,7 @@ class OceanDriftModelConfig(OpenDriftConfig):
507496 )
508497
509498 vertical_advection_at_surface : bool = Field (
510- default = True ,
499+ default = False ,
511500 description = "If vertical advection is activated, surface elements (z=0) can only be advected (downwards) if this setting it True." ,
512501 title = "Vertical Advection At Surface" ,
513502 json_schema_extra = {
@@ -524,6 +513,14 @@ def check_wind_drift(self) -> Self:
524513 logger .debug ("Setting wind_drift_factor to 0 because wind_drift is False." )
525514 return self
526515
516+ @model_validator (mode = "after" )
517+ def check_config_do3D (self ) -> Self :
518+ """If do3D is False, set vertical_mixing to False."""
519+ if not self .do3D :
520+ self .vertical_mixing = False
521+ logger .debug ("Setting vertical_mixing to False because do3D is False." )
522+ return self
523+
527524
528525class OpenOilModelConfig (OceanDriftModelConfig ):
529526 """OpenOil model configuration for OpenDrift."""
@@ -688,7 +685,7 @@ class OpenOilModelConfig(OceanDriftModelConfig):
688685 OceanDriftModelConfig .model_fields ["wind_drift_factor" ], Field (default = 0.03 )
689686 )
690687 vertical_mixing : bool = FieldInfo .merge_field_infos (
691- OceanDriftModelConfig .model_fields ["vertical_mixing" ], Field (default = True )
688+ OceanDriftModelConfig .model_fields ["vertical_mixing" ], Field (default = False )
692689 )
693690 vertical_mixing_at_surface : bool = FieldInfo .merge_field_infos (
694691 OceanDriftModelConfig .model_fields ["vertical_mixing_at_surface" ],
@@ -928,15 +925,15 @@ def check_do3D(self) -> Self:
928925
929926 return self
930927
931- @model_validator (mode = "after" )
932- def check_vertical_mixing (self ) -> Self :
933- """Check if vertical_mixing is set to True for LarvalFish model."""
934- if not self .vertical_mixing :
935- raise ValueError (
936- "vertical_mixing must be True with the LarvalFish drift model."
937- )
928+ # @model_validator(mode="after")
929+ # def check_vertical_mixing(self) -> Self:
930+ # """Check if vertical_mixing is set to True for LarvalFish model."""
931+ # if not self.vertical_mixing:
932+ # raise ValueError(
933+ # "vertical_mixing must be True with the LarvalFish drift model."
934+ # )
938935
939- return self
936+ # return self
940937
941938 # @model_validator(mode="after")
942939 # def check_hatched_and_stage_fraction(self) -> Self:
@@ -1077,21 +1074,21 @@ class PhytoplanktonModelConfig(OceanDriftModelConfig):
10771074 OceanDriftModelConfig .model_fields ["wind_drift_factor" ], Field (default = 0.0 )
10781075 )
10791076
1080- @model_validator (mode = "after" )
1081- def check_do3D (self ) -> Self :
1082- """Check if do3D is set to True for Phytoplankton model."""
1083- if not self .do3D :
1084- raise ValueError ("do3D must be True with the Phytoplankton drift model." )
1085- return self
1077+ # # @model_validator(mode="after")
1078+ # # def check_do3D(self) -> Self:
1079+ # # """Check if do3D is set to True for Phytoplankton model."""
1080+ # # if not self.do3D:
1081+ # # raise ValueError("do3D must be True with the Phytoplankton drift model.")
1082+ # # return self
10861083
1087- @model_validator (mode = "after" )
1088- def check_vertical_mixing (self ) -> Self :
1089- """Check if vertical_mixing is set to True for Phytoplankton model."""
1090- if not self .vertical_mixing :
1091- raise ValueError (
1092- "vertical_mixing must be True with the Phytoplankton drift model."
1093- )
1094- return self
1084+ # @model_validator(mode="after")
1085+ # def check_vertical_mixing(self) -> Self:
1086+ # """Check if vertical_mixing is set to True for Phytoplankton model."""
1087+ # if not self.vertical_mixing:
1088+ # raise ValueError(
1089+ # "vertical_mixing must be True with the Phytoplankton drift model."
1090+ # )
1091+ # return self
10951092
10961093 @model_validator (mode = "after" )
10971094 def check_vertical_behavior_parameters (self ) -> Self :
0 commit comments