Skip to content
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

Add TableDataSavingCallback #602

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

LasNikas
Copy link
Collaborator

This is to save table data only for a specific time range save_interval.
The rows in the table are the function values and the columns are the evaluations.

hydrostatic_water_column_2d.jl with the following extra_callback

interpolated_density(v, u, t, system) = nothing
function interpolated_density(v, u, t, system::TrixiParticles.FluidSystem)
    n_particles_xy = round(Int, 1.0 / system.initial_condition.particle_spacing)

    values = interpolate_line([0.5, 0.0], [0.5, 1.0], n_particles_xy, semi, system,
                              v, u; endpoint=true, cut_off_bnd=true)

    return values.density
end

pos = collect(LinRange(0.0, 1.0, round(Int, 1.0 / fluid_particle_spacing)))

extra_callback = TableDataSavingCallback(; dt=0.02, save_interval=10, 
                                         start_at=0.90, # condition is `true` if `t >= start_at` 
                                         axis_ticks=Dict(interpolated_density => pos),
                                         interpolated_density=interpolated_density)

The plot shows the density evaluated at every dt starting at time t=0.9

image

Copy link

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 0% with 106 lines in your changes missing coverage. Please review.

Project coverage is 68.52%. Comparing base (c565f67) to head (6bb8c9e).

Files Patch % Lines
src/callbacks/data_saving.jl 0.00% 104 Missing ⚠️
src/callbacks/post_process.jl 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #602      +/-   ##
==========================================
- Coverage   69.92%   68.52%   -1.40%     
==========================================
  Files          86       87       +1     
  Lines        5120     5224     +104     
==========================================
  Hits         3580     3580              
- Misses       1540     1644     +104     
Flag Coverage Δ
unit 68.52% <0.00%> (-1.40%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant