@@ -639,11 +639,37 @@ def write_bctides(self, bctides_file):
639639 # tracer_mod_pos[tracer_mods[kk]] = kk
640640
641641 for i in range (num_open_boundaries ):
642- print ("processing open boundary %s " % self .open_boundaries [i ]["name" ])
642+ bound_name = self .open_boundaries [i ]["name" ]
643+ print ("processing open boundary %s " % bound_name )
643644 num_nodes = len (hgrid .boundaries [i ].nodes )
644645 node_id_lst = hgrid .boundaries [i ].nodes
645646 elev_id = 0
646647 elev_boundary = None
648+ ## if flow_direction is given and is outflow, then
649+ ## this boundary shouldn't have any tracer boundary, such
650+ ## as temperature, salinity or other scalars
651+
652+ if "flow_direction" in self .open_boundaries [i ].keys ():
653+ flow_direction = self .open_boundaries [i ]["flow_directions" ]
654+ if "flow_direction" == "outflow" :
655+ if "temperature" in self .open_boundaries [i ].keys ():
656+ raise ValueError (
657+ f"Boundary '{ bound_name } ' is configured as an outflow; a temperature boundary "
658+ "specification is not allowed."
659+ )
660+ if "salinity" in self .open_boundaries [i ].keys ():
661+ raise ValueError (
662+ f"Boundary '{ bound_name } ' is configured as an outflow; a salinity boundary "
663+ "specification is not allowed."
664+ )
665+ if "tracers" in self .open_boundaries [i ].keys ():
666+ raise ValueError (
667+ f"Boundary '{ bound_name } ' is configured as an outflow; tracer "
668+ "specification is not allowed."
669+ )
670+
671+
672+
647673 if "elevation" in self .open_boundaries [i ]["variables" ].keys ():
648674 elev_boundary = self .open_boundaries [i ]["variables" ]["elevation" ]
649675 elev_source = elev_boundary ["source" ]
0 commit comments