File field3d.cxx#

Class for 3D X-Y-Z scalar fields

Copyright 2010 B.D.Dudson, S.Farley, M.V.Umansky, X.Q.Xu

Contact: Ben Dudson, bd512@york.ac.uk

This file is part of BOUT++.

BOUT++ is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

BOUT++ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with BOUT++. If not, see http://www.gnu.org/licenses/.

Functions

Field3D operator-(const Field3D &f)#

Unary minus. Returns the negative of given field, iterates over whole domain including guard/boundary cells.

Field3D pow(const Field3D &lhs, const Field2D &rhs, const std::string &rgn)#

Exponent: pow(lhs, lhs) is lhs raised to the power of rhs

Extra overloads not provided by the templates in field.hxx

This loops over the entire domain, including guard/boundary cells by default (can be changed using the rgn argument). If CHECK >= 3 then the result will be checked for non-finite numbers

FieldPerp pow(const Field3D &lhs, const FieldPerp &rhs, const std::string &rgn)#
Field3D filter(const Field3D &var, int N0, const std::string &rgn)#

Fourier filtering, removes all except one mode

Parameters:
  • var[in] Variable to apply filter to

  • N0[in] The component to keep

  • rgn[in] The region to calculate the result over

Field3D lowPass(const Field3D &var, int zmax, bool keep_zonal, const std::string &rgn)#

Fourier low pass filtering. Removes modes higher than zmax and optionally the zonal component

Parameters:
  • var[in] Variable to apply filter to

  • zmax[in] Maximum mode in Z

  • keep_zonal[in] Keep the zonal component if true

  • rgn[in] The region to calculate the result over

void shiftZ(Field3D &var, int jx, int jy, double zangle)#

Perform a shift by a given angle in Z

Parameters:
  • var[inout] The variable to be modified in-place

  • jx[in] X index

  • jy[in] Y index

  • zangle[in] The Z angle to apply

void shiftZ(Field3D &var, double zangle, const std::string &rgn)#

Apply a phase shift by a given angle zangle in Z to all points

Parameters:
  • var[inout] The variable to modify in-place

  • zangle[in] The angle to shift by in Z

  • rgn[in] The region to calculate the result over

void checkData(const Field3D &f, const std::string &region)#

Throw an exception if f is not allocated or if any elements are non-finite (for CHECK > 2). Loops over all points including the boundaries by default (can be changed using the rgn argument

Field2D DC(const Field3D &f, const std::string &rgn)#

Average in the Z direction

Parameters:
  • f[in] Variable to average

  • rgn[in] The region to calculate the result over

void invalidateGuards(Field3D &var)#

Force guard cells of passed field var to NaN.

bool operator==(const Field3D &a, const Field3D &b)#

Test if two fields are the same, by calculating the minimum absolute difference between them

std::ostream &operator<<(std::ostream &out, const Field3D &value)#

Output a string describing a Field3D to a stream.

void swap(Field3D &first, Field3D &second) noexcept#