Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
William Xu
SPINS_main
Commits
ecfdaf83
Commit
ecfdaf83
authored
Nov 06, 2017
by
David Deepwell
Browse files
Add ability to write out pressure to gravity_current.cpp
parent
1ce26451
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
src/cases/gravity_current/gravity_current.cpp
src/cases/gravity_current/gravity_current.cpp
+7
-3
No files found.
src/cases/gravity_current/gravity_current.cpp
View file @
ecfdaf83
...
@@ -63,6 +63,7 @@ bool compute_enstrophy; // Compute enstrophy?
...
@@ -63,6 +63,7 @@ bool compute_enstrophy; // Compute enstrophy?
bool
compute_dissipation
;
// Compute dissipation?
bool
compute_dissipation
;
// Compute dissipation?
bool
compute_BPE
;
// Compute background potential energy?
bool
compute_BPE
;
// Compute background potential energy?
bool
compute_internal_to_BPE
;
// Compute BPE gained from internal energy?
bool
compute_internal_to_BPE
;
// Compute BPE gained from internal energy?
bool
write_pressure
;
// Write the pressure field?
int
iter
=
0
;
// Iteration counter
int
iter
=
0
;
// Iteration counter
// Maximum squared buoyancy frequency
// Maximum squared buoyancy frequency
...
@@ -75,7 +76,7 @@ class userControl : public BaseCase {
...
@@ -75,7 +76,7 @@ class userControl : public BaseCase {
// Grid arrays
// Grid arrays
Array
<
double
,
1
>
xx
,
yy
,
zz
;
Array
<
double
,
1
>
xx
,
yy
,
zz
;
//
a
rrays and operators for derivatives
//
A
rrays and operators for derivatives
Grad
*
gradient_op
;
Grad
*
gradient_op
;
DTArray
*
temp1
;
DTArray
*
temp1
;
...
@@ -142,7 +143,7 @@ class userControl : public BaseCase {
...
@@ -142,7 +143,7 @@ class userControl : public BaseCase {
for
(
int
k
=
u
.
lbound
(
thirdDim
);
k
<=
u
.
ubound
(
thirdDim
);
k
++
)
{
for
(
int
k
=
u
.
lbound
(
thirdDim
);
k
<=
u
.
ubound
(
thirdDim
);
k
++
)
{
u
(
i
,
j
,
k
)
+=
perturb
*
rnd
.
random
();
u
(
i
,
j
,
k
)
+=
perturb
*
rnd
.
random
();
w
(
i
,
j
,
k
)
+=
perturb
*
rnd
.
random
();
w
(
i
,
j
,
k
)
+=
perturb
*
rnd
.
random
();
if
(
Ny
>
1
)
if
(
Ny
>
1
||
rot_f
!=
0
)
v
(
i
,
j
,
k
)
+=
perturb
*
rnd
.
random
();
v
(
i
,
j
,
k
)
+=
perturb
*
rnd
.
random
();
}
}
}
}
...
@@ -212,7 +213,7 @@ class userControl : public BaseCase {
...
@@ -212,7 +213,7 @@ class userControl : public BaseCase {
ke_x
=
pssum
(
sum
(
0.5
*
rho_0
*
(
u
*
u
)
*
ke_x
=
pssum
(
sum
(
0.5
*
rho_0
*
(
u
*
u
)
*
(
*
get_quad_x
())(
ii
)
*
(
*
get_quad_y
())(
jj
)
*
(
*
get_quad_z
())(
kk
)));
(
*
get_quad_x
())(
ii
)
*
(
*
get_quad_y
())(
jj
)
*
(
*
get_quad_z
())(
kk
)));
}
}
if
(
Ny
>
1
||
rot_f
!=
0
)
{
if
(
Ny
>
1
||
rot_f
!=
0
)
{
ke_y
=
pssum
(
sum
(
0.5
*
rho_0
*
(
v
*
v
)
*
ke_y
=
pssum
(
sum
(
0.5
*
rho_0
*
(
v
*
v
)
*
(
*
get_quad_x
())(
ii
)
*
(
*
get_quad_y
())(
jj
)
*
(
*
get_quad_z
())(
kk
)));
(
*
get_quad_x
())(
ii
)
*
(
*
get_quad_y
())(
jj
)
*
(
*
get_quad_z
())(
kk
)));
}
}
...
@@ -341,6 +342,8 @@ class userControl : public BaseCase {
...
@@ -341,6 +342,8 @@ class userControl : public BaseCase {
if
(
Ny
>
1
||
rot_f
!=
0
)
if
(
Ny
>
1
||
rot_f
!=
0
)
write_array
(
v
,
"v"
,
plot_number
);
write_array
(
v
,
"v"
,
plot_number
);
write_array
(
*
tracers
[
RHO
],
"rho"
,
plot_number
);
write_array
(
*
tracers
[
RHO
],
"rho"
,
plot_number
);
if
(
write_pressure
)
write_array
(
pressure
,
"p"
,
plot_number
);
// update next plot time
// update next plot time
next_plot
=
next_plot
+
plot_interval
;
next_plot
=
next_plot
+
plot_interval
;
...
@@ -461,6 +464,7 @@ int main(int argc, char ** argv) {
...
@@ -461,6 +464,7 @@ int main(int argc, char ** argv) {
add_option
(
"compute_BPE"
,
&
compute_BPE
,
true
,
"Calculate BPE?"
);
add_option
(
"compute_BPE"
,
&
compute_BPE
,
true
,
"Calculate BPE?"
);
add_option
(
"compute_internal_to_BPE"
,
&
compute_internal_to_BPE
,
true
,
add_option
(
"compute_internal_to_BPE"
,
&
compute_internal_to_BPE
,
true
,
"Calculate BPE gained from internal energy?"
);
"Calculate BPE gained from internal energy?"
);
add_option
(
"write_pressure"
,
&
write_pressure
,
false
,
"Write the pressure field?"
);
option_category
(
"Filter options"
);
option_category
(
"Filter options"
);
add_option
(
"f_cutoff"
,
&
f_cutoff
,
0.6
,
"Filter cut-off frequency"
);
add_option
(
"f_cutoff"
,
&
f_cutoff
,
0.6
,
"Filter cut-off frequency"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment