Skip to content
Snippets Groups Projects
Commit 5d356d98 authored by Malte Nyhuis's avatar Malte Nyhuis
Browse files

final gci implementation

parent 9b87beb8
No related branches found
No related tags found
1 merge request!10Merge recent changes in master to we_ahrens
......@@ -34,7 +34,7 @@ def getGCI(N1, N2, N3, fc1, fc2, fc3, D, Fs=1.25):
epsilon21 = (fc2 - fc1)
x0 = np.log(epsilon32 / epsilon21) / np.log(r21)
p = calcp(x0, Fs, N1, N2, N3, fc1, fc2, fc3, D)
p = calcp(x0, 1, N1, N2, N3, fc1, fc2, fc3, D)
GCI_1 = Fs * abs((epsilon21 / fc1)) * 1 / ((r21 ** p) - 1)
GCI_2 = Fs * abs((epsilon32 / fc2)) * 1 / ((r32 ** p) - 1)
......@@ -62,6 +62,20 @@ def getGCI(N1, N2, N3, fc1, fc2, fc3, D, Fs=1.25):
EERE_2_p1 = abs((f_extra_p1 - fc2) / f_extra_p1)
EERE_3_p1 = abs((f_extra_p1 - fc3) / f_extra_p1)
text = ""
text += f'{"GCI_1": <16} {GCI_1}\n'
text += f'{"GCI_2": <16} {GCI_2}\n'
text += f'{"GCI_3": <16} {GCI_3}\n'
text += f'{"EERE_1": <16} {EERE_1}\n'
text += f'{"EERE_2": <16} {EERE_2}\n'
text += f'{"EERE_3": <16} {EERE_3}\n'
text += f'{"GCI_1_p1": <16} {GCI_1_p1}\n'
text += f'{"GCI_2_p1": <16} {GCI_2_p1}\n'
text += f'{"GCI_3_p1": <16} {GCI_3_p1}\n'
text += f'{"EERE_1_p1": <16} {EERE_1_p1}\n'
text += f'{"EERE_2_p1": <16} {EERE_2_p1}\n'
text += f'{"EERE_3_p1": <16} {EERE_3_p1}\n'
print(text)
return GCI_1, GCI_2, GCI_3
# return [GCI_1, GCI_2, GCI_3], [EERE_1, EERE_2, EERE_3], [GCI_1_p1, GCI_2_p1, GCI_3_p1], \
# [EERE_1_p1, EERE_2_p1, EERE_3_p1]
def test_getgci():
# todo FILL
from ntrfc.meshquality.grid_convergece_index import getGCI
from ntrfc.meshquality.grid_convergece_index import getGCI
import numpy as np
#
fc3 = 23.263
fc2 = 23.165
fc1 = 23.151
......@@ -9,7 +10,12 @@ def test_getgci():
N3 = 18576
N2 = 74304
N1 = 297216
Fs = 1.25
D = 2
GCI_1, GCI_2, GCI_3 = getGCI(N1, N2, N3, fc1, fc2, fc3, D, Fs=1.25)
assert np.isclose(GCI_1,0.0001259844787122061), "GCI_1 computation does not seem to be correct"
assert np.isclose(GCI_2,0.0008813583711057829), "GCI_3 computation does not seem to be correct"
assert np.isclose(GCI_3,0.0061695085977409286), "GCI_3 computation does not seem to be correct"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment