Skip to content

Commit

Permalink
Minor cleaning
Browse files Browse the repository at this point in the history
Just sorting out and gathering some output strings.
  • Loading branch information
einola committed Aug 29, 2024
1 parent b9d2da5 commit be7905d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ if (ENABLE_OASIS)
target_link_libraries(nextsimlib PUBLIC oasis.cbind mct mpeu psmile.MPI1 scrip netcdff)

This comment has been minimized.

Copy link
@andreapiacentini

andreapiacentini Sep 9, 2024

Please in the target_link_libraries at line 158, add netcdf (single f) after netcdff
and, in order to avoid ambiguity if more than one netcdf is installed, insert before line 157
target_link_directories(nextsimlib PUBLIC ${NETCDF_LIBRARY_DIRS})

target_include_directories(nextsimlib PRIVATE ${OASIS_INCLUDES})
else ()
message(FATAL_ERROR "Not building with OASIS support, because MPI is not enabled" .)
message(FATAL_ERROR "Cannot build with OASIS support, because MPI is not enabled" .)
endif ()
endif ()

Expand Down
2 changes: 2 additions & 0 deletions physics/src/include/OASISCoupled.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class OASISCoupled {
~OASISCoupled() { OASIS_CHECK_ERR(!oasis_c_terminate()); }
#else
~OASISCoupled() { }
const std::string OASISError
= "Cannot access OASIS interface, as OASIS support was not activated at compile time.\n";
#endif

virtual std::string getName() const { return "OASISCoupled"; }
Expand Down
16 changes: 7 additions & 9 deletions physics/src/modules/OceanBoundaryModule/OASISCoupledOcean.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* @file OASISCoupledOcean.cpp
*
* @date Sep 26, 2022
* @date 27 Aug 2024
* @author Tim Spain <[email protected]>
* @author Einar Ólason <[email protected]>
*/
Expand Down Expand Up @@ -40,8 +40,7 @@ void OASISCoupledOcean::setMetadata(const ModelMetadata& metadata)
// OASIS finalising definition
OASIS_CHECK_ERR(oasis_c_enddef());
#else
std::string message = __func__ + std::string(": OASIS support not compiled in.\n");
throw std::runtime_error(message);
throw std::runtime_error(std::string(__func__) + ": " + OASISError);
#endif
}

Expand Down Expand Up @@ -87,8 +86,7 @@ void OASISCoupledOcean::updateBefore(const TimestepTime& tst)
Module::getImplementation<IIceOceanHeatFlux>().update(tst);

#else
std::string message = __func__ + std::string(": OASIS support not compiled in.\n");
throw std::runtime_error(message);
throw std::runtime_error(std::string(__func__) + ": " + OASISError);
#endif
}

Expand All @@ -110,7 +108,7 @@ void OASISCoupledOcean::updateAfter(const TimestepTime& tst)
OASIS_DOUBLE, OASIS_COL_MAJOR, &dummy[0], OASIS_No_Restart, &kinfo));

OASIS_CHECK_ERR(oasis_c_put(couplingId.at(EMPKey), OASISTime, dimension0, dimension1, 1,
OASIS_DOUBLE, OASIS_COL_MAJOR, &dummy[0], OASIS_No_Restart, &kinfo));
OASIS_DOUBLE, OASIS_COL_MAJOR, &emp[0], OASIS_No_Restart, &kinfo));

OASIS_CHECK_ERR(oasis_c_put(couplingId.at(QSWKey), OASISTime, dimension0, dimension1, 1,
OASIS_DOUBLE, OASIS_COL_MAJOR, &dummy[0], OASIS_No_Restart, &kinfo));
Expand All @@ -130,8 +128,7 @@ void OASISCoupledOcean::updateAfter(const TimestepTime& tst)
// Increment the "OASIS" time by the number of seconds in the time step
updateOASISTime(tst);
#else
std::string message = __func__ + std::string(": OASIS support not compiled in.\n");
throw std::runtime_error(message);
throw std::runtime_error(std::string(__func__) + ": " + OASISError);
#endif
}

Expand Down Expand Up @@ -177,7 +174,8 @@ OASISCoupledOcean::HelpMap& OASISCoupledOcean::getHelpText(HelpMap& map, bool ge
{ SSHConfigKey, ConfigType::STRING, {}, SSHKeyDefault, "",
"The field name for sea surface height used in namcouple" },
{ MLDConfigKey, ConfigType::STRING, {}, MLDKeyDefault, "",
"The field name for the thickness of the first ocean layer in namcouple (if that's defined)." },
"The field name for the thickness of the first ocean layer in namcouple (if that's "
"defined)." },
{ TauXConfigKey, ConfigType::STRING, {}, TauXKeyDefault, "",
"The field name for the x-component of ice-ocean stress in namcouple." },
{ TauYConfigKey, ConfigType::STRING, {}, TauYKeyDefault, "",
Expand Down

0 comments on commit be7905d

Please sign in to comment.