Add control to fld output from a field list#2300
Add control to fld output from a field list#2300timofeymukha wants to merge 13 commits intoExtremeFLOW:developfrom
Conversation
|
Also adds a test! |
|
Was this discussed in the development meeting? |
Yes, @timofeymukha will investigate a bit if we can make the default just a list of scalars. |
|
How are we doing with this? Would it be possible to add a |
Would that not be setting the fld file as an IC rather than a "restart" |
Yes basically, but we need to take care of properly setting the controllers and simcomps to start from the time stamp of the fld file, as done in for the chkp files in simulation.f90: ! Restart the output controller
call C%output_controller%set_counter(C%time)
! Restart the simulation components
call neko_simcomps%restart(C%time)And because the restart section and the initial condition sections are very separated in case.f90 and simulation.f90, instead of having them communicate in strange ways i though why not just load the IC as usual in case.f90, and in simulation check for the presence of a flag in the JSON that says we want to set the fld time stamp as the simulation initialization time (note, different from |
I guess I do not understand why you want to transform the fld format into another way to restart when we already have HDF5 and CHKP restart files. Especially if it would not be accurate anyway, then I would not disguise the fact that it is indeed not a restart, but just starting the simulation with previous state as an initial condition. |
|
@vbaconnet I've been waiting for Adalberto's fld_file changes to get in (they are now) to return to this. Haven't touched it yet! |
My bad. I will sort things out on that one today. It is not in, as far as I see :D |
Oh right, I thought it was merged :-)! |
|
@vbaconnet @adperezm I changed the default to skip everything, and added overrides to all _output types besides the basic fld_file_output. So, fluid and all stats, basically. I think it works as expected. But maybe I missed something? |
vbaconnet
left a comment
There was a problem hiding this comment.
Nice!
Did you test the fluid_stats? Even though it doesn't look like your tests you added cover the other output types, I believe there is no reason it shouldn't work. But in my experience, especially since this IO stuff fails at runtime most of the time, I would give it a try on the cylinder example or whatever (if you haven't already :)). I guess if those work it would be safe to assume the other types of stats would work (?).
There was a problem hiding this comment.
Pull request overview
Adds configurable mapping/omission of standard NEKTON fld “slots” (P/U/T) when writing field_list_t/field_t, by introducing skip flags on fld_file_t and centralizing the list→slot mapping logic.
Changes:
- Extend
fld_file_twithskip_pressure/skip_velocity/skip_temperatureand refactor field-list mapping intofld_file_select_from_field_list. - Update several output writers to explicitly set skip flags before writing.
- Add an integration test suite (Fortran user module + pytest) to validate generated
rdcodefor selected skip-flag combinations.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/io/fld_file.f90 |
Adds skip flags and refactors mapping logic for field_list_t/field_t writes. |
src/io/fluid_output.f90 |
Forces skip flags off before writing fluid outputs. |
src/io/fluid_stats_output.f90 |
Imports fld_file_t and forces skip flags off after init_base. |
src/io/fluid_sgs_stats_output.f90 |
Same as above for SGS fluid stats output. |
src/io/scalar_stats_output.f90 |
Same as above for scalar stats output. |
src/io/scalar_sgs_stats_output.f90 |
Same as above for SGS scalar stats output. |
src/io/mean_field_output.f90 |
Same as above for mean-field output. |
tests/integration/tests/test_fld_file/test_fld_file.py |
New pytest integration tests that read fld headers and assert expected rdcode. |
tests/integration/tests/test_fld_file/test_fld_file.f90 |
New user module to drive fld writing with skip flags. |
tests/integration/tests/test_fld_file/test_fld_file.json |
Base case config used by the new integration tests. |
tests/integration/tests/test_fld_file/clean.sh |
Cleanup helper for generated outputs/artifacts. |
tests/integration/tests/test_fld_file/.gitignore |
Ignores generated per-case JSON files. |
src/.depends |
Updates build deps to include io/fld_file.lo where fld_file_t is referenced. |
| from os.path import join | ||
| from testlib import get_neko, run_neko, configure_nprocs, get_makeneko | ||
| import subprocess | ||
| import numpy as np | ||
| import json | ||
| import os |
|
Reviving this before it gets forgotten :) We talked about it last week during the dev meeting but I forgot what you said. Where you going to work more on this? |
Sorry, yes, I was going to do as you said, run some cylinder and check that it works. But I am constantly diverted to other stuff :))). |
|
No problem. I'm interested in this as well so if you want some backup please ping and I can try to test as well. |
Would be much appreciated if you have the time! |
This adds components to the fld_file_t, which can be set to skip certain fields in the output when writing a passed field_list_t or field_t.
For example, setting skip_pressure to true, will make the solver skip writing into the p field. I stress that this is about the fields in the sense of "parts of the fld file", not in any physical sense; we simply adjust the mapping between the item number in the field_list_t to the locations in the fld file.
The mechanism is not used anywhere now, but it will allow us to adjust things if we decide to. It also provides this additional freedom to be used in the user file.
I isolated the logic into a subroutine,so that I can reuse it for field_t by creating a dummpy list with 1 field.