Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
04e3104
added GNN exp
brunozc Oct 8, 2024
6c21006
WIP: gnn
brunozc Jul 4, 2025
c06868b
Fix boundary condition and update material properties in run_scatter.py
brunozc Jul 4, 2025
fa9f7c2
merged main
brunozc Aug 21, 2025
e0cca8e
Enhance GNN functionality: update scatter function to include solver …
brunozc Feb 2, 2026
9ca9752
Update requirements.txt to include h5py version 3.15.1
brunozc Feb 2, 2026
953ea23
Refactor scatter function: remove commented-out code and update gener…
brunozc Feb 2, 2026
b545c51
Merge branch 'main' into gnn
brunozc Feb 2, 2026
96a2b73
Enhance GenerateMatrix class: add Rayleigh damping coefficients and u…
brunozc Feb 2, 2026
7480457
Merge branch 'main' into gnn
brunozc Feb 27, 2026
2fe0983
Merge branch 'main' into gnn
brunozc Feb 27, 2026
fe8dee1
Refactor run_scatter and run_scatter_gnn: update time_step values and…
brunozc Feb 27, 2026
59548e9
Bump version to 1.2.2 in setup.cfg
brunozc Feb 27, 2026
564328a
Update damping values and adjust load parameters in run_scatter_gnn
brunozc Mar 19, 2026
cd89286
Merge branch 'main' into gnn
brunozc May 12, 2026
005258e
fix: set train.use_irregularities to True for consistent behavior
brunozc May 12, 2026
57d2118
feat: integrate NewmarkExplicitGPU solver and add GNN file generation…
brunozc May 12, 2026
b282aac
fix: add write_GNN option to test configurations for consistency
brunozc May 12, 2026
415de43
fix: update solver imports and adjust file paths for GNN generation
brunozc May 15, 2026
1875788
WIP
brunozc Jun 30, 2026
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: 21 additions & 10 deletions integration_tests/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ def test_1(self):
"pickle": True,
"pickle_nodes": "all",
"VTK": False,
"VTK_binary": True}
"VTK_binary": True,
"write_GNN": False}

x = 0.1
y = 20
Expand Down Expand Up @@ -124,7 +125,8 @@ def test_2(self):
"pickle": True,
"pickle_nodes": "all",
"VTK": False,
"VTK_binary": True}
"VTK_binary": True,
"write_GNN": False}

x = 0.1
y = 20
Expand Down Expand Up @@ -186,7 +188,8 @@ def test_3(self):
"pickle": True,
"pickle_nodes": "all",
"VTK": False,
"VTK_binary": True}
"VTK_binary": True,
"write_GNN": False}

x = 0.1
y = 20
Expand Down Expand Up @@ -232,7 +235,8 @@ def test_4(self):
"pickle": True,
"pickle_nodes": "all",
"VTK": False,
"VTK_binary": True}
"VTK_binary": True,
"write_GNN": False}

x = 0.1
y = 20
Expand Down Expand Up @@ -278,7 +282,8 @@ def test_vtk(self):
"pickle": True,
"pickle_nodes": "all",
"VTK": True,
"VTK_binary": False}
"VTK_binary": False,
"write_GNN": False}

x = 0.1
y = 20
Expand Down Expand Up @@ -351,7 +356,8 @@ def test_1(self):
"pickle_nodes": "all",
"output_interval": 1,
"VTK": False,
"VTK_binary": True}
"VTK_binary": True,
"write_GNN": False}

# boundary conditions
x = 1
Expand Down Expand Up @@ -394,7 +400,8 @@ def test_2(self):
"pickle_nodes": "all",
"output_interval": 1,
"VTK": False,
"VTK_binary": True}
"VTK_binary": True,
"write_GNN": False}

# boundary conditions
x = 1
Expand Down Expand Up @@ -450,7 +457,8 @@ def test_vtk(self):
"pickle_nodes": "all",
"output_interval": 1,
"VTK": True,
"VTK_binary": False}
"VTK_binary": False,
"write_GNN": False}

