File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,6 +137,15 @@ Tendencies *Tendencies::get(const std::string &Name ///< [in] Name of tendencies
137137
138138} // end get tendencies
139139
140+ // ------------------------------------------------------------------------------
141+ // Check if tendencies exists by name
142+ bool Tendencies::exists (const std::string &Name // /< [in] Name of tendencies
143+ ) {
144+
145+ return AllTendencies.find (Name) != AllTendencies.end ();
146+
147+ } // end exists
148+
140149// ------------------------------------------------------------------------------
141150// read and set config options
142151void Tendencies::readConfig (Config *OmegaConfig // /< [in] Omega config
Original file line number Diff line number Diff line change @@ -154,6 +154,10 @@ class Tendencies {
154154 static Tendencies *get (const std::string &Name // /< [in]
155155 );
156156
157+ // check if tendencies exists by name
158+ static bool exists (const std::string &Name // /< [in]
159+ );
160+
157161 // read and set config options
158162 void readConfig (Config *OmegaConfig);
159163
Original file line number Diff line number Diff line change @@ -61,8 +61,12 @@ void SfcStressForcingVars::registerFields(
6161}
6262
6363void SfcStressForcingVars::unregisterFields () const {
64- Field::destroy (ZonalStressCell.label ());
65- Field::destroy (MeridStressCell.label ());
64+ if (Field::exists (ZonalStressCell.label ())) {
65+ Field::destroy (ZonalStressCell.label ());
66+ }
67+ if (Field::exists (MeridStressCell.label ())) {
68+ Field::destroy (MeridStressCell.label ());
69+ }
6670}
6771
6872} // namespace OMEGA
You can’t perform that action at this time.
0 commit comments