Skip to content

Commit

Permalink
Merge pull request #383 from PrincetonUniversity/issue-369
Browse files Browse the repository at this point in the history
Issue 369 - Adds homework 9 from JT's class
  • Loading branch information
lsawade authored Jan 15, 2025
2 parents 5a91bdc + 0b5d3e3 commit f22674a
Show file tree
Hide file tree
Showing 18 changed files with 688 additions and 3 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ target_link_libraries(
add_library(
source_time_function
src/source_time_function/dirac.cpp
src/source_time_function/dgaussian.cpp
src/source_time_function/ricker.cpp
src/source_time_function/external.cpp
)
Expand Down
19 changes: 19 additions & 0 deletions docs/source_description/source_discription.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ Force Source Description

**Description** : Definition of Ricker source :ref:`ricker_source_description`

**Parameter Name** : ``sources.force.dGaussian`` [optional]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**dafault value** : None

**possible values** : [YAML Node]

**Description** : Definition of first derivative of a Gaussian time function :ref:`dgaussian_source_description`


**Parameter Name** : ``sources.force.External`` [optional]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -156,6 +166,15 @@ Moment Tensor Source Description

**Description** : Definition of Ricker source :ref:`ricker_source_description`

**Parameter Name** : ``sources.moment-tensor.dGaussian`` [optional]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**dafault value** : None

**possible values** : [YAML Node]

**Description** : Definition of first derivative Gaussian time function :ref:`dgaussian_source_description`

**Parameter Name** : ``sources.moment-tensor.External`` [optional]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
50 changes: 50 additions & 0 deletions docs/source_description/source_time_function_description.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,56 @@ Ricker Source Time Function Description
tshift: 0.0
f0: 1.0
.. _dgaussian_source_description:

Gaussian Derivative Source Time Function Description
=======================================

**Parameter Name** : ``dGaussian``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**dafault value** : None

**possible values** : [YAML Node]

**Description** : Definition of first derivative of a Gaussian source time function

**Parameter Name** : ``dGaussian.factor``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**dafault value** : None

**possible values** : [float]

**Description** : Scaling factor for first derivative of a Gaussian time function

**Parameter Name** : ``dGaussian.tshift``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**dafault value** : 0.0

**possible values** : [float]

**Description** : Time shift for first derivative of a Gaussian time function

**Parameter Name** : ``dGaussian.f0``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**dafault value** : None

**possible values** : [float]

**Description** : Central frequency for first derivative of a Gaussian time function

.. admonition:: Example

.. code-block:: yaml
dGaussian:
factor: 1e10
tshift: 0.0
f0: 1.0
.. _external_source_description:

External Source Time Function Description
Expand Down
3 changes: 2 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ cmake_minimum_required(VERSION 3.17.5)

add_subdirectory(homogeneous-medium-flat-topography)
add_subdirectory(fluid-solid-interface)
add_subdirectory(Tromp_2005)
add_subdirectory(fluid-solid-bathymetry)
add_subdirectory(solid-solid-interface)
add_subdirectory(Tromp_2005)
139 changes: 139 additions & 0 deletions examples/solid-solid-interface/CMakeFiles/Par_File.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
#-----------------------------------------------------------
#
# Simulation input parameters
#
#-----------------------------------------------------------

# title of job
title = Flat fluid/solid interface

# parameters concerning partitioning
NPROC = 1 # number of processes

# Output folder to store mesh related files
OUTPUT_FILES = @CMAKE_SOURCE_DIR@/examples/solid-solid-interface/OUTPUT_FILES

#-----------------------------------------------------------
#
# Mesh
#
#-----------------------------------------------------------

# Partitioning algorithm for decompose_mesh
PARTITIONING_TYPE = 3 # SCOTCH = 3, ascending order (very bad idea) = 1

# number of control nodes per element (4 or 9)
NGNOD = 9

# location to store the mesh
database_filename = @CMAKE_SOURCE_DIR@/examples/solid-solid-interface/OUTPUT_FILES/database.bin

#-----------------------------------------------------------
#
# Receivers
#
#-----------------------------------------------------------

# use an existing STATION file found in ./DATA or create a new one from the receiver positions below in this Par_file
use_existing_STATIONS = .false.

# number of receiver sets (i.e. number of receiver lines to create below)
nreceiversets = 1

# orientation
anglerec = 0.d0 # angle to rotate components at receivers
rec_normal_to_surface = .false. # base anglerec normal to surface (external mesh and curve file needed)

# first receiver set (repeat these 6 lines and adjust nreceiversets accordingly)
nrec = 1 # number of receivers
xdeb = 150000.d0 # first receiver x in meters
zdeb = 80000.d0 # first receiver z in meters
xfin = 150000.d0 # last receiver x in meters (ignored if only one receiver)
zfin = 3480000.d0 # last receiver z in meters (ignored if only one receiver)
record_at_surface_same_vertical = .false. # receivers inside the medium or at the surface

# filename to store stations file
stations_filename = @CMAKE_SOURCE_DIR@/examples/solid-solid-interface/OUTPUT_FILES/STATIONS

#-----------------------------------------------------------
#
# Velocity and density models
#
#-----------------------------------------------------------

# number of model materials
nbmodels = 2
# available material types (see user manual for more information)
# acoustic: model_number 1 rho Vp 0 0 0 QKappa Qmu 0 0 0 0 0 0
# elastic: model_number 1 rho Vp Vs 0 0 QKappa Qmu 0 0 0 0 0 0
# anistoropic: model_number 2 rho c11 c13 c15 c33 c35 c55 c12 c23 c25 0 0 0
# poroelastic: model_number 3 rhos rhof phi c kxx kxz kzz Ks Kf Kfr etaf mufr Qmu
# tomo: model_number -1 0 9999 9999 A 0 0 9999 9999 0 0 0 0 0
#
# The problem values are as follows:
# top: rho = 2.60 * 10^3 kg/m3, kappa= 5.2 * 10^10 Pa, mu =2.66 * 10^10 Pa
# bottom: rho = 3.38 * 10^3 kg/m3, kappa= 1.3 * 10^11 Pa, mu = 6.8 * 10^10 Pa
# After conversion to VP/VS we have following model values.
1 1 3380.d0 8079.98d0 4485.35d0 0 0 9999 9999 0 0 0 0 0 0
2 1 2600.d0 5859.90d0 3199.40d0 0 0 9999 9999 0 0 0 0 0 0

# external tomography file
TOMOGRAPHY_FILE = ./DATA/tomo_file.xyz

# use an external mesh created by an external meshing tool or use the internal mesher
read_external_mesh = .false.

#-----------------------------------------------------------
#
# PARAMETERS FOR EXTERNAL MESHING
#
#-----------------------------------------------------------

# data concerning mesh, when generated using third-party app (more info in README)
# (see also absorbing_conditions above)
mesh_file = ./DATA/Mesh_canyon/canyon_mesh_file # file containing the mesh
nodes_coords_file = ./DATA/Mesh_canyon/canyon_nodes_coords_file # file containing the nodes coordinates
materials_file = ./DATA/Mesh_canyon/canyon_materials_file # file containing the material number for each element
free_surface_file = ./DATA/Mesh_canyon/canyon_free_surface_file # file containing the free surface
axial_elements_file = ./DATA/axial_elements_file # file containing the axial elements if AXISYM is true
absorbing_surface_file = ./DATA/Mesh_canyon/canyon_absorbing_surface_file # file containing the absorbing surface
acoustic_forcing_surface_file = ./DATA/MSH/Surf_acforcing_Bottom_enforcing_mesh # file containing the acoustic forcing surface
absorbing_cpml_file = ./DATA/absorbing_cpml_file # file containing the CPML element numbers
tangential_detection_curve_file = ./DATA/courbe_eros_nodes # file containing the curve delimiting the velocity model

#-----------------------------------------------------------
#
# PARAMETERS FOR INTERNAL MESHING
#
#-----------------------------------------------------------

# file containing interfaces for internal mesh
interfacesfile = @CMAKE_SOURCE_DIR@/examples/solid-solid-interface/topography.dat

# geometry of the model (origin lower-left corner = 0,0) and mesh description
xmin = 0.d0 # abscissa of left side of the model
xmax = 200000.d0 # abscissa of right side of the model
nx = 188 # number of elements along X

STACEY_ABSORBING_CONDITIONS = .true.

# absorbing boundary parameters (see absorbing_conditions above)
absorbbottom = .true.
absorbright = .true.
absorbtop = .false.
absorbleft = .true.

# define the different regions of the model in the (nx,nz) spectral-element mesh
nbregions = 2 # then set below the different regions and model number for each region
1 188 1 38 1
1 188 39 76 2

#-----------------------------------------------------------
#
# Display parameters
#
#-----------------------------------------------------------

# meshing output
output_grid_Gnuplot = .false. # generate a GNUPLOT file containing the grid, and a script to plot it
output_grid_ASCII = .false. # dump the grid in an ASCII text file consisting of a set of X,Y,Z points or not
54 changes: 54 additions & 0 deletions examples/solid-solid-interface/CMakeFiles/specfem_config.yaml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
## Coupling interfaces have code flow that is dependent on orientation of the interface.
## This test is to check the code flow for horizontal acoustic-elastic interface with acoustic domain on top.

parameters:

header:
## Header information is used for logging. It is good practice to give your simulations explicit names
title: Heterogeneous elastic-elastic medium with 1 elastic-elastic interface (orientation horizontal) # name for your simulation
# A detailed description for your simulation
description: |
Material systems : Elastic domain (1), Elastic domain (1)
Interfaces : Elastic-elastic interface (1) (orientation horizontal slower medium on top)
Sources : Force source (1)
Boundary conditions : Neumann BCs on all edges
Debugging comments: This tests checks coupling elastic-elastic interface implementation.
The orientation of the interface is horizontal with elastic domain on top.

simulation-setup:
## quadrature setup
quadrature:
quadrature-type: GLL4

## Solver setup
solver:
time-marching:
type-of-simulation: forward
time-scheme:
type: Newmark
dt: 5.0e-3
nstep: 10000

simulation-mode:
forward:
writer:
seismogram:
format: ascii
directory: "@CMAKE_SOURCE_DIR@/examples/solid-solid-interface/OUTPUT_FILES/results"

receivers:
stations-file: "@CMAKE_SOURCE_DIR@/examples/solid-solid-interface/OUTPUT_FILES/STATIONS"
angle: 0.0
seismogram-type:
- displacement
nstep_between_samples: 1

## Runtime setup
run-setup:
number-of-processors: 1
number-of-runs: 1

## databases
databases:
mesh-database: "@CMAKE_SOURCE_DIR@/examples/solid-solid-interface/OUTPUT_FILES/database.bin"
source-file: "@CMAKE_SOURCE_DIR@/examples/solid-solid-interface/sources.yaml"
5 changes: 5 additions & 0 deletions examples/solid-solid-interface/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

CMAKE_MINIMUM_REQUIRED(VERSION 3.17.5)

configure_file(CMakeFiles/specfem_config.yaml.in ${CMAKE_SOURCE_DIR}/examples/solid-solid-interface/specfem_config.yaml)
configure_file(CMakeFiles/Par_File.in ${CMAKE_SOURCE_DIR}/examples/solid-solid-interface/Par_File)
48 changes: 48 additions & 0 deletions examples/solid-solid-interface/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Wave propagration through solid-solid interface

This example is for a solid-solid simulation that is often used in Jeroen
Tromp's Computational Seismology course at Princeton University.

For a step-by-step guide on this example, please refer to the
[documentation](https://specfem2d-kokkos.readthedocs.io/en/latest/cookbooks/dim2/solid-solid-interface/index.html).

## Running the examples

To run the examples, you first need to install poetry following these
[instructions](https://python-poetry.org/docs/#installation). Once you've done
so, you can install the dependencies for the examples by running the following
command in the current directory:

```bash
# verify poetry is installed
poetry --version

# install dependencies
poetry install

```

After installing the dependencies, you can run the examples by running the
following command within the example directory you want to run:

```bash

# run the example
poetry run snakemake -j 1

# or to run the example on a slurm cluster
poetry run snakemake --executor slurm -j 1

```

## Cleaning up

To clean up the example directory, you can run the following command in the
directory of the example you want to clean up:

```bash

# clean up the example
poetry run snakemake clean

```
Loading

0 comments on commit f22674a

Please sign in to comment.