Add back tsection

This commit is contained in:
Magnus Ulimoen 2020-09-04 17:19:36 +02:00
parent aa40eb7339
commit d5b1daa413
2 changed files with 75 additions and 24 deletions

View File

@ -4,45 +4,46 @@
"operators": { "operators": {
"xi": "upwind9", "xi": "upwind9",
"eta": "upwind9" "eta": "upwind9"
} },
},
"grid0": {
"x": "linspace:-5:5:101",
"y": "linspace:0:5:50",
"boundary_conditions": { "boundary_conditions": {
"south": "multi:grid1(0,61):grid2(0,41)", "south": "vortex",
"north": "vortex", "north": "vortex",
"east": "vortex", "east": "vortex",
"west": "vortex" "west": "vortex"
} }
}, },
"grid1": { "grid0": {
"x": "linspace:-5:1:61", "x": { "linspace": { "start": -5, "end": 5, "steps": 101 } },
"y": "linspace:-5:0:50", "y": { "linspace": { "start": 0, "end": 5, "steps": 50 } },
"boundary_conditions": { "boundary_conditions": {
"south": "vortex", "south": { "multi": [{"neighbour": "grid1", "start": 0, "end": 61}, {"neighbour": "grid2", "start": 0, "end": 41}] }
"north": "multi:grid0(0,61)", }
"east": "grid2", },
"west": "vortex" "grid1": {
"x": { "linspace": { "start": -5, "end": 1, "steps": 61 } },
"y": { "linspace": { "start": -5, "end": 0, "steps": 50 } },
"boundary_conditions": {
"north": { "multi": [{"neighbour": "grid0", "start": 0, "end": 61}] },
"east": { "neighbour": "grid2" }
} }
}, },
"grid2": { "grid2": {
"x": "linspace:1:5:41", "x": { "linspace": { "start": 1, "end": 5, "steps": 41 } },
"y": "linspace:-5:0:50", "y": { "linspace": { "start": -5, "end": 0, "steps": 50 } },
"boundary_conditions": { "boundary_conditions": {
"south": "vortex", "north": { "multi": [{"neighbour": "grid0", "start": 60, "end": 101}] },
"north": "multi:grid0(60,101)", "west": { "neighbour": "grid1" }
"east": "vortex",
"west": "grid1"
} }
} }
}, },
"integration_time": 2.0, "integration_time": 2.0,
"vortex": { "vortex": {
"x0": 0.0, "vortices": [{
"y0": 0.0, "x0": 0.0,
"mach": 0.5, "y0": 0.0,
"rstar": 0.5, "rstar": 0.5,
"eps": 1.0 "eps": 1.0
}],
"mach": 0.5
} }
} }

View File

@ -106,6 +106,14 @@ pub struct Interpolate {
neighbour: String, neighbour: String,
} }
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Multi {
#[serde(alias = "neighbor")]
neighbour: String,
start: usize,
end: usize,
}
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")] #[serde(rename_all = "lowercase")]
pub enum BoundaryType { pub enum BoundaryType {
@ -114,6 +122,7 @@ pub enum BoundaryType {
#[serde(alias = "neighbor")] #[serde(alias = "neighbor")]
Neighbour(String), Neighbour(String),
Vortex, Vortex,
Multi(Vec<Multi>),
} }
pub type BoundaryDescriptors = sbp::utils::Direction<Option<BoundaryType>>; pub type BoundaryDescriptors = sbp::utils::Direction<Option<BoundaryType>>;
@ -269,6 +278,18 @@ impl Configuration {
inp.operator.unwrap().into(), inp.operator.unwrap().into(),
) )
} }
Some(BoundaryType::Multi(multi)) => {
euler::BoundaryCharacteristic::MultiGrid(
multi
.iter()
.map(|m| {
let ineighbour =
self.grids.get_index_of(&m.neighbour).unwrap();
(ineighbour, m.start, m.end)
})
.collect(),
)
}
}) })
}) })
.collect(); .collect();
@ -436,6 +457,35 @@ fn output_configuration() {
operators: None, operators: None,
}, },
); );
grids.insert(
"boundary_conditions_multigrid".to_string(),
GridConfig {
boundary_conditions: Some(BoundaryDescriptors {
north: Some(BoundaryType::Multi(vec![Multi {
neighbour: "name_of_grid".to_string(),
start: 4,
end: 7,
}])),
south: Some(BoundaryType::Multi(vec![
Multi {
neighbour: "name_of_grid".to_string(),
start: 4,
end: 7,
},
Multi {
neighbour: "name_of_grid".to_string(),
start: 41,
end: 912,
},
])),
east: None,
west: None,
}),
x: None,
y: None,
operators: None,
},
);
let configuration = Configuration { let configuration = Configuration {
grids, grids,
integration_time: 2.0, integration_time: 2.0,