-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into issue459_oasis_oce…
…an_coupling
- Loading branch information
Showing
134 changed files
with
8,758 additions
and
3,844 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/*! | ||
* @file DevStep.cpp | ||
* | ||
* @date Jan 12, 2022 | ||
* @date 2 Jul 2024 | ||
* @author Tim Spain <[email protected]> | ||
*/ | ||
|
||
|
@@ -26,7 +26,13 @@ void DevStep::init() | |
tryConfigure(ido); | ||
} | ||
|
||
void DevStep::start(const TimePoint& startTime) { lastOutput = startTime; } | ||
void DevStep::start(const TimePoint& startTime) | ||
{ | ||
// Set the last output time for the restart files to the model start time | ||
lastOutput = startTime; | ||
// Set the model start time for the diagnostic output files | ||
Module::getImplementation<IDiagnosticOutput>().setModelStart(startTime); | ||
} | ||
|
||
void DevStep::iterate(const TimestepTime& tst) | ||
{ | ||
|
@@ -36,11 +42,12 @@ void DevStep::iterate(const TimestepTime& tst) | |
mData->incrementTime(tst.step); | ||
if ((m_restartPeriod.seconds() > 0) && (mData->time() >= lastOutput + m_restartPeriod)) { | ||
std::string currentFileName = mData->time().format(m_restartFileName); | ||
pData->writeRestartFile(currentFileName); | ||
pData->writeRestartFile(currentFileName, *mData); | ||
lastOutput = mData->time(); | ||
} | ||
// XIOS wants all the fields, every timestep, so I guess that's what everyone gets | ||
ModelState overallState = pData->getStateRecursive(true); | ||
OutputSpec os; // The default OutputSpec is all fields, but only cell average values | ||
ModelState overallState = pData->getStateRecursive(os); | ||
overallState.merge(ConfiguredModule::getAllModuleConfigurations()); | ||
Module::getImplementation<IDiagnosticOutput>().outputState(*mData); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
/*! | ||
* @file MissingData.cpp | ||
* | ||
* @date Jun 14, 2022 | ||
* @date Jul 17, 2024 | ||
* @author Tim Spain <[email protected]> | ||
* @author Einar Ólason <[email protected]> | ||
*/ | ||
|
||
#include "include/MissingData.hpp" | ||
|
||
namespace Nextsim { | ||
|
||
const double MissingData::defaultValue = -0x1p300; | ||
const double MissingData::defaultValue = 1.7e38; | ||
double MissingData::value = MissingData::defaultValue; | ||
|
||
} /* namespace Nextsim */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
/*! | ||
* @file PrognosticData.cpp | ||
* | ||
* @date 7 Sep 2023 | ||
* @date 1 Jul 2024 | ||
* @author Tim Spain <[email protected]> | ||
* @author Einar Ólason <[email protected]> | ||
*/ | ||
|
||
#include "include/PrognosticData.hpp" | ||
|
@@ -19,6 +20,7 @@ PrognosticData::PrognosticData() | |
, m_conc(ModelArray::Type::H) | ||
, m_snow(ModelArray::Type::H) | ||
, m_tice(ModelArray::Type::Z) | ||
, m_damage(ModelArray::Type::H) | ||
, pAtmBdy(0) | ||
, pOcnBdy(0) | ||
, pDynamics(0) | ||
|
@@ -58,12 +60,12 @@ void PrognosticData::setData(const ModelState::DataMap& ms) | |
m_conc = ms.at("cice"); | ||
m_tice = ms.at("tice"); | ||
m_snow = ms.at("hsnow"); | ||
// Damage is an optional field, and defaults to zero, if absent | ||
// Damage is an optional field, and defaults to 1, if absent | ||
if (ms.count(damageName) > 0) { | ||
m_damage = ms.at(damageName); | ||
} else { | ||
m_damage.resize(); | ||
m_damage = 0.5; | ||
m_damage = 1.; | ||
} | ||
|
||
pAtmBdy->setData(ms); | ||
|
@@ -113,10 +115,14 @@ void PrognosticData::updatePrognosticFields() | |
m_damage.setData(damageUpd); | ||
} | ||
|
||
// Gets all of the prognostic data, including that in the dynamics | ||
ModelState PrognosticData::getState() const | ||
{ | ||
ModelArrayRef<Protected::SST> sst(getStore()); | ||
ModelArrayRef<Protected::SSS> sss(getStore()); | ||
|
||
// Get the prognostic data from the dynamics, including the full dynamics state | ||
ModelState dynamicsState = pDynamics->getState(); | ||
// clang-format off | ||
ModelState localState = { { | ||
{ "mask", ModelArray(oceanMask()) }, // make a copy | ||
|
@@ -129,27 +135,33 @@ ModelState PrognosticData::getState() const | |
}, | ||
{} }; | ||
// clang-format on | ||
// Get the state from the dynamics (ice velocity). This allows the | ||
// dynamics to define its own dimensions for the velocity grid. | ||
localState.merge(pDynamics->getState()); | ||
|
||
// Merge in the damage field, if the dynamics uses it. | ||
if (pDynamics->usesDamage()) { | ||
ModelState damageState = { { | ||
{ "damage", mask(m_damage) }, | ||
}, | ||
{} }; | ||
localState.merge(damageState); | ||
} | ||
return localState; | ||
|
||
// Use the dynamics values of any duplicated fields | ||
ModelState state(dynamicsState); | ||
state.merge(localState); | ||
|
||
return state; | ||
} | ||
|
||
// Recursively gets the data from all subcomponents | ||
ModelState PrognosticData::getStateRecursive(const OutputSpec& os) const | ||
{ | ||
ModelState state(getState()); | ||
state.merge(pAtmBdy->getStateRecursive(os)); | ||
state.merge(iceGrowth.getStateRecursive(os)); | ||
state.merge(pDynamics->getStateRecursive(os)); | ||
ModelState state; | ||
/* If allComponents is set on the OutputSpec, then for any duplicate fields, the subsystems | ||
* take priority, otherwise the fields held by PrognosticData itself. Note that std::map::merge | ||
* will not overwrite existing keys, so the first one that exists will survive. | ||
*/ | ||
if (os.allComponents()) { | ||
state.merge(pAtmBdy->getStateRecursive(os)); | ||
state.merge(iceGrowth.getStateRecursive(os)); | ||
state.merge(pDynamics->getStateRecursive(os)); | ||
state.merge(getState()); | ||
} else { | ||
state.merge(getState()); | ||
state.merge(pAtmBdy->getStateRecursive(os)); | ||
state.merge(iceGrowth.getStateRecursive(os)); | ||
state.merge(pDynamics->getStateRecursive(os)); | ||
} | ||
// OceanBoundary does not contribute to the output model state | ||
return os ? state : ModelState(); | ||
} | ||
|
Oops, something went wrong.