Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/bout/fv_ops.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ Field3D Div_Perp_Lap(const Field3D& a, const Field3D& f, CELL_LOC outloc = CELL_
/// For FCI fields this diagnostic is currently set to zero.
template <typename CellEdges = MC>
Field3D Div_par_mod(const Field3D& f_in, const Field3D& v_in,
const Field3D& wave_speed_in, Field3D& flow_ylow,
bool fixflux = true);
const Field3D& wave_speed_in, Field3D& flow_ylow, bool fixflux = true,
bool dissipative = false);

/// This operator calculates Div_par(f v v)
/// It is used primarily (only?) in the parallel momentum equation.
Expand Down
17 changes: 16 additions & 1 deletion include/bout/fv_ops_impl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,8 @@ Field3D Div_f_v(const Field3D& n_in, const Vector3D& v, bool bndry_flux) {
/// Already includes area factor * flux
template <typename CellEdges>
Field3D Div_par_mod(const Field3D& f_in, const Field3D& v_in,
const Field3D& wave_speed_in, Field3D& flow_ylow, bool fixflux) {
const Field3D& wave_speed_in, Field3D& flow_ylow, bool fixflux,
bool dissipative) {

Coordinates* coord = f_in.getCoordinates();
ASSERT1_FIELDS_COMPATIBLE(f_in, v_in);
Expand Down Expand Up @@ -661,11 +662,25 @@ Field3D Div_par_mod(const Field3D& f_in, const Field3D& v_in,
- 0.25 * (f_in[i] + f_down[iym]) * (v_in[i] + v_down[iym])
* coord->cell_area_ylow()[i])
/ coord->cell_volume()[i];

if (dissipative) {
const BoutReal amax = BOUTMAX(fabs(wave_speed_in[i]), fabs(v_in[i]),
fabs(v_up[iyp]), fabs(v_down[iym]));
result[i] += (0.5 * amax * (f_in[i] - f_up[iyp]) * coord->cell_area_yhigh()[i]
+ 0.5 * amax * (f_in[i] - f_down[iym]) * coord->cell_area_ylow()[i])
/ coord->cell_volume()[i];
}
}
return result;
}
ASSERT1_FIELDS_COMPATIBLE(f_in, wave_speed_in);

// Throw error when not Fci
if (dissipative) {
throw BoutException("Using dissipative flag in Div_par_mod but no Fci parallel "
"transform. This flag will have no impact on the simulation");
}

const Mesh* mesh = f_in.getMesh();

CellEdges cellboundary;
Expand Down
5 changes: 3 additions & 2 deletions manual/sphinx/user_docs/differential_operators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -586,13 +586,14 @@ than ``FV::Div_par`` for the same limiter choice.
template<typename CellEdges = MC>
Field3D Div_par_mod(const Field3D &f_in, const Field3D &v_in,
const Field3D &a, Field3D &flow_ylow,
bool fixflux=true);
bool fixflux=true, bool dissipative=false);


The extra output argument ``flow_ylow`` stores the flow through the lower
:math:`y` cell boundary, including the area factor. This can be useful as a
diagnostic in energy or flux budgets. For FCI fields this diagnostic is
currently returned as zero.
currently returned as zero. The flag ``dissipative`` activates a local
Rusanov-flux if used in Fci.