# boundary conditions
x = 1
Expand Down Expand Up @@ -517,7 +525,8 @@ def test_moving_load(self):
"pickle": True,
"pickle_nodes": "all",
"VTK": True,
"VTK_binary": True}
"VTK_binary": True,
"write_GNN": False}

x = 10
y = 10
Expand Down Expand Up @@ -576,7 +585,8 @@ def test_moving_load_plane(self):
"pickle": True,
"pickle_nodes": "all",
"VTK": False,
"VTK_binary": True}
"VTK_binary": True,
"write_GNN": False}

x = 10
y = 10
Expand Down Expand Up @@ -649,6 +659,7 @@ def test_with_rose(self):
"pickle_nodes": "all",
"VTK": False,
"VTK_binary": True,
"write_GNN": False,
"output_interval": 2}

# boundary conditions
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/test_benchmark_set_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def test_heaviside_load_1d_column(self, element_type, loading_nodes, n_dim):
"pickle_nodes": [3],
"VTK": False,
"VTK_binary": True,
"write_GNN": False,
"output_interval": 10
}

Expand Down Expand Up @@ -98,7 +99,7 @@ def test_heaviside_load_1d_column(self, element_type, loading_nodes, n_dim):

# remove output directory
shutil.rmtree(output_dir)

# compare velocity with analytical solution if CHECK_RESULTS is true
if CHECK_RESULT:

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ scipy==1.16.0
tqdm==4.67.1
gstools==1.7.0
shapely==2.1.1
h5py==3.15.1
pytest==8.4.1
pytest-cov==6.2.1
tox==4.27.0
Expand Down
19 changes: 9 additions & 10 deletions run_scatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
"absorbing_BC_stiff": 1e3,
"output_interval": 1,
"pickle": True,
"pickle_nodes": "all",
"pickle_nodes": ["28"],
"VTK": False,
"VTK_binary": True,
"write_GNN": True,
}

x = 1
y = 10
z = -1
BC = {"bottom": ["020", [[0, 0, 0], [x, 0, 0], [0, 0, z], [x, 0, z]]],
BC = {"bottom": ["010", [[0, 0, 0], [x, 0, 0], [0, 0, z], [x, 0, z]]],
"left": ["100", [[0, 0, 0], [0, 0, z], [0, y, 0], [0, y, z]]],
"right": ["100", [[x, 0, 0], [x, 0, z], [x, y, 0], [x, y, z]]],
"front": ["001", [[0, 0, 0], [z, 0, 0], [0, y, 0], [x, y, 0]]],
Expand All @@ -31,10 +32,8 @@
# material dictionary: rho, E, v
mat = {"solid": {"density": 1500,
"Young": 30e6,
"poisson": 0.2},
"bottom": {"density": 1500.0,
"Young": 30e6,
"poisson": 0.2}}
"poisson": 0.2}
}

load = {"force": [0, -1000, 0],
"node": [3, 4, 7, 8],
Expand All @@ -56,9 +55,9 @@
}

