Output along ship trackes / mooring curtains#925
Draft
JanStreffing wants to merge 2 commits into
Draft
Conversation
63b4c1f to
2935b62
Compare
Emit a 2D (depth x along-track) NetCDF curtain of any 3D node-based
FESOM field along a user-supplied polyline, at a user-supplied cadence.
Multiple tracks can run simultaneously and write to separate files.
Config (set in namelist.io's &nml_tracks block, or via XIOS XML
overrides in context_fesom.xml for XIOS-coupled runs):
ltracks master switch (default off)
track_files semicolon-separated list of CSV paths
track_vars semicolon-separated tracer per track (temp|salt)
track_names semicolon-separated names (default track1..N)
track_resolution_km densification spacing (default 5 km)
track_output_freq shared XIOS cadence ('1h', '3h', '1d', '1mo', ...)
For each track, io_tracks_register_xios runs the pipeline:
1. parse the CSV polyline vertices on rank 0
2. slerp each great-circle segment at track_resolution_km
3. MPI_MINLOC nearest-neighbour: per rank scans strictly-owned mesh
nodes; reduce picks the global owner with tie-break by lowest rank
4. collapse consecutive duplicate gids
5. build a sparse per-rank list (sorted by global position)
6. register a runtime XIOS domain (track_<name>), grid
(grid_3d_track_<name>), field (<var>_track_<name>) and a <file>
inside the shared "fesom_tracks" file_group
io_tracks_send packs the configured tracer at owned mesh nodes and
calls xios_send_field every timestep; XIOS gates the actual write at
freq_op. Output file pattern: <var>_track_<name>.fesom_<year>-<year>.nc
with shape (time, cell, nz).
Files:
src/io_tracks.F90 new module
src/io_xios.F90 xios_getvar() for the six config variables
plus io_tracks_register_xios() call before
xios_close_context_definition
src/io_meandata.F90 &nml_tracks namelist + ltracks added to
&nml_general
src/fesom_module.F90 io_tracks_send() call in the time loop
2935b62 to
a048c90
Compare
Collaborator
Author
|
Putting this on draft while reworking to be in line with tripyview logic. |
Collaborator
Author
Replaces the snap-to-nearest-mesh-node curtain sampler with a
geometry-aware pipeline ported from tripyview/sub_transect.py. For each
polyline sub-segment we find the mesh edges it crosses, then interpolate
each crossed edge's two endpoint values via V*(1-t)+V*t at the actual
intersection parameter t. Output samples lie on the line — no more
mesh-resolution-dependent zig-zag.
Changes:
* src/mod_tracks_geometry.F90 (new, ~750 LOC pure Fortran). Public
transect_t + analyse_transect: bbox + polar widening, signed-distance
line-edge intersection, alternating up/down-section path with the
triangle's edge_cross_dxdy used directly (1:2 LEFT, 3:4 RIGHT), and
cumulative great-circle distance. No MPI / XIOS deps.
* src/io_tracks.F90 rewrite around the new geometry kernel:
- rank 0 calls gather_nod/_elem/_edge to assemble the global mesh
once at init (same primitives io_mesh_info.F90 uses);
- rank 0 runs analyse_transect; result broadcast to all ranks;
- per-rank lid_n1/lid_n2 strict-own lookups built via a direct g2l
table from myList_nod2D(1:myDim_nod2D);
- sampling kernel: weighted contributions + weight-sum buffers
(both MPI_Allreduced); rescale-by-weight so wet/dry edges fall
back to the surviving endpoint instead of a half-amplitude
partial sum; NaN where neither endpoint contributes;
- per-level wet/dry mask via mesh%nlevels_nod2D(lid)-1;
- round-robin m -> rank assignment for XIOS write ownership.
* src/io_meandata.F90 / src/io_xios.F90: drop the now-meaningless
track_resolution_km knob from the namelist binding and XML override
block (sampling cadence is set by the mesh, not the user).
* src/fesom_module.F90: pass mesh to io_tracks_send (needed for the
per-level wet/dry mask).
io_xios_init's partit is now intent(inout) because the new gather path
requires it; matches the existing io_mesh_info pattern.
Verified by a 1-day CORE2 smoke run across four tracks (Atlantic->Fram
plus the three Polarstern MOSAiC ice-camp windows). Crossed-edge counts
log cleanly (242 / 187 / 60 / 24); curtains have no streaky-bottom
artifact from partial-wet edges.
Collaborator
Author
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



I wrote FESOM 2D curtain output. It works by providing a list of lat lon in a csv file. FESOM the computes the greatcircle connections. It desifies those lines and for each subsection picks the nearest neighbour fesom nodal center. Here is a first example of an track / curtained i picked with 7 coordiantes:
One year of hourly test outputs at: /work/bb1469/a270092/runtime/awiesm3-develop/test_track_11/outdata/fesom
I have only tested the output via XIOS. Not without it.