This documentation is not for the latest stable Salvus version.
# Standard Python packages
import matplotlib.pyplot as plt
import numpy as np
import os
import toml
# Salvus imports
import salvus.namespace as sn
SALVUS_FLOW_SITE_NAME = os.environ.get("SITE_NAME", "token")
mesh = sn.simple_mesh.basic_mesh.CartesianHomogeneousAcoustic2D(
x_max=4.0, y_max=6.0, vp=1000.0, rho=1000.0, max_frequency=5000.0
).create_mesh()
# We don't need any material parameters.
mesh.elemental_fields = {}
input_mesh = mesh.copy()
input_mesh.attach_field("some_field", np.random.randn(mesh.npoint))
input_mesh.map_nodal_fields_to_element_nodal()
input_mesh.write_h5("initial_values.h5")
input_mesh