# run scatter
scatter(r"./mesh/column.msh", "./results_abs_newmark", mat, BC, sett, load, time_step=0.05e-4,
scatter(r"./mesh/column.msh", "./results_abs_newmark_explicit", mat, BC, sett, load, time_step=0.05e-4,
solver=NewmarkExplicit(linear_solver=SparseDirectSolverLU(),
preconditioner=None))
scatter(r"./mesh/column.msh", "./results_abs_bathe", mat, BC, sett, load, time_step=0.05e-4,
solver=NewmarkImplicitForce(linear_solver=CGSolver(),
preconditioner=JacobiPreconditioner()))
scatter(r"./mesh/column.msh", "./results_abs_newmark_implicit", mat, BC, sett, load, time_step=0.05e-4,
solver=NewmarkImplicitForce(linear_solver=SparseDirectSolverLU(),
preconditioner=None))
76 changes: 76 additions & 0 deletions run_scatter_gnn.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
from pathlib import Path
import numpy as np
import create_geo_file
from scatter.scatter import scatter
from solvers.newmark_solver import NewmarkExplicit
from solvers.preconditioners import JacobiPreconditioner
from solvers.linear_equations_solvers import CGSolver


if __name__ == "__main__":
# computational settings
sett = {"gamma": 0.5,
"beta": 0.25,
"int_order": 2,
"damping": [1, 0.01, 80, 0.01],
"absorbing_BC": [1, 1],
"absorbing_BC_stiff": 1e3,
"pickle": True,
"pickle_nodes": "4",
"VTK": False,
"VTK_binary": True,
"output_interval": 1,
"write_GNN": True,
}


for i in range(50):
np.random.seed(i)
element_size = np.round(np.random.uniform(0.2, 1), 2)
model_size = int(np.random.uniform(5, 20))
model_depth = int(np.random.uniform(5, 20))
aniso_z = int(np.random.uniform(1, 10))
theta = np.random.uniform(1, 10)

x = model_size
y = model_depth
z = model_size

BC = {"bottom": ["010", [[0, 0, 0], [x, 0, 0], [0, 0, z], [x, 0, z]]],
"left": ["100", [[0, 0, 0], [0, 0, z], [0, y, 0], [0, y, z]]],
"right": ["200", [[x, 0, 0], [x, 0, z], [x, y, 0], [x, y, z]]],
"front": ["001", [[0, 0, 0], [z, 0, 0], [0, y, 0], [x, y, 0]]],
"back": ["002", [[0, 0, z], [x, 0, z], [0, y, z], [x, y, z]]],
}

create_geo_file.main(x, y, z, element_size, Path(f"./GNN/run_{i}"), name=f"brick")

# material dictionary: rho, E, v
mat = {"solid": {"density": 1500,
"Young": 30e6,
"poisson": 0.2},
}

load = {"force": [0, -1e6, 0],
"node": [4],
"time": 0.4,
"type": "heaviside", # pulse or heaviside or moving
"speed": 80} # only for moving

# Random field properties
RF_props = {"number_realisations": 1,
"element_size": element_size,
"theta": theta,
"seed_number": i,
"material": "solid",
"key_material": "Young",
"std_value": 50e6,
"aniso_x": 1,
"aniso_z": aniso_z,
"model_name": "Gaussian",
}

# run scatter
scatter(Path(f"./GNN/run_{i}") / "brick.msh", Path(f"GNN/run_{i}"), mat, BC, sett, load, time_step=5e-4,
solver=NewmarkExplicit(linear_solver=CGSolver(),
preconditioner=JacobiPreconditioner()), random_props=RF_props)
11 changes: 8 additions & 3 deletions run_scatter_rose_2D.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from solvers.newmark_solver import NewmarkImplicitForce
from solvers.newmark_solver import NewmarkImplicitForceGPU
from solvers.preconditioners import JacobiPreconditionerGPU
from solvers.linear_equations_solvers import CGSolverGPU

from scatter.scatter import scatter
from scatter.rose_utils import RoseUtils
Expand Down Expand Up @@ -55,7 +57,8 @@
rose_data["time_integration"]["n_t_ini"] = round(rose_data["time_integration"]["tot_ini_time"] / time_step)
rose_data["time_integration"]["n_t_calc"] = round(rose_data["time_integration"]["tot_calc_time"] / time_step)

coupled_model = RoseUtils.assign_data_to_coupled_model(rose_data, solver=NewmarkImplicitForce())
coupled_model = RoseUtils.assign_data_to_coupled_model(rose_data, solver=NewmarkImplicitForceGPU(linear_solver=CGSolverGPU(),
preconditioner=JacobiPreconditionerGPU()))

load = {"model": coupled_model,
"type": "rose",
Expand All @@ -76,4 +79,6 @@

# run scatter
scatter(r"./mesh/rose_2D_side.msh", "./results_rose_2D_side", mat, BC, sett, load, time_step=time_step,
random_props=RF_props, solver=NewmarkImplicitForce())
random_props=RF_props, solver=NewmarkImplicitForceGPU(linear_solver=CGSolverGPU(),
preconditioner=JacobiPreconditionerGPU()))

Loading
Loading