From 05cb4551085445168c047d59a3f4b280ae8e819b Mon Sep 17 00:00:00 2001 From: Magnus Ulimoen Date: Tue, 17 Aug 2021 12:42:24 +0000 Subject: [PATCH] Apply initial conditions to distributed --- multigrid/src/system.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/multigrid/src/system.rs b/multigrid/src/system.rs index dd8bcb7..016aab2 100644 --- a/multigrid/src/system.rs +++ b/multigrid/src/system.rs @@ -250,11 +250,26 @@ impl BaseSystem { let output = self.output.clone(); + let initial = self.initial_conditions.clone(); + tids.push( builder .spawn(move || { let (ny, nx) = (grid.ny(), grid.nx()); - let current = Field::new(ny, nx); + let mut current = Field::new(ny, nx); + + match &initial { + parsing::InitialConditions::Vortex(vortexparams) => { + current.vortex(grid.x(), grid.y(), time, vortexparams) + } + parsing::InitialConditions::Expressions(expr) => { + // Evaluate the expressions on all variables + let x = grid.x(); + let y = grid.y(); + let (rho, rhou, rhov, e) = current.components_mut(); + (*expr).evaluate(time, x, y, rho, rhou, rhov, e); + } + } let fut = current.clone(); let k = [ Diff::zeros((ny, nx)),