feec.polar.examples.maxwell_2d#

Solve the 2D transverse-electric time-dependent Maxwell problem on a disk.

This file is not meant to be imported as a standard module, but rather run as a script, either serially or in parallel. Typing python maxwell_2d.py -h shows all the available command-line options. Here is an example command for running a parallel simulation with 6 MPI processes:

mpirun -n 6 python maxwell_2d.py -S -n 16 32 -d 3 3 -T 1 -D 0.2 -s 1

Functions#

compute_stable_dt(cfl, C_m, dC_m, V[, tau, ...])

Compute stable time step for a leap-frog Maxwell solver, given the (discrete) primal and dual curl operators

parse_input_arguments()

plot_curve_along_s(name, s_str, time_str, ...)

plot_field_and_error(name, t, x, y, field_h, ...)

run_maxwell_2d_TE(*, study, ...[, cfl, ...])

update_plot(fig, t, x, y, field_h, field_ex)

Classes#

Inheritance diagram of psydac.feec.polar.examples.maxwell_2d

Maxwell2D(domain_log, mapping, exact_solution)

Analytical TE Maxwell model on a mapped polar disk.

Details#

Solve the 2D transverse-electric time-dependent Maxwell problem on a disk.

This file is not meant to be imported as a standard module, but rather run as a script, either serially or in parallel. Typing python maxwell_2d.py -h shows all the available command-line options. Here is an example command for running a parallel simulation with 6 MPI processes:

mpirun -n 6 python maxwell_2d.py -S -n 16 32 -d 3 3 -T 1 -D 0.2 -s 1

class Maxwell2D(domain_log, mapping, exact_solution)[source]#

Bases: PolarModel2D

Analytical TE Maxwell model on a mapped polar disk.

static disk(R, shift_D, study, use_polar_mapping=False)[source]#
property exact_solution#
compute_stable_dt(cfl, C_m, dC_m, V, tau=None, light_c=1.0, comm=None)[source]#

Compute stable time step for a leap-frog Maxwell solver, given the (discrete) primal and dual curl operators

Parameters:
cfl: float

Stability factor (1 to choose the maximum stable dt).

C_m: LinearOperator

(primal) curl V -> dV.

dC_m: LinearOperator

(dual) curl dV -> V.

V: FEMSpace

Finite element space.

tau: float, optional

Time to solve with an integer number of time steps.

light_c: float, default = 1.0

Speed of light, i.e. the parameter c in Maxwell’s equations.

comm: mpi4py.MPI.Comm, optional

If given, only the “root” MPI process with rank=0 will print to std out.

Returns:
Nt_per_tau: int

Integer number of time steps (>0) in simulation.

dt: float

Stable time step size (>0).

norm_op: float

Operator norm (>0) of the time evolution matrix which computes the solution vector at time t+∆t given the solution vector at time t.

plot_field_and_error(name, t, x, y, field_h, field_ex, *gridlines, only_field=True)[source]#
update_plot(fig, t, x, y, field_h, field_ex)[source]#
plot_curve_along_s(name, s_str, time_str, theta0, s, curve_h, curve_ref=None, left_s=None, left_curve_h=None, left_curve_ref=None)[source]#
run_maxwell_2d_TE(*, study, use_spline_mapping, shift_D, ncells, degree, smooth, splitting_order, nsteps, tend, tol, maxiter, verbose, use_scipy, save_figs, cfl=0.9, show_figs=True, mpi_comm)[source]#
parse_input_arguments()[source]#