blob: 73ebad34ba029e4d00dae5c7279877ffd860fe09 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/* Copyright 2019-2020 Yinjian Zhao
*
* This file is part of WarpX.
*
* License: BSD-3-Clause-LBNL
*/
#ifndef WARPX_DIAGNOSTICS_REDUCEDDIAGS_FIELDENERGY_H_
#define WARPX_DIAGNOSTICS_REDUCEDDIAGS_FIELDENERGY_H_
#include "ReducedDiags.H"
#include <AMReX_MultiFab.H>
#include <string>
/**
* This class mainly contains a function that
* computes the field energy.
*/
class FieldEnergy : public ReducedDiags
{
public:
/**
* constructor
* @param[in] rd_name reduced diags names
*/
FieldEnergy(std::string rd_name);
/**
* This function computes the field energy (EF):
* EF = sum( 1/2 * (|E|^2 * eps0 + |B|^2 / mu0) * dV ),
* where E is the electric field, B is the magnetic field,
* eps0 is the vacuum permittivity, mu0 is the vacuum permeability,
* dV is the cell volume (area, in 2D) and the sum is over all cells.
*
* @param[in] step current time step
*/
virtual void ComputeDiags(int step) override final;
/**
* \brief Calculate the integral of the field squared in RZ
*
* \param field The MultiFab to be integrated
* \param lev The refinement level
* \return The integral
*/
amrex::Real ComputeNorm2RZ(const amrex::MultiFab& field, int lev);
};
#endif
|