-
Notifications
You must be signed in to change notification settings - Fork 19
Issue 878 CG ice velocity components #879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
e2d0db3
to
f5b9fba
Compare
122ac08
to
e9ac003
Compare
I had a look at the failing test and it looks like one of the MPI tests gets stuck in an infinite loop. I ran it locally and I get the same behaviour. I will see if I can find out why |
ModelArray::Dimension dim = entry.first; | ||
size_t dimSz = (dimCompMap.count(dim)) ? ModelArray::nComponents(dimCompMap.at(dim)) | ||
: dimSz = entry.second.globalLength; | ||
: dimSz = entry.second.localLength; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
found it 😓
localLength
should be globalLength
. This part sets the total dimension of the array ready to be written to file. Only the portion of ModelArray will actually be written, but netcdf parallel needs to know the total size so it can write to the correct portion.
: dimSz = entry.second.localLength; | |
: dimSz = entry.second.globalLength; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested locally and this fixes the issue with the test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made this change because a 1 day example run was failing with the following error message. Making the change to localLength
let the file writing finish correctly.
2010-01-01T23:45:00Z
libc++abi: terminating due to uncaught exception of type netCDF::exceptions::NcEdge: NetCDF: Start+count exceeds dimension bound
file: /tmp/netcdf-cxx-20250303-65682-ahp603/netcdf-cxx4-4.3.1/cxx4/ncVar.cpp line:1049
Abort trap: 6
e9ac003
to
c316c4c
Compare
c316c4c
to
6d846b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I just have a query about TODO notes and a minor suggested refactoring.
ModelArray data(ModelArray::Type::H); | ||
DGVector<DGadvection> utmp(*smesh); | ||
Nextsim::Interpolations::CG2DG(*smesh, utmp, u); | ||
return DGModelArray::dg2ma(utmp, data); | ||
} else if (name == vName) { | ||
ModelArray data(ModelArray::Type::V); | ||
ModelArray data(ModelArray::Type::H); | ||
DGVector<DGadvection> vtmp(*smesh); | ||
Nextsim::Interpolations::CG2DG(*smesh, vtmp, v); | ||
return DGModelArray::dg2ma(vtmp, data); | ||
} else if (name == uIOStressName) { | ||
ModelArray data(ModelArray::Type::U); | ||
ModelArray data(ModelArray::Type::H); | ||
DGVector<DGadvection> utmp(*smesh); | ||
Nextsim::Interpolations::CG2DG(*smesh, utmp, uIceOceanStress); | ||
return DGModelArray::dg2ma(utmp, data); | ||
} else if (name == vIOStressName) { | ||
ModelArray data(ModelArray::Type::V); | ||
ModelArray data(ModelArray::Type::H); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could now hoist the declaration out of the conditional block to avoid duplication.
const ModelArray::MultiDim cgDims = kernel.getCGDimensions(); | ||
/* If the u is Type::CG and the dimensions read from the restart file do | ||
* not match those of the CG dynamics kernel, throw an exception. | ||
* TODO: Support interpolation between different CG number of Gauss points. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this TODO for this PR or for a future one?
CG ice velocity components
Fixes #878
Change Description
When passing a
ModelArray
to thema2cg()
function, the operations that are performed depends on theModelArray::Type
. AnHField
is converted to aDGVector
and then interpolated to aCGVector
. ADGField
will only be interpolated to aCGVector
. ACGField
will be directly copied into theCGVector
.Adds a
getCGData()
function toCGDynamicsKernel
which will return the full CG array of the ice velocity components. These are then passed to the data maps collected as part of thegetDataPrognostic()
call tree.Set the size of the
ModelArray::Dimension
sXCG
andYCG
to values derived from theCGdegree
value and the size of a DG0 (Type::H
)ModelArray
.Since the ice velocities are so completely removed from the thermodynamics/physics part of the model (that is where
ModelArray
is used), remove the specialModelArray
types for U and V.Test Description
init_25km_NH.nc
for 1 TS. Let the resulting restart file be 'file 1'.init_25km_NH.nc
for 1 day. Let the resulting restart file be 'file 2'.