![]() |
Lethe Open-Source Library version 1.2.0
Developer Guide
|
#include <time_harmonic_maxwell.h>
Public Member Functions | |
| TimeHarmonicMaxwell (MultiphysicsInterface< dim > *multiphysics_interface, const SimulationParameters< dim > &p_simulation_parameters, const std::shared_ptr< parallel::DistributedTriangulationBase< dim > > &p_triangulation, std::shared_ptr< SimulationControl > p_simulation_control) | |
| virtual | ~TimeHarmonicMaxwell ()=default |
| virtual std::vector< OutputStruct< dim, VectorType > > | gather_output_hook () override |
| std::vector< double > | calculate_L2_error () |
| virtual void | finish_simulation () override |
| virtual void | percolate_time_vectors () override |
| virtual void | modify_solution () override |
| virtual void | update_boundary_conditions () override |
| virtual void | postprocess (bool first_iteration) override |
| void | output_per_iteration_timer () override |
| virtual void | pre_mesh_adaptation () override |
| virtual void | post_mesh_adaptation () override |
| virtual void | write_checkpoint () override |
| virtual void | read_checkpoint () override |
| virtual std::vector< OutputStructTableHandler > | gather_tables () override |
| void | compute_error_estimate (const std::pair< const Variable, Parameters::MultipleAdaptationParameters > &ivar, dealii::Vector< float > &estimated_error_per_cell) override |
| void | compute_kelly (dealii::Vector< float > &estimated_error_per_cell, const ComponentMask &component_mask) |
| virtual void | compute_dpg_error (dealii::Vector< float > &estimated_error_per_cell) |
| virtual void | setup_dofs () override |
| virtual void | set_initial_conditions () override |
| void | setup_preconditioner () override |
| void | define_constraints () |
| void | solve_linear_system () override |
| virtual const DoFHandler< dim > & | get_dof_handler () override |
| GlobalVectorType & | get_evaluation_point () override |
| GlobalVectorType & | get_local_evaluation_point () override |
| GlobalVectorType & | get_newton_update () override |
| GlobalVectorType & | get_present_solution () override |
| GlobalVectorType & | get_present_solution_skeleton () |
| GlobalVectorType & | get_system_rhs () override |
| AffineConstraints< double > & | get_nonzero_constraints () override |
| void | output_newton_update_norms () override |
| double | get_residual_rescale_metric () const override |
| bool | should_solve_auxiliary_physics () override |
| void | update_material_properties_dependencies () |
| Public Member Functions inherited from AuxiliaryPhysics< dim, VectorType > | |
| AuxiliaryPhysics (const Parameters::NonLinearSolver non_linear_solver_parameters) | |
| AuxiliaryPhysics () | |
| virtual | ~AuxiliaryPhysics ()=default |
| Public Member Functions inherited from PhysicsSolver< VectorType > | |
| PhysicsSolver (const Parameters::NonLinearSolver non_linear_solver_parameters) | |
| PhysicsSolver () | |
| virtual | ~PhysicsSolver () |
| void | solve_governing_system () |
| virtual void | apply_constraints () |
| virtual double | get_current_residual () |
| virtual bool | allow_skip_linear_solve_when_residual_is_below_tolerance () const |
| unsigned int | get_current_newton_iteration () const |
Private Member Functions | |
| void | verify_consistency_of_boundary_conditions () |
| void | assemble_system_matrix () override |
| void | assemble_system_rhs () override |
| void | reconstruct_interior_solution () |
| void | setup_assemblers () |
| void | assemble_local_dpg_system (const typename DoFHandler< dim >::active_cell_iterator &cell, TimeHarmonicMaxwellScratchData< dim > &scratch_data, DPGCopyData ©_data) |
| void | assemble_local_system_matrix (const typename DoFHandler< dim >::active_cell_iterator &cell, TimeHarmonicMaxwellScratchData< dim > &scratch_data, DPGCopyData ©_data) |
| void | copy_local_matrix_to_global_matrix (const DPGCopyData ©_data) |
| void | reconstruct_local_interior_solution (const typename DoFHandler< dim >::active_cell_iterator &cell, TimeHarmonicMaxwellScratchData< dim > &scratch_data, DPGCopyData ©_data) |
| void | copy_local_interior_solution_to_global (const DPGCopyData ©_data) |
| void | print_memory_consumption (const dealii::ConditionalOStream &pcout, const std::string &str, const unsigned int n_rank, const std::vector< double > &memory_object) |
| void | print_THM_setup_memory (const TrilinosWrappers::SparsityPattern &sparsity_pattern) |
| void | compute_electromagnetic_scaling (const PhysicalPropertiesManager &physical_properties_manager) |
| void | scale_solution_components (const DoFHandler< dim > &dof_handler, GlobalVectorType &solution) |
Additional Inherited Members | |
| Public Attributes inherited from PhysicsSolver< VectorType > | |
| ConditionalOStream | pcout |
| Parameters::SimulationControl::TimeSteppingMethod | time_stepping_method |
solver for the time harmonic form of the Maxwell equations. This class implements an auxiliary physics solver for the ultraweak formulation of the time-harmonic Maxwell equations using the Discontinuous Petrov-Galerkin (DPG) method. The solver is designed to work in three-dimensional spaces and requires the 3 sets of Finite Element spaces that define the DPG method: the interior trial space that is discontinuous between elements, the skeleton trace space that lives on the faces of the mesh elements and connects the interior solutions of adjacent elements, and the test space that is enriched compared to the trial space and is also discontinuous between elements.
Definition at line 78 of file time_harmonic_maxwell.h.
| TimeHarmonicMaxwell< dim >::TimeHarmonicMaxwell | ( | MultiphysicsInterface< dim > * | multiphysics_interface, |
| const SimulationParameters< dim > & | p_simulation_parameters, | ||
| const std::shared_ptr< parallel::DistributedTriangulationBase< dim > > & | p_triangulation, | ||
| std::shared_ptr< SimulationControl > | p_simulation_control ) |
Constructor.
| multiphysics_interface | Interface to the auxiliary physics that will be solved on top of a computational fluid dynamic simulation. |
| p_simulation_parameters | Contains the simulation parameter file information. |
| p_triangulation | Contains the mesh information. In a parallel::DistributedTriangulationBase<dim> not every detail may be known on each processor. The mesh is distributed between the processors. |
| p_simulation_control | Object responsible for the control of steady-state and transient simulations. Contains all the information related to time stepping and the stopping criteria. |
Definition at line 21 of file time_harmonic_maxwell.cc.
References AuxiliaryPhysics< dim, VectorType >::AuxiliaryPhysics(), cell_quadrature, computing_timer, dof_handler_test, dof_handler_trial_interior, dof_handler_trial_skeleton, Parameters::MultipleAdaptationParameters::dpg, electromagnetic_fields, electromagnetic_properties_depend_on(), extractor_E_imag, extractor_E_real, extractor_H_imag, extractor_H_real, face_quadrature, fe_test, fe_trial_interior, fe_trial_skeleton, heat_transfer, mapping, multiphysics, needs_dpg_error_estimator, needs_temperature, needs_void_fraction, PhysicsSolver< VectorType >::pcout, present_solution, present_solution_skeleton, simulation_control, simulation_parameters, solution_transfer, temperature, Parameters::threshold, triangulation, VANS, and void_fraction.
|
virtualdefault |
TimeHarmonicMaxwell - Base destructor. At the present moment this is an interface with nothing.
|
private |
Assemble the uncondensed local DPG system ( \(G\), \(B\), \(\hat{B}\) and \(l\)) of a cell with the cell and face assemblers, and compute the condensation operators that are common to the assembly and to the interior reconstruction: the Cholesky factorizations of the Gram matrix \(G\) and of \(M_1 = B^\dagger G^{-1}B\), and the matrix \(G^{-1}B\).
| [in] | cell | The cell of the interior trial space DoFHandler. |
| [in,out] | scratch_data | Scratch data reinitialized on the cell and on each of its faces. |
| [out] | copy_data | Copy data in which the local system and the condensation operators are stored. |
Definition at line 2202 of file time_harmonic_maxwell.cc.
References assemblers, DPGCopyData::B_matrix, TimeHarmonicMaxwellScratchData< dim >::calculate_cell_coefficients(), TimeHarmonicMaxwellScratchData< dim >::calculate_face_physical_properties(), TimeHarmonicMaxwellScratchData< dim >::calculate_physical_properties(), TimeHarmonicMaxwellScratchData< dim >::cell_material_needs_temperature, TimeHarmonicMaxwellScratchData< dim >::cell_material_needs_void_fraction, dof_handler_test, dof_handler_trial_skeleton, face_assemblers, TimeHarmonicMaxwellScratchData< dim >::face_at_boundary, DPGCopyData::G_inverse_B, DPGCopyData::G_matrix, heat_transfer, DPGCopyData::M1_matrix, multiphysics, TimeHarmonicMaxwellScratchData< dim >::reinit(), TimeHarmonicMaxwellScratchData< dim >::reinit_face(), TimeHarmonicMaxwellScratchData< dim >::reinit_face_temperature(), TimeHarmonicMaxwellScratchData< dim >::reinit_face_void_fraction(), TimeHarmonicMaxwellScratchData< dim >::reinit_temperature(), TimeHarmonicMaxwellScratchData< dim >::reinit_void_fraction(), DPGCopyData::reset(), and void_fraction.
|
private |
Assemble the local DPG system of a cell using the function assemble_local_dpg_system and condense it on the skeleton unknowns. The condensed matrix is \(M_3 - M_2^\dagger M_1^{-1} M_2\) and the condensed right-hand side is \((M_5 - M_2^\dagger M_1^{-1} M_4) l\). The operators \(M_2 = B^\dagger G^{-1}\hat{B}\) and \(M_4 l = B^\dagger G^{-1} l\) are computed here since only the condensed system needs them.
| [in] | cell | The cell of the interior trial space DoFHandler. |
| [in,out] | scratch_data | (see assemble_local_dpg_system) |
| [out] | copy_data | Copy data in which the condensed skeleton system is stored. |
Definition at line 2312 of file time_harmonic_maxwell.cc.
References assemble_local_dpg_system(), DPGCopyData::B_hat_matrix, DPGCopyData::cell_is_local, dof_handler_trial_skeleton, DPGCopyData::G_inverse_B, DPGCopyData::G_inverse_B_hat, DPGCopyData::G_matrix, DPGCopyData::l_vector, DPGCopyData::local_dof_indices, DPGCopyData::local_matrix, DPGCopyData::local_rhs, DPGCopyData::M1_inverse_M2, DPGCopyData::M1_matrix, DPGCopyData::M2_matrix, DPGCopyData::M3_matrix, DPGCopyData::M4_l, DPGCopyData::M5_l, and DPGCopyData::tmp_matrix_M2M1M2.
|
overrideprivatevirtual |
Assemble the matrix associated with the solver.
Implements PhysicsSolver< VectorType >.
Definition at line 2124 of file time_harmonic_maxwell.cc.
References assemble_local_system_matrix(), compute_electromagnetic_scaling(), computing_timer, copy_local_matrix_to_global_matrix(), dof_handler_trial_interior, fe_test, heat_transfer, multiphysics, needs_temperature, needs_void_fraction, setup_assemblers(), simulation_parameters, system_matrix, system_rhs, and void_fraction.
|
overrideprivatevirtual |
Assemble the rhs associated with the solver.
Implements PhysicsSolver< VectorType >.
Definition at line 2389 of file time_harmonic_maxwell.cc.
| std::vector< double > TimeHarmonicMaxwell< dim >::calculate_L2_error | ( | ) |
Calculates the L2 error of the solution. It returns a vector of doubles containing the L2 errors of the real and imaginary parts of the electric and magnetic fields in the order [E_real, E_imag, H_real, H_imag].
Definition at line 818 of file time_harmonic_maxwell.cc.
References cell_quadrature, dof_handler_trial_interior, extractor_E_imag, extractor_E_real, extractor_H_imag, extractor_H_real, fe_trial_interior, mapping, present_solution, simulation_parameters, and triangulation.
|
virtual |
Compute the DPG error estimator based on the energy norm residual used to refine mesh of the TimeHarmonicMaxwell physics.
| [in] | ivar | The current element of the map simulation_parameters.mesh_adaptation.variables |
| [in,out] | estimated_error_per_cell | The deal.II vector of estimated_error_per_cell |
Definition at line 1290 of file time_harmonic_maxwell.cc.
References dof_handler_trial_interior, local_estimated_error_per_cell, and triangulation.
|
private |
Compute the electromagnetic scaling factor used to non-dimensionalize the time-harmonic Maxwell system from the type of scaling required from the user. This is factor will be based on the electric field and obtained :
| [in] | physical_properties_manager | The object that manages the physical properties of the problem and provides them at any given position of the domain. |
Definition at line 364 of file time_harmonic_maxwell.cc.
References compute_effective_electromagnetic_properties(), compute_waveguide_port_incident_fields(), Parameters::electric_field, electromagnetic_properties_depend_on(), electromagnetic_scaling, face_quadrature, fe_trial_skeleton, get_waveguide_port_index(), heat_transfer, Parameters::magnetic_field, mapping, multiphysics, needs_temperature, needs_void_fraction, Parameters::none, Parameters::power, simulation_parameters, temperature, triangulation, void_fraction, and waveguide_ports_electric_amplitudes.
|
overridevirtual |
Compute the error estimator selected in the parameters for adaptive mesh refinement.
| [in] | ivar | The current element of the map simulation_parameters.mesh_adaptation.variables |
| [in,out] | estimated_error_per_cell | The deal.II vector of estimated_error_per_cell |
Implements AuxiliaryPhysics< dim, VectorType >.
Definition at line 1211 of file time_harmonic_maxwell.cc.
References compute_dpg_error(), compute_kelly(), Parameters::MultipleAdaptationParameters::dpg, electric_field, electromagnetic_fields, extractor_E_imag, extractor_E_real, extractor_H_imag, extractor_H_real, fe_trial_interior, Parameters::MultipleAdaptationParameters::kelly, and magnetic_field.
| void TimeHarmonicMaxwell< dim >::compute_kelly | ( | dealii::Vector< float > & | estimated_error_per_cell, |
| const ComponentMask & | component_mask ) |
Compute the Kelly error estimator on the electromagnetic variable for mesh refinement. See : https://www.dealii.org/current/doxygen/deal.II/classKellyErrorEstimator.html for more information on the Kelly error estimator.
| [in,out] | estimated_error_per_cell | The deal.II vector of estimated_error_per_cell |
| [in] | component_mask | The component mask corresponding to the electromagnetic variable |
Definition at line 1274 of file time_harmonic_maxwell.cc.
References dof_handler_trial_interior, face_quadrature, mapping, and present_solution.
|
private |
WorkStream copier of the interior reconstruction. It adds the interior solution of a cell, computed by reconstruct_local_interior_solution, in the global vector locally_owned_solution_interior. This is done with the dof indices of the cell stored in the copy data, which is equivalent to cell->distribute_local_to_global(local_vector, global_vector), since the copier does not have access to the cell. If the DPG error estimator is activated, it also stores the error indicator of the cell in local_estimated_error_per_cell and adds its squared norm to squared_residual_L2_norm.
| [in] | copy_data | Copy data containing the interior solution, the squared norm of the DPG residual and the dof indices of the cell. |
Definition at line 2465 of file time_harmonic_maxwell.cc.
References DPGCopyData::active_cell_index, DPGCopyData::cell_is_local, DPGCopyData::local_dof_indices_trial_interior, local_estimated_error_per_cell, DPGCopyData::local_interior_solution, DPGCopyData::local_residual_norm_squared, locally_owned_solution_interior, needs_dpg_error_estimator, and squared_residual_L2_norm.
|
private |
Distribute the condensed skeleton system of a cell in the global system matrix and right-hand side.
| [in] | copy_data | Copy data containing the condensed skeleton system. |
Definition at line 2373 of file time_harmonic_maxwell.cc.
References DPGCopyData::cell_is_local, DPGCopyData::local_dof_indices, DPGCopyData::local_matrix, DPGCopyData::local_rhs, and nonzero_constraints.
| void TimeHarmonicMaxwell< dim >::define_constraints | ( | ) |
Define the constraints for the TimeHarmonicMaxwell solver. This is equivalent to the define_non_zero_constraints method in other physics solvers, but here there is no need to separate zero and non-zero constraints.
Definition at line 1503 of file time_harmonic_maxwell.cc.
References dof_handler_trial_skeleton, BoundaryConditions::electric_field, fe_trial_skeleton, locally_owned_dofs_trial_skeleton, locally_relevant_dofs_trial_skeleton, BoundaryConditions::magnetic_field, nonzero_constraints, BoundaryConditions::pec, BoundaryConditions::pmc, simulation_parameters, and triangulation.
|
overridevirtual |
Carry out the operations required to finish a simulation correctly.
Implements AuxiliaryPhysics< dim, VectorType >.
Definition at line 927 of file time_harmonic_maxwell.cc.
References announce_string(), computing_timer, Parameters::Timer::end, error_table, PhysicsSolver< VectorType >::pcout, Parameters::quiet, simulation_control, simulation_parameters, and triangulation.
|
overridevirtual |
Gather and return vector of output structs that are particular to some applications.
Reimplemented from AuxiliaryPhysics< dim, VectorType >.
Definition at line 769 of file time_harmonic_maxwell.cc.
References dof_handler_trial_interior, local_estimated_error_per_cell, needs_dpg_error_estimator, and present_solution.
|
overridevirtual |
Returns a vector of references to TableHandler objects that needs to be serialized/deserialized for a given TimeHarmonicMaxwell solver.
Implements AuxiliaryPhysics< dim, VectorType >.
Definition at line 1191 of file time_harmonic_maxwell.cc.
References error_table, and simulation_parameters.
|
inlineoverridevirtual |
Getter method to access the private attribute dof_handler for the physics currently solved. NB : The dof_handler that is returned by this function is the one for the interior trial space of the DPG system. It is where the interior solution lives and therefore is the one we are interested in. The other two DoFHandlers of the class are used for computation to obtain the interior of the cell solution.
Implements AuxiliaryPhysics< dim, VectorType >.
Definition at line 297 of file time_harmonic_maxwell.h.
References dof_handler_trial_interior.
|
inlineoverridevirtual |
Getter method to access the private attribute evaluation_point for the currently solved physics.
Implements PhysicsSolver< VectorType >.
Definition at line 309 of file time_harmonic_maxwell.h.
|
inlineoverridevirtual |
Getter method to access the private attribute local_evaluation_point for the physic currently solved.
Implements PhysicsSolver< VectorType >.
Definition at line 325 of file time_harmonic_maxwell.h.
|
inlineoverridevirtual |
Getter method to access the private attribute newton_update for the currently solved physics.
Implements PhysicsSolver< VectorType >.
Definition at line 340 of file time_harmonic_maxwell.h.
|
inlineoverridevirtual |
Getter method to access the private attribute nonzero_constraints for the currently solved physics.
Implements PhysicsSolver< VectorType >.
Definition at line 401 of file time_harmonic_maxwell.h.
References nonzero_constraints.
|
inlineoverridevirtual |
Getter method to access the private attribute present_solution for the currently solved physics. NB : present_solution is now passed to the multiphysics interface at the end of the setup_dofs method. In the case of TimeHarmonicMaxwell, it corresponds to the solution in the interior trial space.
Implements PhysicsSolver< VectorType >.
Definition at line 358 of file time_harmonic_maxwell.h.
References present_solution.
|
inline |
Getter method to access the private attribute present_solution_skeleton for the currently solved physics. NB : present_solution_skeleton is only defined for the currently solved physics and is not passed to the multiphysics interface at the end of the setup_dofs method.
Definition at line 374 of file time_harmonic_maxwell.h.
References present_solution_skeleton.
|
inlineoverridevirtual |
Return the metric for residual rescaling. By default, should return 1. If the rescale_residual_by_volume is set to true, the method returns the global volume of the triangulation.
Implements PhysicsSolver< VectorType >.
Definition at line 426 of file time_harmonic_maxwell.h.
References electromagnetics, mapping, simulation_parameters, and triangulation.
|
inlineoverridevirtual |
Getter method to access the private attribute system_rhs for the currently solved physics.
Implements PhysicsSolver< VectorType >.
Definition at line 387 of file time_harmonic_maxwell.h.
References system_rhs.
|
overridevirtual |
Carry out modifications on the auxiliary physics solution. To be defined for some physics only (eg. free surface, see cls.h).
Reimplemented from AuxiliaryPhysics< dim, VectorType >.
Definition at line 988 of file time_harmonic_maxwell.cc.
|
inlineoverridevirtual |
Output the L2 and Linfty norms of the correction vector.
Implements PhysicsSolver< VectorType >.
Definition at line 410 of file time_harmonic_maxwell.h.
|
overridevirtual |
Output the per iteration wallclock times.
Implements AuxiliaryPhysics< dim, VectorType >.
Definition at line 1056 of file time_harmonic_maxwell.cc.
References announce_string(), computing_timer, and PhysicsSolver< VectorType >::pcout.
|
overridevirtual |
Carry out the operations required to rearrange the values of the previous solution at the end of a time step.
Implements AuxiliaryPhysics< dim, VectorType >.
Definition at line 981 of file time_harmonic_maxwell.cc.
|
overridevirtual |
post_mesh_adaption Interpolates the auxiliary physics variables to the new mesh
Implements AuxiliaryPhysics< dim, VectorType >.
Definition at line 1075 of file time_harmonic_maxwell.cc.
References locally_owned_dofs_trial_interior, present_solution, solution_transfer, and triangulation.
|
overridevirtual |
Postprocess the auxiliary physics results. Post-processing this case implies the calculation of all derived quantities using the solution vector of the physics. It does not concern the output of the solution using the DataOutObject, which is accomplished through the attach_solution_to_output function.
Implements AuxiliaryPhysics< dim, VectorType >.
Definition at line 1009 of file time_harmonic_maxwell.cc.
References calculate_L2_error(), error_table, PhysicsSolver< VectorType >::pcout, Parameters::quiet, simulation_parameters, and triangulation.
|
overridevirtual |
pre_mesh_adaption Prepares the auxiliary physics variables for a mesh refinement/coarsening
Implements AuxiliaryPhysics< dim, VectorType >.
Definition at line 1067 of file time_harmonic_maxwell.cc.
References present_solution, and solution_transfer.
|
inlineprivate |
This helper function helps to compute the memory consumption of different objects on each rank and print it out. It is useful to debug memory issues and understand the memory distribution across ranks.
| pcout | The output stream to print the memory consumption information. |
| str | The name of the object for which the memory consumption is being printed. This is used for clarity in the output. |
| n_rank | The total number of ranks in the MPI communicator. |
| memory_object | The object containing the memory information to be printed. |
Definition at line 614 of file time_harmonic_maxwell.h.
References announce_string(), and PhysicsSolver< VectorType >::pcout.
|
private |
Print memory usage diagnostics after the THM setup.
Definition at line 198 of file time_harmonic_maxwell.cc.
References announce_string(), dof_handler_test, dof_handler_trial_interior, dof_handler_trial_skeleton, PhysicsSolver< VectorType >::pcout, present_solution, present_solution_skeleton, print_memory_consumption(), system_matrix, system_rhs, and triangulation.
|
overridevirtual |
Set solution vector of Auxiliary Physics using checkpoint.
Implements AuxiliaryPhysics< dim, VectorType >.
Definition at line 1135 of file time_harmonic_maxwell.cc.
References deserialize_tables_vector(), dof_handler_trial_interior, gather_tables(), heat_transfer, locally_owned_dofs_trial_interior, multiphysics, needs_temperature, PhysicsSolver< VectorType >::pcout, present_solution, solution_transfer, temperature_last_solved_solution, temperature_last_solved_solution_transfer, and triangulation.
|
private |
Reconstruct the interior solution from the skeleton solution after solving the linear system on the skeleton only. The local DPG system of each cell is assembled again to compute the interior solution \(u_h = M_1^{-1} (G^{-1} B)^\dagger (l - \hat{B}\hat{u}_h)\) and the DPG residual \(\Psi = G^{-1}(l - B u_h - \hat{B}\hat{u}_h)\) when the DPG error estimate on the cell and is not stored anywhere else.
Definition at line 2493 of file time_harmonic_maxwell.cc.
References copy_local_interior_solution_to_global(), dof_handler_trial_interior, electromagnetics, fe_test, heat_transfer, locally_owned_dofs_trial_interior, locally_owned_solution_interior, multiphysics, needs_dpg_error_estimator, needs_temperature, needs_void_fraction, PhysicsSolver< VectorType >::pcout, present_solution, Parameters::quiet, reconstruct_local_interior_solution(), simulation_parameters, squared_residual_L2_norm, triangulation, and void_fraction.
|
private |
WorkStream worker of the interior reconstruction. It assembles the local DPG system of a cell with assemble_local_dpg_system() and uses the skeleton solution of the cell \(\hat{u}_h\) to compute:
| [in] | cell | The cell of the interior trial space DoFHandler. |
| [in,out] | scratch_data | (see assemble_local_dpg_system) |
| [out] | copy_data | Copy data in which the interior solution, the squared norm of the DPG residual and the dof indices of the cell are stored. |
Definition at line 2398 of file time_harmonic_maxwell.cc.
References DPGCopyData::active_cell_index, assemble_local_dpg_system(), DPGCopyData::B_hat_matrix, DPGCopyData::B_matrix, DPGCopyData::cell_is_local, dof_handler_trial_skeleton, DPGCopyData::G_inverse_B, DPGCopyData::G_matrix, DPGCopyData::l_vector, DPGCopyData::local_dof_indices_trial_interior, DPGCopyData::local_interior_rhs, DPGCopyData::local_interior_solution, DPGCopyData::local_residual, DPGCopyData::local_residual_norm_squared, DPGCopyData::local_skeleton_solution, DPGCopyData::M1_matrix, needs_dpg_error_estimator, present_solution_skeleton, and DPGCopyData::tmp_vector_reconstruction.
|
private |
Scale the solution components by the electromagnetic scaling factor to recover the physical values of the solution after solving the non-dimensionalized system. This function is called at the end of the solve_linear_system method after reconstructing the interior solution from the skeleton solution.
| [in] | dof_handler | The degree of freedom handler for the mesh associated with the solution. |
| [in,out] | solution | The solution vector to be scaled. |
Definition at line 684 of file time_harmonic_maxwell.cc.
References electromagnetic_scaling, Parameters::none, and simulation_parameters.
|
overridevirtual |
Sets up the initial conditions associated with the physics. Generally, most physics only support imposing nodal values, but some physics additionally support the use of L2 projection or steady-state solutions.
Implements AuxiliaryPhysics< dim, VectorType >.
Definition at line 1450 of file time_harmonic_maxwell.cc.
References dof_handler_trial_interior, extractor_E_imag, extractor_E_real, extractor_H_imag, extractor_H_real, fe_trial_interior, locally_owned_dofs_trial_interior, mapping, present_solution, simulation_parameters, and triangulation.
|
private |
Set up the cell and face assemblers of the DPG system according to the simulation parameters.
Definition at line 2084 of file time_harmonic_maxwell.cc.
References assemblers, face_assemblers, is_robin_boundary_type(), simulation_parameters, BoundaryConditions::BoundaryConditions< BoundaryType >::type, and waveguide_ports_electric_amplitudes.
|
overridevirtual |
Sets up the DofHandler and the degree of freedom associated with the physics.
Implements AuxiliaryPhysics< dim, VectorType >.
Definition at line 1335 of file time_harmonic_maxwell.cc.
References define_constraints(), dof_handler_test, dof_handler_trial_interior, dof_handler_trial_skeleton, electromagnetics, Parameters::extra_verbose, fe_test, fe_trial_interior, fe_trial_skeleton, initial_guess_iterative_solver, local_estimated_error_per_cell, locally_owned_dofs_trial_interior, locally_owned_dofs_trial_skeleton, locally_relevant_dofs_trial_interior, locally_relevant_dofs_trial_skeleton, mapping, multiphysics, needs_dpg_error_estimator, nonzero_constraints, PhysicsSolver< VectorType >::pcout, present_solution, present_solution_skeleton, print_THM_setup_memory(), simulation_parameters, system_matrix, system_rhs, triangulation, and verify_consistency_of_boundary_conditions().
|
overridevirtual |
Sets up preconditioner of the system matrix.
Reimplemented from AuxiliaryPhysics< dim, VectorType >.
Definition at line 1496 of file time_harmonic_maxwell.cc.
References preconditioner.
|
overridevirtual |
Manage if the auxiliary physics should be solved at the current iteration. By default, auxiliary physics are solved at every iteration.
Reimplemented from AuxiliaryPhysics< dim, VectorType >.
Definition at line 1846 of file time_harmonic_maxwell.cc.
References compute_effective_electromagnetic_properties(), Parameters::TimeHarmonicMaxwell< dim >::coupling_iteration, Parameters::TimeHarmonicMaxwell< dim >::coupling_threshold, Parameters::TimeHarmonicMaxwell< dim >::coupling_time, electromagnetics, heat_transfer, Parameters::iteration, mapping, multiphysics, needs_temperature, Parameters::none, PhysicsSolver< VectorType >::pcout, Parameters::quiet, simulation_control, simulation_parameters, Parameters::SimulationControl::steady, temperature, temperature_last_solved_solution, Parameters::threshold, Parameters::time, Parameters::TimeHarmonicMaxwell< dim >::time_coupling_strategy, and triangulation.
|
overridevirtual |
Solve the linear system using the CG solver.
The CG solver is initialized with the solution from the previous linear system solve, stored in the initial_guess_iterative_solver vector. The initial guess is set to zero for the first solve of a simulation, after restarting from a checkpoint, and after mesh adaptation.
The present_solution_skeleton vector cannot be used directly as an initial guess because it is rescaled according to the user-defined parameters. Consequently, its rescaled values generally provide a poor initial guess for the CG solver. Storing the initial guess separately avoids the need to perform an inverse scaling of present_solution_skeleton. It also ensures that the interior and skeleton solutions remain synchronized in the same scaling. The initial_guess_iterative_solver vector is updated after each linear system solve.
Implements PhysicsSolver< VectorType >.
Definition at line 1767 of file time_harmonic_maxwell.cc.
References computing_timer, dof_handler_trial_interior, dof_handler_trial_skeleton, electromagnetics, get_residual_rescale_metric(), initial_guess_iterative_solver, Parameters::LinearSolver::none, nonzero_constraints, PhysicsSolver< VectorType >::pcout, preconditioner, present_solution, present_solution_skeleton, Parameters::quiet, reconstruct_interior_solution(), scale_solution_components(), simulation_parameters, system_matrix, system_rhs, and update_material_properties_dependencies().
|
overridevirtual |
Updates non zero constraints if the boundary is time-dependent.
Reimplemented from AuxiliaryPhysics< dim, VectorType >.
Definition at line 995 of file time_harmonic_maxwell.cc.
References simulation_parameters.
| void TimeHarmonicMaxwell< dim >::update_material_properties_dependencies | ( | ) |
Updates the containers that store the properties from which the material properties of the time-harmonic Maxwell equations can depend on.
Definition at line 970 of file time_harmonic_maxwell.cc.
References heat_transfer, multiphysics, needs_temperature, and temperature_last_solved_solution.
|
inlineprivate |
Verify consistency of the input parameters for boundary conditions to ensure that for every boundary id within the triangulation, a boundary condition has been specified in the input file.
Definition at line 454 of file time_harmonic_maxwell.h.
References simulation_parameters, and triangulation.
|
overridevirtual |
Prepares auxiliary physics to write checkpoint.
Implements AuxiliaryPhysics< dim, VectorType >.
Definition at line 1096 of file time_harmonic_maxwell.cc.
References dof_handler_trial_interior, gather_tables(), heat_transfer, multiphysics, needs_temperature, present_solution, serialize_tables_vector(), solution_transfer, temperature_last_solved_solution, temperature_last_solved_solution_transfer, and triangulation.
|
private |
Cell assemblers of the local DPG system.
Definition at line 751 of file time_harmonic_maxwell.h.
|
private |
Approximate an integral over a cell by evaluating the integrand at specific points and summing the point values with specific weights.
Definition at line 776 of file time_harmonic_maxwell.h.
|
private |
Store information related to the computing time such as CPU times or wall time.
Definition at line 673 of file time_harmonic_maxwell.h.
|
private |
Given a triangulation and a description of a finite element, this class enumerates degrees of freedom on all vertices, edges, faces, and cells of the triangulation of the test space dofs. NB: in DPG, the test space is not split into interior and skeleton dofs in opposition to the trial space and therefore manages vertices, edges, faces and cells dofs.
Definition at line 721 of file time_harmonic_maxwell.h.
|
private |
Given a triangulation and a description of a finite element, this class enumerates degrees of freedom on all vertices, edges, faces, and cells of the triangulation of the trial space for the interior dofs. NB: Since it is based on DG elements, there are no dofs on vertices, edges or faces.
Definition at line 702 of file time_harmonic_maxwell.h.
|
private |
Given a triangulation and a description of a finite element, this class enumerates degrees of freedom on all vertices, edges, faces, and cells of the triangulation of the trial space for the skeleton dofs. NB: This DoFHandler is based on global FE spaces with frozen interior dofs, so the dofs effectively live only on faces, edges and vertices.
Definition at line 711 of file time_harmonic_maxwell.h.
|
private |
The time-harmonic Maxwell DPG system of equation is solved in dimensionless form. However, to be able to recover the physical solution, the physical amplitude of the electromagnetic fields needs to be calculated from the input power provided and the associated scaling factor is the maximum of those field amplitudes across all the inlets in the problem. This way, the electromagnetic fields remain with an amplitude of order 1 (for the inlet with the highest input power) or less (for the other inlets) in the dimensionless system.
Definition at line 904 of file time_harmonic_maxwell.h.
|
private |
Store some convergence data, such as residuals of the cg-method, or some evaluated L2-errors of discrete solutions. Evaluate convergence rates or orders.
Definition at line 764 of file time_harmonic_maxwell.h.
|
private |
Extractor for the imaginary part of the electric field vector.
Definition at line 881 of file time_harmonic_maxwell.h.
|
private |
Extractor for the real part of the electric field vector.
Definition at line 876 of file time_harmonic_maxwell.h.
|
private |
Extractor for the imaginary part of the magnetic field vector.
Definition at line 891 of file time_harmonic_maxwell.h.
|
private |
Extractor for the real part of the magnetic field vector.
Definition at line 886 of file time_harmonic_maxwell.h.
|
private |
Face assemblers of the local DPG system.
Definition at line 757 of file time_harmonic_maxwell.h.
|
private |
Approximate an integral over a cell's face by evaluating the integrand at specific points and summing the point values with specific weights.
Definition at line 782 of file time_harmonic_maxwell.h.
|
private |
The base class for finite elements. This class will manage everything related to the shape functions of the test space.
Definition at line 739 of file time_harmonic_maxwell.h.
|
private |
The base class for finite elements. This class will manage everything related to the shape functions of the trial interior space.
Definition at line 727 of file time_harmonic_maxwell.h.
|
private |
The base class for finite elements. This class will manage everything related to the shape functions of the trial skeleton space.
Definition at line 733 of file time_harmonic_maxwell.h.
|
private |
A vector containing the initial guess x_0 for the iterative solver when solving for \( Ax = b \).
Definition at line 853 of file time_harmonic_maxwell.h.
|
private |
A vector containing the values of the dpg error estimator for each cell of the triangulation. This is used for mesh adaptation based on the DPG error estimator.
Definition at line 826 of file time_harmonic_maxwell.h.
|
private |
IndexSet of the owned degrees of freedom for the interior trial space.
Definition at line 787 of file time_harmonic_maxwell.h.
|
private |
IndexSet of the owned degrees of freedom for the skeleton trial space.
Definition at line 797 of file time_harmonic_maxwell.h.
|
private |
Non-ghosted vector in which the interior solution is assembled cell by cell during the reconstruction. It is needed because present_solution is a ghosted vector, which can only be read. It is a class member so the WorkStream copier can access it, but it is only allocated during reconstruct_interior_solution() to avoid keeping it in memory between the solves.
Definition at line 836 of file time_harmonic_maxwell.h.
|
private |
IndexSet of the relevant degrees of freedom for the interior trial space.
Definition at line 792 of file time_harmonic_maxwell.h.
|
private |
IndexSet of the relevant degrees of freedom for the skeleton trial space.
Definition at line 802 of file time_harmonic_maxwell.h.
|
private |
Transformation which maps point in the reference cell to points in the actual grid cell.
Definition at line 770 of file time_harmonic_maxwell.h.
|
private |
Pointer to the multiphysics interface that manages the coupling between the different physics solvers.
Definition at line 667 of file time_harmonic_maxwell.h.
|
private |
A boolean variable that indicates whether the time-harmonic Maxwell solver needs to compute the value of the DPG error estimator.
Definition at line 935 of file time_harmonic_maxwell.h.
|
private |
A boolean variable that indicates whether the time-harmonic Maxwell solver needs to define temperature-dependent variables and store the temperature solution from the last solve.
Definition at line 922 of file time_harmonic_maxwell.h.
|
private |
A boolean variable that indicates whether the time-harmonic Maxwell solver needs to evaluate the void fraction field, i.e., if the electromagnetic properties of at least one effective medium depend on the void fraction.
Definition at line 929 of file time_harmonic_maxwell.h.
|
private |
Store the nonzero constraints that arise from several sources such as boundary conditions and hanging nodes in the mesh. See the deal.II documentation on constraints on degrees of freedom for more information. The zero constraints are not used in this solver as it solve a linear system.
Definition at line 862 of file time_harmonic_maxwell.h.
|
private |
Preconditioner for the linear solver. At the present moment, this is an identity preconditioner.
Definition at line 745 of file time_harmonic_maxwell.h.
|
private |
A vector containing all the values of the solution in the interior trial space.
Definition at line 813 of file time_harmonic_maxwell.h.
|
private |
A vector containing all the values of the solution on the skeleton for the trial space.
Definition at line 819 of file time_harmonic_maxwell.h.
|
private |
Responsible for the control of steady-state and transient simulations. Contains all the information related to time stepping and the stopping criteria. See simulation_control abstract class for more information.
Definition at line 693 of file time_harmonic_maxwell.h.
|
private |
Contain the simulation parameter file information.
Definition at line 678 of file time_harmonic_maxwell.h.
|
private |
SolutionTransfer<dim, GlobalVectorType>> is used to implement the transfer of a discrete FE function (e.g. a solution vector) from one mesh to another. This Deal.ii class is used for mesh_refinement and simulation restarts. This transfer the interior solution.
Definition at line 871 of file time_harmonic_maxwell.h.
|
private |
Squared L2 norm of the DPG residual, accumulated over the locally owned cells during the reconstruction when the dpg error estimator is activated.
Definition at line 842 of file time_harmonic_maxwell.h.
|
private |
The system matrix.
Definition at line 807 of file time_harmonic_maxwell.h.
|
private |
The right hand side vector.
Definition at line 847 of file time_harmonic_maxwell.h.
|
private |
A vector containing all the values of the temperature solution when the last solve of the time-harmonic Maxwell system was performed. This is used to determine the physical properties of the materials in the domain when they are temperature-dependent.
Definition at line 943 of file time_harmonic_maxwell.h.
|
private |
SolutionTransfer<dim, GlobalVectorType>> is used to implement the transfer of a discrete FE function (e.g. a solution vector) from one mesh to another. This Deal.ii class is used for mesh_refinement and simulation restarts. The temperature field last solved needs its own solution transfer since it does not have the same dof handler than the time-harmonic Maxwell physics.
Definition at line 955 of file time_harmonic_maxwell.h.
|
private |
Collection of cells that cover the domain on which one wants to solve a partial differential equation.
Definition at line 685 of file time_harmonic_maxwell.h.
|
private |
A vector containing the electric amplitudes of all the waveguide ports. It is define as the : \( \sqrt{P_\mathrm{input}/P_\mathrm{port}} \), where \(P_\mathrm{input}\) is the input power provided by the user for a given waveguide port and \(P_\mathrm{port}\) is the power computed from integrating the Poynting vector of the electromagnetic fields at the inlet associated with the waveguide port condition.
Definition at line 914 of file time_harmonic_maxwell.h.