Conversation
add parameter index and only get averaged of the variable at position index
proof of concept for creating data vectors in libelixirs which can be filled later by external applications
required in this PR, subject to change
demonstrates source terms via database
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #172 +/- ##
==========================================
+ Coverage 96.15% 96.19% +0.04%
==========================================
Files 25 26 +1
Lines 1273 1289 +16
Branches 74 74
==========================================
+ Hits 1224 1240 +16
Misses 45 45
Partials 4 4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This has not been adopted by an external application but I still like the demo. Could we include it as well? |
LibTrixi.jl/examples/libelixir_structured2d_source_terms_callback.jl
Outdated
Show resolved
Hide resolved
LibTrixi.jl/examples/libelixir_structured2d_source_terms_callback.jl
Outdated
Show resolved
Hide resolved
| void source_term_wave(const double * u, const double * x, const double t, | ||
| const double gamma, double * sourceterm) { |
There was a problem hiding this comment.
Should we pass in the length of u, x, sourceterm?
There was a problem hiding this comment.
And then check on C side before accessing the fields?
| function (callback::SourceTermsCallback)(u, x, t, equations::CompressibleEulerEquations2D) | ||
| @unpack source_term_fptr, buffer = callback | ||
| @ccall $source_term_fptr(u::Ptr{Cdouble}, x::Ptr{Cdouble}, t::Cdouble, | ||
| equations.gamma::Cdouble, buffer::Ptr{Cdouble})::Cvoid | ||
| return SVector(buffer[]) |
There was a problem hiding this comment.
Would be nice to have some documentation. Are we calling this per point? It might be better for the user if they could call it over all points. The call-overhead is small, but present.
There was a problem hiding this comment.
Both true!
Trixi.jl's approach is to evaluate per point. If you would rather like to evaluate at all points and then access the values via indices you have to redefine Trixi.jl's calc_sources!. We did this here
but it's not very elegant.
This is to demonstrate how an external function could be called to evaluate source terms.
Issues:
source_term_callbackSome rough timing results:
Timing libtrixi
Timing Trixi.jl
Confer #173