Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pyTurbulence
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bilocq Amaury
pyTurbulence
Commits
a949652c
Verified
Commit
a949652c
authored
1 month ago
by
Bilocq Amaury
Browse files
Options
Downloads
Patches
Plain Diff
Split TKE contributions
parent
4a9300b8
Branches
master
Branches containing commit
Tags
v3057
No related merge requests found
Pipeline
#53362
passed
1 month ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pyTurbulence/solver.py
+11
-7
11 additions, 7 deletions
pyTurbulence/solver.py
pyTurbulence/spectrum.py
+2
-2
2 additions, 2 deletions
pyTurbulence/spectrum.py
with
13 additions
and
9 deletions
pyTurbulence/solver.py
+
11
−
7
View file @
a949652c
...
@@ -55,15 +55,15 @@ def solve(user_params)->dict:
...
@@ -55,15 +55,15 @@ def solve(user_params)->dict:
# Compute additional parameters
# Compute additional parameters
mean_density
=
mean_pressure
/
mean_temperature
mean_density
=
mean_pressure
/
mean_temperature
celerity
=
np
.
sqrt
(
gamma
*
mean_pressure
/
mean_density
)
celerity
=
np
.
sqrt
(
gamma
*
mean_pressure
/
mean_density
)
Ek
=
0.5
*
(
Mt
*
celerity
)
**
2
TKE_expected
=
0.5
*
(
Mt
*
celerity
)
**
2
urms
=
np
.
sqrt
(
2.
*
Ek
/
3.
)
urms
=
np
.
sqrt
(
2.
*
TKE_expected
/
3.
)
# Generate the solenoidal velocity field
# Generate the solenoidal velocity field
start
=
time
.
time
()
start
=
time
.
time
()
us
,
vs
,
ws
,
wmax
=
compute_solenoidal_velocities
(
spectrum
,
nbModes
,
urms
,
us
,
vs
,
ws
,
wmax
=
compute_solenoidal_velocities
(
spectrum
,
nbModes
,
urms
,
k0
,
domain_size
,
k0
,
domain_size
,
domain_resolution
)
domain_resolution
)
TKE
=
np
.
mean
(
0.5
*
(
us
.
reshape
(
-
1
)
**
2
+
vs
.
reshape
(
-
1
)
**
2
+
ws
.
reshape
(
-
1
)
**
2
))
TKE
_solenoidal
=
np
.
mean
(
0.5
*
(
us
.
reshape
(
-
1
)
**
2
+
vs
.
reshape
(
-
1
)
**
2
+
ws
.
reshape
(
-
1
)
**
2
))
end
=
time
.
time
()
end
=
time
.
time
()
solenoidal_time
=
end
-
start
solenoidal_time
=
end
-
start
...
@@ -92,6 +92,9 @@ def solve(user_params)->dict:
...
@@ -92,6 +92,9 @@ def solve(user_params)->dict:
ud
,
vd
,
wd
,
ud
,
vd
,
wd
,
incompressible_pressure_fluctuations
,
incompressible_pressure_fluctuations
,
gamma
,
Mt
,
params
[
"
case
"
])
gamma
,
Mt
,
params
[
"
case
"
])
TKE_total
=
np
.
mean
(
0.5
*
(
u
.
reshape
(
-
1
)
**
2
+
v
.
reshape
(
-
1
)
**
2
+
w
.
reshape
(
-
1
)
**
2
))
TKE_dilatational
=
TKE_total
-
TKE_solenoidal
TKE
=
[
TKE_solenoidal
,
TKE_dilatational
,
TKE_total
,
TKE_expected
]
end
=
time
.
time
()
end
=
time
.
time
()
thermodynamic_time
=
end
-
start
thermodynamic_time
=
end
-
start
...
@@ -133,7 +136,6 @@ def solve(user_params)->dict:
...
@@ -133,7 +136,6 @@ def solve(user_params)->dict:
results
=
{
results
=
{
"
TKE
"
:
TKE
,
"
TKE
"
:
TKE
,
"
Ek
"
:
Ek
,
"
solenoidal_time
"
:
solenoidal_time
,
"
solenoidal_time
"
:
solenoidal_time
,
"
pressure_time
"
:
pressure_time
,
"
pressure_time
"
:
pressure_time
,
"
dilatational_time
"
:
dilatational_time
,
"
dilatational_time
"
:
dilatational_time
,
...
@@ -225,7 +227,7 @@ def _validate_params(params) -> dict:
...
@@ -225,7 +227,7 @@ def _validate_params(params) -> dict:
"
Pressure
"
:
(
0
,
None
),
# Pressure must be positive
"
Pressure
"
:
(
0
,
None
),
# Pressure must be positive
"
Temperature
"
:
(
0
,
None
),
# Temperature must be positive
"
Temperature
"
:
(
0
,
None
),
# Temperature must be positive
"
k0
"
:
(
1
,
None
),
# Characteristic wavenumber must be >= 1
"
k0
"
:
(
1
,
None
),
# Characteristic wavenumber must be >= 1
"
gamma
"
:
(
0
,
None
)
,
# Heat capacity ratio is typically between 1 and 2
"
gamma
"
:
(
0
,
None
)
# Heat capacity ratio is typically between 1 and 2
}
}
validated_params
=
default_params
.
copy
()
validated_params
=
default_params
.
copy
()
...
@@ -321,8 +323,10 @@ def _write_log_file(params, results):
...
@@ -321,8 +323,10 @@ def _write_log_file(params, results):
f
.
write
(
f
"
{
'
Plotting the spectrum
'
:
<
50
}
{
results
[
'
spectrum_time
'
]
:
>
20.4
f
}
\n
"
)
f
.
write
(
f
"
{
'
Plotting the spectrum
'
:
<
50
}
{
results
[
'
spectrum_time
'
]
:
>
20.4
f
}
\n
"
)
f
.
write
(
f
"
{
'
Saving the data
'
:
<
50
}
{
results
[
'
save_time
'
]
:
>
20.4
f
}
\n
"
)
f
.
write
(
f
"
{
'
Saving the data
'
:
<
50
}
{
results
[
'
save_time
'
]
:
>
20.4
f
}
\n
"
)
f
.
write
(
f
"
{
'
-
'
*
70
}
\n
"
)
f
.
write
(
f
"
{
'
-
'
*
70
}
\n
"
)
f
.
write
(
f
"
{
'
Total TKE
'
:
<
50
}
{
results
[
'
TKE
'
]
:
>
20.4
f
}
\n
"
)
f
.
write
(
f
"
{
'
Solenoidal TKE
'
:
<
50
}
{
results
[
'
TKE
'
][
0
]
:
>
20.4
f
}
\n
"
)
f
.
write
(
f
"
{
'
Expected TKE
'
:
<
50
}
{
results
[
'
Ek
'
]
:
>
20.4
f
}
\n
"
)
f
.
write
(
f
"
{
'
Dilatational TKE
'
:
<
50
}
{
results
[
'
TKE
'
][
1
]
:
>
20.4
f
}
\n
"
)
f
.
write
(
f
"
{
'
Total TKE
'
:
<
50
}
{
results
[
'
TKE
'
][
2
]
:
>
20.4
f
}
\n
"
)
f
.
write
(
f
"
{
'
Expected TKE
'
:
<
50
}
{
results
[
'
TKE
'
][
3
]
:
>
20.4
f
}
\n
"
)
f
.
write
(
f
"
{
'
=
'
*
70
}
\n
"
)
f
.
write
(
f
"
{
'
=
'
*
70
}
\n
"
)
# Print log to console
# Print log to console
...
...
This diff is collapsed.
Click to expand it.
pyTurbulence/spectrum.py
+
2
−
2
View file @
a949652c
...
@@ -60,8 +60,8 @@ def compute_tke_spectrum(u : np.ndarray,v : np.ndarray,w : np.ndarray,
...
@@ -60,8 +60,8 @@ def compute_tke_spectrum(u : np.ndarray,v : np.ndarray,w : np.ndarray,
# --- Size
# --- Size
n0
,
n1
,
n2
=
u
.
shape
n0
,
n1
,
n2
=
u
.
shape
L
=
[
lx
,
ly
,
lz
]
L
=
[
lx
,
ly
,
lz
]
oneOverN
=
1.
/
(
n0
*
n1
*
n2
)
oneOverN
=
1.
/
(
n0
*
n1
*
n2
)
# --- FFT
# --- FFT
fourier_u
=
np
.
fft
.
fftn
(
u
)
*
oneOverN
fourier_u
=
np
.
fft
.
fftn
(
u
)
*
oneOverN
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment