Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/rust
{
"name": "Rust",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/rust:2-1-bullseye"

// Use 'mounts' to make the cargo cache persistent in a Docker Volume.
// "mounts": [
// {
// "source": "devcontainer-cargo-cache-${devcontainerId}",
// "target": "/usr/local/cargo",
// "type": "volume"
// }
// ]

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "rustc --version",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Current projects are kept in branches.
## Projects I am working on

- [Seismic wave equation modeller](seismic-wave-modeller/README.md)
![Seismic wave model produced by my code](seismic-wave-modeller/output/3.gif)
![Seismic wave model produced by my code](seismic-wave-modeller/output/4.gif)

## Requirments

Expand Down
Binary file added seismic-wave-modeller/output/4.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added seismic-wave-modeller/output/4.mp4
Binary file not shown.
43 changes: 38 additions & 5 deletions seismic-wave-modeller/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ use ndarray::Array2;
use simulation::{Simulation, SimulationParams, Source};
use wavefield::Wavefield;

fn main() {
fn run() {
// Define grid
let nx = 400;
let nz = 400;
let dx = 1.0; // meters
let dz = 1.0;
let dx = 0.1; // meters
let dz = 0.1;

let grid = Grid::new(nx, nz, dx, dz);

Expand All @@ -28,9 +28,11 @@ fn main() {
let materials = MaterialProperties::new(vp, vs, rho);
let source = Source::new(nx / 2, nz / 2, 25.0);

let dt = 0.000008;
let length = 0.004;
let params = SimulationParams {
dt: 0.000008, // We'll calculate proper value later
nt: 2000,
dt: dt, // We'll calculate proper value later
nt: (length / dt) as usize,
report_period: 100,
sources: vec![source],
cfl_safety: 0.5,
Expand All @@ -44,3 +46,34 @@ fn main() {

// "ffmpeg -framerate 30 -pattern_type glob -i 'output/2/vmag_*.png' -c:v libx264 -pix_fmt yuv420p output/2.mp4");
}

fn safe_params() { //calcualtes safe simulation parameters
let nx = 100;
let nz = 100;
let dx = 0.1; // meters
let dz = 0.1;

let grid = Grid::new(nx, nz, dx, dz);

// Homogeneous material
let vp = Array2::from_elem((nx, nz), 6000.0); // 6 km/s
let vs = Array2::from_elem((nx, nz), 4000.0); // 4 km/s
let rho = Array2::from_elem((nx, nz), 3000.0); // 3 g/cm³

let materials = MaterialProperties::new(vp, vs, rho);

let cfl_safety = 0.5;
let parameters = SimulationParams {
dt: 0.0, // Placeholder
nt: 1000,
report_period: 100,
sources: vec![],
cfl_safety,
};
let dt = parameters.compute_stable_dt(dx, dz, 6000.0); // Using max velocity
println!("Calculated stable timestep: {} seconds", dt);
}

fn main() {
run();
}
Loading