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

Method Run

examples/107_wasm/diffusion.cpp:142–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142void Solver::Run() {
143 auto sem = m.GetSem();
144 auto state = g_state;
145 auto& s = *state;
146 if (sem("init") && s.to_init_field) {
147 Init(fcu, m);
148 }
149 if (sem("flux")) {
150 for (auto f : m.Faces()) {
151 ff_flux[f] = s.velocity.dot(m.GetSurface(f));
152 }
153 }
154 if (sem()) {
155 s.to_init_field = false;
156 const Scal h = m.GetCellSize()[0];
157 s.dt = std::min(
158 0.125 * h * h / s.diffusion, 0.25 * h / s.velocity.abs().max());
159 Step(fcu, s.dt, s.diffusion, ff_flux, m);
160 Render(*g_canvas, fcu, m);
161 m.Comm(&fcu);
162 if (m.IsRoot()) {
163 s.time += s.dt;
164 ++s.step;
165 }
166 }
167}
168
169static void main_loop() {
170 auto state = g_state;

Callers 1

main_loopFunction · 0.45

Calls 12

RenderFunction · 0.85
dotMethod · 0.80
maxMethod · 0.80
absMethod · 0.80
CommMethod · 0.80
InitFunction · 0.70
StepFunction · 0.70
GetSemMethod · 0.45
FacesMethod · 0.45
GetSurfaceMethod · 0.45
GetCellSizeMethod · 0.45
IsRootMethod · 0.45

Tested by

no test coverage detected