ExtremeFLOW / neko

/ᐠ. 。.ᐟ\ᵐᵉᵒʷˎˊ˗
https://neko.cfd/
Other
161 stars 29 forks source link

Simplify outputting additional .fld files #1113

Closed timofeymukha closed 6 months ago

timofeymukha commented 7 months ago

Our output works by adding additional output_t objects to the sampler_t, which sits inside the case. The output_t type is abstract, so for a new output you actually need to create a descendent. Currently, we have a fluid_output_t type, which outputs the fluid and scalar stuff, and supports putting additional fields into the resulting .fld file. For example, the lambda2 simcomp uses that and adds its field to the output.

The issue right now is that it is not easy to output some field to a seprate .fld file, because you will need to create another child type output_t for that purpose. What I propose is that we repurpose the fluid_output_t type to be a generic .fld field output. Essentially, the only thing that needs to be changed is the automatic addition of the fluid and scalar fields. This bit in the constructor has to go

    if (present(scalar)) then
       allocate(this%fluid%fields(5))
    else
       allocate(this%fluid%fields(4))
    end if

    this%fluid%fields(1)%f => fluid%p
    this%fluid%fields(2)%f => fluid%u
    this%fluid%fields(3)%f => fluid%v
    this%fluid%fields(4)%f => fluid%w

    if (present(scalar)) then
       this%fluid%fields(5)%f => scalar%s
    end if

Instead, fluid and scalar will add their fields "manually" to the sampled field list, just like lamdbda2 does right now. This way, to create a new .fld file one could use this output type and fill the field list with whatever one wants. This would incidentally also make it much more sensible that we have such an output object that sits inside the case, rather than the fluid (as the name fluid_output would hint). It will be a generic fld output bucket.

njansson commented 7 months ago

The reason for fluid_output types was to avoid circular dependencies. With the new case and solver design, maybe this is not an issue anymore

timofeymukha commented 6 months ago

fld_file_output_t resolves this. But we should keep in mind that accessing the sampler is not very easy now, you need the case. simcomps have it, but pretty much nothing else.