Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
SWIFT
SWIFTsim
Commits
4d85f315
Commit
4d85f315
authored
3 months ago
by
Orestis Karapiperis
Browse files
Options
Downloads
Patches
Plain Diff
Replaced Price et al. 2018 artificial resistivity with that of Hopkins 2016
parent
571ab90e
Branches
Branches containing commit
No related tags found
1 merge request
!2142
Anti-symmetric div(B) cleaning and Hopkins2016 artificial resistivity
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mhd/DirectInduction/mhd.h
+3
-1
3 additions, 1 deletion
src/mhd/DirectInduction/mhd.h
src/mhd/DirectInduction/mhd_iact.h
+44
-53
44 additions, 53 deletions
src/mhd/DirectInduction/mhd_iact.h
with
47 additions
and
54 deletions
src/mhd/DirectInduction/mhd.h
+
3
−
1
View file @
4d85f315
...
...
@@ -439,8 +439,10 @@ __attribute__((always_inline)) INLINE static void mhd_prepare_force(
}
}
const
float
alpha_AR_max
=
p
->
mhd_data
.
art_diff_beta
;
p
->
mhd_data
.
alpha_AR
=
normB
?
fminf
(
1
.
0
f
,
h
*
sqrtf
(
grad_B_mean_square
)
/
normB
)
:
0
.
0
f
;
normB
?
fminf
(
alpha_AR_max
,
h
*
sqrtf
(
grad_B_mean_square
)
/
normB
)
:
0
.
0
f
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
src/mhd/DirectInduction/mhd_iact.h
+
44
−
53
View file @
4d85f315
...
...
@@ -495,48 +495,42 @@ __attribute__((always_inline)) INLINE static void runner_iact_mhd_force(
pi
->
u_dt
-=
0
.
5
f
*
permeability_inv
*
resistive_eta_i
*
mj
*
dB_dt_pref_PR
*
dB_2
;
pj
->
u_dt
-=
0
.
5
f
*
permeability_inv
*
resistive_eta_j
*
mi
*
dB_dt_pref_PR
*
dB_2
;
/* Artificial resistivity */
const
float
art_diff_beta_i
=
pi
->
mhd_data
.
art_diff_beta
;
const
float
art_diff_beta_j
=
pj
->
mhd_data
.
art_diff_beta
;
float
dv_cross_dx
[
3
];
dv_cross_dx
[
0
]
=
dv
[
1
]
*
dx
[
2
]
-
dv
[
2
]
*
dx
[
1
];
dv_cross_dx
[
1
]
=
dv
[
2
]
*
dx
[
0
]
-
dv
[
0
]
*
dx
[
2
];
dv_cross_dx
[
2
]
=
dv
[
0
]
*
dx
[
1
]
-
dv
[
1
]
*
dx
[
0
];
const
float
v_sig_B_2
=
dv_cross_dx
[
0
]
*
dv_cross_dx
[
0
]
+
dv_cross_dx
[
1
]
*
dv_cross_dx
[
1
]
+
dv_cross_dx
[
2
]
*
dv_cross_dx
[
2
];
const
float
v_sig_B
=
sqrtf
(
v_sig_B_2
)
*
r_inv
;
const
float
art_diff_pref_i
=
0
.
5
f
*
art_diff_beta_i
*
v_sig_B
*
(
wi_dr
*
over_rho2_i
+
wj_dr
*
over_rho2_j
);
const
float
art_diff_pref_j
=
0
.
5
f
*
art_diff_beta_j
*
v_sig_B
*
(
wi_dr
*
over_rho2_i
+
wj_dr
*
over_rho2_j
);
pi
->
mhd_data
.
B_over_rho_dt
[
0
]
+=
mj
*
art_diff_pref_i
*
dB
[
0
];
pi
->
mhd_data
.
B_over_rho_dt
[
1
]
+=
mj
*
art_diff_pref_i
*
dB
[
1
];
pi
->
mhd_data
.
B_over_rho_dt
[
2
]
+=
mj
*
art_diff_pref_i
*
dB
[
2
];
pj
->
mhd_data
.
B_over_rho_dt
[
0
]
-=
mi
*
art_diff_pref_j
*
dB
[
0
];
pj
->
mhd_data
.
B_over_rho_dt
[
1
]
-=
mi
*
art_diff_pref_j
*
dB
[
1
];
pj
->
mhd_data
.
B_over_rho_dt
[
2
]
-=
mi
*
art_diff_pref_j
*
dB
[
2
];
pi
->
u_dt
-=
0
.
5
f
*
mj
*
permeability_inv
*
art_diff_pref_i
*
dB_2
;
pj
->
u_dt
-=
0
.
5
f
*
mi
*
permeability_inv
*
art_diff_pref_j
*
dB_2
;
const
float
alpha_AR
=
0
.
5
f
*
(
pi
->
mhd_data
.
alpha_AR
+
pj
->
mhd_data
.
alpha_AR
);
const
float
vsig_AR
=
0
.
5
f
*
(
pi
->
mhd_data
.
Alfven_speed
+
pj
->
mhd_data
.
Alfven_speed
);
const
float
rhoij
=
0
.
5
f
*
(
rhoi
+
rhoj
);
const
float
rhoij2
=
rhoij
*
rhoij
;
const
float
rhoij2_inv
=
1
.
0
f
/
rhoij2
;
const
float
grad_term
=
0
.
5
f
*
(
f_ij
*
wi_dr
+
f_ji
*
wj_dr
);
const
float
art_diff_pref
=
alpha_AR
*
vsig_AR
*
rhoij2_inv
*
grad_term
;
pi
->
mhd_data
.
B_over_rho_dt
[
0
]
+=
mj
*
art_diff_pref
*
dB
[
0
];
pi
->
mhd_data
.
B_over_rho_dt
[
1
]
+=
mj
*
art_diff_pref
*
dB
[
1
];
pi
->
mhd_data
.
B_over_rho_dt
[
2
]
+=
mj
*
art_diff_pref
*
dB
[
2
];
pj
->
mhd_data
.
B_over_rho_dt
[
0
]
-=
mi
*
art_diff_pref
*
dB
[
0
];
pj
->
mhd_data
.
B_over_rho_dt
[
1
]
-=
mi
*
art_diff_pref
*
dB
[
1
];
pj
->
mhd_data
.
B_over_rho_dt
[
2
]
-=
mi
*
art_diff_pref
*
dB
[
2
];
pi
->
u_dt
-=
0
.
5
f
*
mj
*
permeability_inv
*
art_diff_pref
*
dB_2
;
pj
->
u_dt
-=
0
.
5
f
*
mi
*
permeability_inv
*
art_diff_pref
*
dB_2
;
/* Store AR terms */
pi
->
mhd_data
.
B_over_rho_dt_AR
[
0
]
+=
mj
*
art_diff_pref
_i
*
dB
[
0
];
pi
->
mhd_data
.
B_over_rho_dt_AR
[
1
]
+=
mj
*
art_diff_pref
_i
*
dB
[
1
];
pi
->
mhd_data
.
B_over_rho_dt_AR
[
2
]
+=
mj
*
art_diff_pref
_i
*
dB
[
2
];
pi
->
mhd_data
.
B_over_rho_dt_AR
[
0
]
+=
mj
*
art_diff_pref
*
dB
[
0
];
pi
->
mhd_data
.
B_over_rho_dt_AR
[
1
]
+=
mj
*
art_diff_pref
*
dB
[
1
];
pi
->
mhd_data
.
B_over_rho_dt_AR
[
2
]
+=
mj
*
art_diff_pref
*
dB
[
2
];
pj
->
mhd_data
.
B_over_rho_dt_AR
[
0
]
-=
mi
*
art_diff_pref
_j
*
dB
[
0
];
pj
->
mhd_data
.
B_over_rho_dt_AR
[
1
]
-=
mi
*
art_diff_pref
_j
*
dB
[
1
];
pj
->
mhd_data
.
B_over_rho_dt_AR
[
2
]
-=
mi
*
art_diff_pref
_j
*
dB
[
2
];
pj
->
mhd_data
.
B_over_rho_dt_AR
[
0
]
-=
mi
*
art_diff_pref
*
dB
[
0
];
pj
->
mhd_data
.
B_over_rho_dt_AR
[
1
]
-=
mi
*
art_diff_pref
*
dB
[
1
];
pj
->
mhd_data
.
B_over_rho_dt_AR
[
2
]
-=
mi
*
art_diff_pref
*
dB
[
2
];
pi
->
mhd_data
.
u_dt_AR
-=
0
.
5
f
*
mj
*
permeability_inv
*
art_diff_pref
_i
*
dB_2
;
pj
->
mhd_data
.
u_dt_AR
-=
0
.
5
f
*
mi
*
permeability_inv
*
art_diff_pref
_j
*
dB_2
;
pi
->
mhd_data
.
u_dt_AR
-=
0
.
5
f
*
mj
*
permeability_inv
*
art_diff_pref
*
dB_2
;
pj
->
mhd_data
.
u_dt_AR
-=
0
.
5
f
*
mi
*
permeability_inv
*
art_diff_pref
*
dB_2
;
/* Divergence diffusion */
const
float
vsig_Dedner_i
=
0
.
5
f
*
pi
->
viscosity
.
v_sig
;
...
...
@@ -564,8 +558,8 @@ __attribute__((always_inline)) INLINE static void runner_iact_mhd_force(
pj
->
mhd_data
.
Adv_B_source
[
i
]
+=
mi
*
grad_psi
*
dx
[
i
];
pi
->
mhd_data
.
Diff_B_source
[
i
]
+=
mj
*
resistive_eta_i
*
mj
*
dB_dt_pref_PR
*
dB
[
i
];
pj
->
mhd_data
.
Diff_B_source
[
i
]
-=
mi
*
resistive_eta_j
*
mi
*
dB_dt_pref_PR
*
dB
[
i
];
pi
->
mhd_data
.
Diff_B_source
[
i
]
+=
mj
*
art_diff_pref
_i
*
dB
[
i
];
pj
->
mhd_data
.
Diff_B_source
[
i
]
-=
mi
*
art_diff_pref
_j
*
dB
[
i
];
pi
->
mhd_data
.
Diff_B_source
[
i
]
+=
mj
*
art_diff_pref
*
dB
[
i
];
pj
->
mhd_data
.
Diff_B_source
[
i
]
-=
mi
*
art_diff_pref
*
dB
[
i
];
pi
->
mhd_data
.
Delta_B
[
i
]
+=
mj
*
dB_dt_pref_Lap_i
*
wi_dr
*
dB
[
i
];
pj
->
mhd_data
.
Delta_B
[
i
]
-=
mi
*
dB_dt_pref_Lap_j
*
wj_dr
*
dB
[
i
];
}
...
...
@@ -775,21 +769,18 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_mhd_force(
pi
->
u_dt
-=
0
.
5
f
*
permeability_inv
*
resistive_eta_i
*
mj
*
dB_dt_pref_PR
*
dB_2
;
/* Artificial resistivity */
const
float
art_diff_beta
=
pi
->
mhd_data
.
art_diff_beta
;
float
dv_cross_dx
[
3
];
dv_cross_dx
[
0
]
=
dv
[
1
]
*
dx
[
2
]
-
dv
[
2
]
*
dx
[
1
];
dv_cross_dx
[
1
]
=
dv
[
2
]
*
dx
[
0
]
-
dv
[
0
]
*
dx
[
2
];
dv_cross_dx
[
2
]
=
dv
[
0
]
*
dx
[
1
]
-
dv
[
1
]
*
dx
[
0
];
const
float
v_sig_B_2
=
dv_cross_dx
[
0
]
*
dv_cross_dx
[
0
]
+
dv_cross_dx
[
1
]
*
dv_cross_dx
[
1
]
+
dv_cross_dx
[
2
]
*
dv_cross_dx
[
2
];
const
float
v_sig_B
=
sqrtf
(
v_sig_B_2
)
*
r_inv
;
const
float
art_diff_pref
=
0
.
5
f
*
art_diff_beta
*
v_sig_B
*
(
wi_dr
*
over_rho2_i
+
wj_dr
*
over_rho2_j
);
const
float
alpha_AR
=
0
.
5
f
*
(
pi
->
mhd_data
.
alpha_AR
+
pj
->
mhd_data
.
alpha_AR
);
const
float
vsig_AR
=
0
.
5
f
*
(
pi
->
mhd_data
.
Alfven_speed
+
pj
->
mhd_data
.
Alfven_speed
);
const
float
rhoij
=
0
.
5
f
*
(
rhoi
+
rhoj
);
const
float
rhoij2
=
rhoij
*
rhoij
;
const
float
rhoij2_inv
=
1
.
0
f
/
rhoij2
;
const
float
grad_term
=
0
.
5
f
*
(
f_ij
*
wi_dr
+
f_ji
*
wj_dr
);
const
float
art_diff_pref
=
alpha_AR
*
vsig_AR
*
rhoij2_inv
*
grad_term
;
pi
->
mhd_data
.
B_over_rho_dt
[
0
]
+=
mj
*
art_diff_pref
*
dB
[
0
];
pi
->
mhd_data
.
B_over_rho_dt
[
1
]
+=
mj
*
art_diff_pref
*
dB
[
1
];
pi
->
mhd_data
.
B_over_rho_dt
[
2
]
+=
mj
*
art_diff_pref
*
dB
[
2
];
...
...
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