%matplotlib inline
# This notebook will use this variable to determine which
# remote site to run on.
import os
SALVUS_FLOW_SITE_NAME = os.environ.get("SITE_NAME", "local")
PROJECT_DIR = "project"
import pathlib
import numpy as np
import salvus.namespace as sn
print("Opening existing project.")
p = sn.Project(path=PROJECT_DIR)
Opening existing project.
simulation_3
, but with volumetric output.
In addition to displacement, let's also output the spatial gradient of the displacement field, so we can compute derived quantities like the divergence or curl afterwards.output_folder = p.simulations.get_simulation_output_directory(
simulation_configuration="simulation_3", event=p.events.list()[0]
)
if not pathlib.Path(output_folder, "volume_data_output.h5").exists():
p.simulations.delete_results(
simulation_configuration="simulation_3", events=p.events.list()[0]
)
[2023-03-17 19:42:00,474] INFO: Removing contents of `project/EVENTS/event_0/WAVEFORM_DATA/INTERNAL/55/11/abcfd69ba132`.
p.simulations.launch(
ranks_per_job=2,
site_name=SALVUS_FLOW_SITE_NAME,
events=p.events.list(),
simulation_configuration="simulation_3",
extra_output_configuration={
"volume_data": {
"sampling_interval_in_time_steps": 10,
"fields": ["displacement", "gradient-of-displacement"],
},
},
)
[2023-03-17 19:42:00,533] INFO: Submitting job ... Uploading 1 files... 🚀 Submitted [email protected]local_cuda
1
query_simulations()
as below.p.simulations.query(block=True)
True
p.simulations.get_simulation_output_directory(
simulation_configuration="simulation_3", event=p.events.list()[0]
)
PosixPath('project/EVENTS/event_0/WAVEFORM_DATA/INTERNAL/55/11/abcfd69ba132')
# Uncomment the next line and paste the path from above
# !ls _paste_the_path_above_here
volume_data_output_elastic_volume.xdmf
is what we are after. It is this .xdmf file that should be opened in Paraview. When you do open such a file, you should see a dialogue box to select the correct reader. Make sure to select the XDMF Reader
and not any of the Xdmf3Reader
or Paraview will crash immediately :-/event_1
with newly defined source(s) and receivers.site_name
and the ranks_per_job
in the launch
function and Salvus will take care about the rest.