MCPcopy Create free account
hub / github.com/cselab/aphros / Step

Function Step

examples/107_wasm/diffusion.cpp:105–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105static void Step(
106 FieldCell<Scal>& fcu, Scal dt, Scal diffusion,
107 const FieldFace<Scal>& ff_flux, const M& m) {
108 using UEB = UEmbed<M>;
109 const auto ffg = UEB::Gradient(fcu, {}, m);
110 const auto fcg = UEB::AverageGradient(ffg, m);
111 auto ffu = UEB::InterpolateUpwind(fcu, {}, ConvSc::superbee, fcg, ff_flux, m);
112
113 for (auto c : m.CellsM()) {
114 Scal sum = 0;
115 for (auto q : m.Nci(c)) {
116 auto f = c.face(q);
117 sum += diffusion * ffg[f] * c.outward_factor(q) * f.area;
118 sum -= ff_flux[f] * ffu[f] * c.outward_factor(q);
119 }
120 fcu[c] += dt * sum / c.volume;
121 }
122}
123
124static void Render(Canvas& canvas, const FieldCell<Scal>& fcu, const M& m) {
125 const auto msize = m.GetGlobalSize();

Callers 1

RunMethod · 0.70

Calls 5

GradientFunction · 0.50
CellsMMethod · 0.45
NciMethod · 0.45
faceMethod · 0.45
outward_factorMethod · 0.45

Tested by

no test coverage detected