Add step_1 of navier stokes
This commit is contained in:
parent
0848e7afe6
commit
17ee54abd4
8 changed files with 466 additions and 2 deletions
35
12_steps_to_navier_stokes/src/lib.rs
Normal file
35
12_steps_to_navier_stokes/src/lib.rs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
use crate::{
|
||||
step_1::{Step1Config, one_dim_solver},
|
||||
utils::plot_vectors,
|
||||
};
|
||||
|
||||
mod step_1;
|
||||
mod utils;
|
||||
|
||||
pub fn run_example_step1() {
|
||||
let u0 = vec![
|
||||
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
|
||||
2.0, 2.0, 2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
|
||||
1.0, 1.0, 1.0, 1.0, 1.0,
|
||||
];
|
||||
let nx = 41.0;
|
||||
let dx = 2.0 / (nx - 1.0);
|
||||
let dt = 0.025;
|
||||
let c = 1.0;
|
||||
|
||||
let config = Step1Config {
|
||||
c,
|
||||
dt,
|
||||
dx,
|
||||
u0,
|
||||
timesteps: 25,
|
||||
};
|
||||
let uss = one_dim_solver(config);
|
||||
|
||||
plot_vectors(
|
||||
&[uss[0].clone(), uss[12].clone(), uss[25].clone()],
|
||||
Some(&["i=0", "i=12", "i=25"]),
|
||||
"/Users/aselimov/repos/cfd_playground/12_steps_to_navier_stokes/plots/step1.svg",
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue