-
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
joewallwork
left a comment
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?
|
@timspainNERSC I have had a more detailed look and I think the underlying problem is that the They should be These get read in here in nextsimdg/core/src/ParaGridIO.cpp Lines 81 to 137 in ca3dddb
The
Note the function nextsimdg/core/src/ParaGridIO.cpp Lines 266 to 267 in ca3dddb
I think this logic needs to be re-written to use the Let me know what you think. I can try and implement a fix if you want. |
CG ice velocity components
Fixes #878
Change Description
When passing a
ModelArrayto thema2cg()function, the operations that are performed depends on theModelArray::Type. AnHFieldis converted to aDGVectorand then interpolated to aCGVector. ADGFieldwill only be interpolated to aCGVector. ACGFieldwill be directly copied into theCGVector.Adds a
getCGData()function toCGDynamicsKernelwhich 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::DimensionsXCGandYCGto values derived from theCGdegreevalue 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
ModelArrayis used), remove the specialModelArraytypes for U and V.Test Description
init_25km_NH.ncfor 1 TS. Let the resulting restart file be 'file 1'.init_25km_NH.ncfor 1 day. Let the resulting restart file be 'file 2'.