-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from uwoseis/windtunnel
Merge in current changes from branch 'windtunnel'
- Loading branch information
Showing
18 changed files
with
1,112 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import unittest | ||
import numpy as np | ||
from anemoi import SimpleSource, StackedSimpleSource, SparseKaiserSource, KaiserSource | ||
|
||
class TestSources(unittest.TestCase): | ||
|
||
@staticmethod | ||
def elementNorm(arr): | ||
return np.sqrt((arr.conj()*arr).sum()) / arr.size | ||
|
||
def setUp(self): | ||
pass | ||
|
||
def test_cleanExecution(self): | ||
|
||
systemConfig = { | ||
'nx': 100, | ||
'nz': 100, | ||
} | ||
|
||
loc = np.array([[50.,50.],[25.,25.], [80.,80.], [25.,80.]]) | ||
|
||
ss = SimpleSource(systemConfig) | ||
sss = SimpleSource(systemConfig) | ||
sks = SparseKaiserSource(systemConfig) | ||
ks = KaiserSource(systemConfig) | ||
|
||
qss = ss(loc) | ||
qsss = sss(loc) | ||
qsks = sks(loc) | ||
qks = ks(loc) | ||
|
||
def test_KaiserSource(self): | ||
|
||
systemConfig = { | ||
'nx': 100, | ||
'nz': 100, | ||
} | ||
|
||
loc = np.array([[50.,50.],[25.,25.], [80.,80.], [25.,80.]]) | ||
|
||
sks = SparseKaiserSource(systemConfig) | ||
ks = KaiserSource(systemConfig) | ||
|
||
qsks = sks(loc) | ||
qks = ks(loc) | ||
|
||
self.assertTrue(self.elementNorm(qsks.toarray() - qks) == 0.) | ||
|
||
def test_KaiserSourceSimpleCase(self): | ||
|
||
systemConfig = { | ||
'nx': 100, | ||
'nz': 100, | ||
'dx': 1., # NB: This will not generally be true, | ||
'dz': 1., # but the scaleTerm in KS is 1/(dx*dz). | ||
} | ||
|
||
loc = np.array([[50.,50.],[25.,25.], [80.,80.], [25.,80.]]) | ||
|
||
ss = SimpleSource(systemConfig) | ||
ks = KaiserSource(systemConfig) | ||
|
||
qss = ss(loc) | ||
qks = ks(loc) | ||
|
||
self.assertTrue(self.elementNorm(qks - qss) < 1e-10) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
|
||
from .analytical import AnalyticalHelmholtz | ||
from .discretization import BaseDiscretization, DiscretizationWrapper, MultiFreq | ||
from .minizephyr import MiniZephyr, MiniZephyr25D | ||
from .eurus import Eurus | ||
from .source import SimpleSource, StackedSimpleSource | ||
from .source import BaseSource, SimpleSource, StackedSimpleSource, KaiserSource, SparseKaiserSource, FakeSource | ||
from .meta import BaseModelDependent, BaseSCCache, AttributeMapper, SCFilter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.