Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting runtimes for meeting #147

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 0 additions & 7 deletions .github/workflows/build_firedrake_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ jobs:

- uses: actions/checkout@v4

- name: Install system dependencies
run: |
git clone https://github.com/firedrakeproject/firedrake.git
sudo apt-get update
sudo apt-get -y install \
$(python3 ./firedrake/scripts/firedrake-configure --show-system-packages)

- name: Install PETSc
run: |
git clone https://github.com/firedrakeproject/petsc.git
Expand Down
8 changes: 8 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
coverage:
status:
project:
default:
target: auto
# adjust accordingly based on how flaky your tests are
# this allows a 1% drop from the previous base commit coverage
threshold: 1%
8 changes: 0 additions & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ exclude = .git,__pycache__
[coverage:run]
omit=*/site-packages/*,*/test/*,*/.eggs/*,/home/alexandre/firedrake/*

[codecov]
precision = 2
range = 70...100
comment_layout = diff, files
comment_behavior = default
require_changes = false
threshold = 1

[pep8]
ignore = E501,E226,E731,E741,W503
exclude = .git,__pycache__
14 changes: 11 additions & 3 deletions spyro/meshing/meshing_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,7 @@
"""
Creates a mesh based on Firedrake meshing utilities.
"""
if self.dx is None:
raise ValueError("dx is not set")
elif self.dimension == 2:
if self.dimension == 2:
return self.create_firedrake_2D_mesh()
elif self.dimension == 3:
return self.create_firedrake_3D_mesh()
Expand All @@ -287,6 +285,8 @@
"""
Creates a 2D mesh based on Firedrake meshing utilities.
"""
if self.dx is None and self.cpw is not None:
self.dx = calculate_edge_length(self.cpw, self.minimum_velocity, self.source_frequency)

Check warning on line 289 in spyro/meshing/meshing_functions.py

View check run for this annotation

Codecov / codecov/patch

spyro/meshing/meshing_functions.py#L289

Added line #L289 was not covered by tests
if self.abc_pad:
nx = int((self.length_x + 2*self.abc_pad) / self.dx)
nz = int((self.length_z + self.abc_pad) / self.dx)
Expand Down Expand Up @@ -482,6 +482,14 @@
# raise NotImplementedError("Not implemented yet")


def calculate_edge_length(cpw, minimum_velocity, frequency):
v_min = minimum_velocity

Check warning on line 486 in spyro/meshing/meshing_functions.py

View check run for this annotation

Codecov / codecov/patch

spyro/meshing/meshing_functions.py#L486

Added line #L486 was not covered by tests

lbda_min = v_min/frequency

Check warning on line 488 in spyro/meshing/meshing_functions.py

View check run for this annotation

Codecov / codecov/patch

spyro/meshing/meshing_functions.py#L488

Added line #L488 was not covered by tests

edge_length = lbda_min/cpw
return edge_length

Check warning on line 491 in spyro/meshing/meshing_functions.py

View check run for this annotation

Codecov / codecov/patch

spyro/meshing/meshing_functions.py#L490-L491

Added lines #L490 - L491 were not covered by tests

# def create_firedrake_3D_mesh_based_on_parameters(dx, cell_type):
# nx = int(self.length_x / dx)
# nz = int(self.length_z / dx)
Expand Down
2 changes: 1 addition & 1 deletion spyro/solvers/wave.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def __init__(self, dictionary=None, comm=None):

self.mesh = self.get_mesh()
self.c = None
self.sources = None
if self.mesh is not None:
self._build_function_space()
self._map_sources_and_receivers()
Expand All @@ -88,7 +89,6 @@ def __init__(self, dictionary=None, comm=None):
# Expression to define sources through UFL (less efficient)
self.source_expression = None
# Object for efficient application of sources
self.sources = None

self.field_logger = FieldLogger(self.comm, self.input_dictionary["visualization"])
self.field_logger.add_field("forward", self.get_function_name(),
Expand Down
Loading