Parallel momentum flux ``Div_par_fvv``
Expand Down
14 changes: 7 additions & 7 deletions src/mesh/fv_ops.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ template Field3D Div_par<Upwind>(const Field3D& f_in, const Field3D& v_in,
template Field3D Div_f_v<Upwind>(const Field3D& n_in, const Vector3D& v, bool bndry_flux);
template Field3D Div_par_mod<Upwind>(const Field3D& f_in, const Field3D& v_in,
const Field3D& wave_speed_in, Field3D& flow_ylow,
bool fixflux);
bool fixflux, bool dissipative);
template Field3D Div_par_fvv_heating<Upwind>(const Field3D& f_in, const Field3D& v_in,
const Field3D& wave_speed_in,
Field3D& flow_ylow, bool fixflux);
Expand All @@ -592,7 +592,7 @@ template Field3D Div_par<Fromm>(const Field3D& f_in, const Field3D& v_in,
template Field3D Div_f_v<Fromm>(const Field3D& n_in, const Vector3D& v, bool bndry_flux);
template Field3D Div_par_mod<Fromm>(const Field3D& f_in, const Field3D& v_in,
const Field3D& wave_speed_in, Field3D& flow_ylow,
bool fixflux);
bool fixflux, bool dissipative);
template Field3D Div_par_fvv_heating<Fromm>(const Field3D& f_in, const Field3D& v_in,
const Field3D& wave_speed_in,
Field3D& flow_ylow, bool fixflux);
Expand All @@ -606,7 +606,7 @@ template Field3D Div_par<MinMod>(const Field3D& f_in, const Field3D& v_in,
template Field3D Div_f_v<MinMod>(const Field3D& n_in, const Vector3D& v, bool bndry_flux);
template Field3D Div_par_mod<MinMod>(const Field3D& f_in, const Field3D& v_in,
const Field3D& wave_speed_in, Field3D& flow_ylow,
bool fixflux);
bool fixflux, bool dissipative);
template Field3D Div_par_fvv_heating<MinMod>(const Field3D& f_in, const Field3D& v_in,
const Field3D& wave_speed_in,
Field3D& flow_ylow, bool fixflux);
Expand All @@ -620,7 +620,7 @@ template Field3D Div_par<MC>(const Field3D& f_in, const Field3D& v_in,
template Field3D Div_f_v<MC>(const Field3D& n_in, const Vector3D& v, bool bndry_flux);
template Field3D Div_par_mod<MC>(const Field3D& f_in, const Field3D& v_in,
const Field3D& wave_speed_in, Field3D& flow_ylow,
bool fixflux);
bool fixflux, bool dissipative);
template Field3D Div_par_fvv_heating<MC>(const Field3D& f_in, const Field3D& v_in,
const Field3D& wave_speed_in, Field3D& flow_ylow,
bool fixflux);
Expand All @@ -635,7 +635,7 @@ template Field3D Div_f_v<Superbee>(const Field3D& n_in, const Vector3D& v,
bool bndry_flux);
template Field3D Div_par_mod<Superbee>(const Field3D& f_in, const Field3D& v_in,
const Field3D& wave_speed_in, Field3D& flow_ylow,
bool fixflux);
bool fixflux, bool dissipative);
template Field3D Div_par_fvv_heating<Superbee>(const Field3D& f_in, const Field3D& v_in,
const Field3D& wave_speed_in,
Field3D& flow_ylow, bool fixflux);
Expand All @@ -650,7 +650,7 @@ template Field3D Div_f_v<VanAlbada>(const Field3D& n_in, const Vector3D& v,
bool bndry_flux);
template Field3D Div_par_mod<VanAlbada>(const Field3D& f_in, const Field3D& v_in,
const Field3D& wave_speed_in, Field3D& flow_ylow,
bool fixflux);
bool fixflux, bool dissipative);
template Field3D Div_par_fvv_heating<VanAlbada>(const Field3D& f_in, const Field3D& v_in,
const Field3D& wave_speed_in,
Field3D& flow_ylow, bool fixflux);
Expand All @@ -664,7 +664,7 @@ template Field3D Div_par<WENO3>(const Field3D& f_in, const Field3D& v_in,
template Field3D Div_f_v<WENO3>(const Field3D& n_in, const Vector3D& v, bool bndry_flux);
template Field3D Div_par_mod<WENO3>(const Field3D& f_in, const Field3D& v_in,
const Field3D& wave_speed_in, Field3D& flow_ylow,
bool fixflux);
bool fixflux, bool dissipative);
template Field3D Div_par_fvv_heating<WENO3>(const Field3D& f_in, const Field3D& v_in,
const Field3D& wave_speed_in,
Field3D& flow_ylow, bool fixflux);
Expand Down
Loading