Skip to content

Commit 88f7748

Browse files
authored
Merge pull request #192 from bendudson/diffusive-2d-neutrals
Allow solving in 2D/3D without neutral momentum equation
2 parents eaebbba + 4173096 commit 88f7748

File tree

2 files changed

+48
-26
lines changed

2 files changed

+48
-26
lines changed

include/neutral_mixed.hxx

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ private:
5252
BoutReal diffusion_limit; ///< Maximum diffusion coefficient
5353

5454
bool neutral_viscosity; ///< include viscosity?
55+
bool evolve_momentum; ///< Evolve parallel momentum?
5556

5657
bool precondition {true}; ///< Enable preconditioner?
5758
std::unique_ptr<Laplacian> inv; ///< Laplacian inversion used for preconditioning

src/neutral_mixed.cxx

+47-26
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,19 @@ NeutralMixed::NeutralMixed(const std::string& name, Options& alloptions, Solver*
3131
// Evolving variables e.g name is "h" or "h+"
3232
solver->add(Nn, std::string("N") + name);
3333
solver->add(Pn, std::string("P") + name);
34-
solver->add(NVn, std::string("NV") + name);
34+
35+
36+
evolve_momentum = options["evolve_momentum"]
37+
.doc("Evolve parallel neutral momentum?")
38+
.withDefault<bool>(true);
39+
40+
if (evolve_momentum) {
41+
solver->add(NVn, std::string("NV") + name);
42+
} else {
43+
output_warn.write("WARNING: Not evolving neutral parallel momentum. NVn and Vn set to zero\n");
44+
NVn = 0.0;
45+
Vn = 0.0;
46+
}
3547

3648
sheath_ydown = options["sheath_ydown"]
3749
.doc("Enable wall boundary conditions at ydown")
@@ -328,35 +340,42 @@ void NeutralMixed::finally(const Options& state) {
328340
}
329341
ddt(Nn) += Sn; // Always add density_source
330342

331-
/////////////////////////////////////////////////////
332-
// Neutral momentum
333-
TRACE("Neutral momentum");
343+
if (evolve_momentum) {
334344

335-
ddt(NVn) =
336-
-AA * FV::Div_par_fvv<hermes::Limiter>(Nnlim, Vn, sound_speed) // Momentum flow
337-
- Grad_par(Pn) // Pressure gradient
338-
+ FV::Div_a_Grad_perp(DnnNVn, logPnlim) // Perpendicular diffusion
339-
;
345+
/////////////////////////////////////////////////////
346+
// Neutral momentum
347+
TRACE("Neutral momentum");
340348

341-
if (neutral_viscosity) {
342-
// NOTE: The following viscosity terms are are not (yet) balanced
343-
// by a viscous heating term
349+
ddt(NVn) =
350+
-AA * FV::Div_par_fvv<hermes::Limiter>(Nnlim, Vn, sound_speed) // Momentum flow
351+
- Grad_par(Pn) // Pressure gradient
352+
+ FV::Div_a_Grad_perp(DnnNVn, logPnlim) // Perpendicular diffusion
353+
;
344354

345-
// Relationship between heat conduction and viscosity for neutral
346-
// gas Chapman, Cowling "The Mathematical Theory of Non-Uniform
347-
// Gases", CUP 1952 Ferziger, Kaper "Mathematical Theory of
348-
// Transport Processes in Gases", 1972
349-
// eta_n = (2. / 5) * kappa_n;
350-
//
355+
if (neutral_viscosity) {
356+
// NOTE: The following viscosity terms are are not (yet) balanced
357+
// by a viscous heating term
351358

352-
ddt(NVn) += AA * FV::Div_a_Grad_perp((2. / 5) * DnnNn, Vn) // Perpendicular viscosity
353-
+ AA * FV::Div_par_K_Grad_par((2. / 5) * DnnNn, Vn) // Parallel viscosity
354-
;
355-
}
359+
// Relationship between heat conduction and viscosity for neutral
360+
// gas Chapman, Cowling "The Mathematical Theory of Non-Uniform
361+
// Gases", CUP 1952 Ferziger, Kaper "Mathematical Theory of
362+
// Transport Processes in Gases", 1972
363+
// eta_n = (2. / 5) * kappa_n;
364+
//
365+
366+
ddt(NVn) += AA * FV::Div_a_Grad_perp((2. / 5) * DnnNn, Vn) // Perpendicular viscosity
367+
+ AA * FV::Div_par_K_Grad_par((2. / 5) * DnnNn, Vn) // Parallel viscosity
368+
;
369+
}
356370

357-
if (localstate.isSet("momentum_source")) {
358-
Snv = get<Field3D>(localstate["momentum_source"]);
359-
ddt(NVn) += Snv;
371+
if (localstate.isSet("momentum_source")) {
372+
Snv = get<Field3D>(localstate["momentum_source"]);
373+
ddt(NVn) += Snv;
374+
}
375+
376+
} else {
377+
ddt(NVn) = 0;
378+
Snv = 0;
360379
}
361380

362381
/////////////////////////////////////////////////////
@@ -533,6 +552,8 @@ void NeutralMixed::precon(const Options& state, BoutReal gamma) {
533552
inv->setCoefD(coef);
534553

535554
ddt(Nn) = inv->solve(ddt(Nn));
536-
ddt(NVn) = inv->solve(ddt(NVn));
555+
if (evolve_momentum) {
556+
ddt(NVn) = inv->solve(ddt(NVn));
557+
}
537558
ddt(Pn) = inv->solve(ddt(Pn));
538559
}

0 commit comments

Comments
 (0)