hp-FEM
Adaptive hp-FEM suite for nano-optics
Loading...
Searching...
No Matches
shape_sensitivity.hpp
Go to the documentation of this file.
1#pragma once
34#include <vector>
35
36#include "hpfem/core/types.hpp"
37#include "hpfem/mesh/mesh.hpp"
43
44namespace hpfem::physics {
45
48using NodeField = Eigen::Matrix<Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>;
50using ComplexNodeField = Eigen::Matrix<Complex, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>;
51
53template <int Dim>
54[[nodiscard]] Index num_geometry_nodes(const mesh::Mesh<Dim>& mesh);
55
58template <int Dim>
59[[nodiscard]] ComplexNodeField shape_gradient(const Scattering<Dim>& problem,
60 const ScatteringSolution<Dim>& solution,
61 const Vector& adjoint, Real relative_step = 1e-6);
62
65 const ConicalSolution& solution,
66 const ConicalAdjoint& adjoint,
67 Real relative_step = 1e-6);
68
71[[nodiscard]] Complex shape_sensitivity(const ComplexNodeField& gradient,
72 const NodeField& velocity);
73
80template <int Dim>
81[[nodiscard]] Complex shape_derivative(const Scattering<Dim>& problem,
82 const ScatteringSolution<Dim>& solution,
83 const Functional<Dim>& functional, const NodeField& velocity,
84 Real relative_step = 1e-6, Real functional_step = 1e-6);
85
88 const ConicalSolution& solution,
89 const ConicalFunctional& functional,
90 const NodeField& velocity, Real relative_step = 1e-6,
91 Real functional_step = 1e-6);
92
106template <int Dim>
108 const ScatteringSolution<Dim>& solution,
109 const NodeField& velocity,
110 Real relative_step = 1e-6);
113 const ConicalSolution& solution,
114 const NodeField& velocity,
115 Real relative_step = 1e-6);
116
122template <int Dim>
124 const Functional<Dim>& functional,
125 const NodeField& velocity,
126 Real functional_step = 1e-6);
129 const fespace::NedelecDofMap<2>& transverse, const fespace::DofMap<2>& longitudinal,
130 const ConicalFunctional& functional, const NodeField& velocity, Real functional_step = 1e-6);
131
137template <int Dim>
139
143template <int Dim>
144void move_nodes(mesh::Mesh<Dim>& mesh, const NodeField& velocity, Real t);
145
146} // namespace hpfem::physics
Definition dof_map.hpp:51
Definition mesh.hpp:61
Definition conical_scattering.hpp:165
Assembles, constrains and solves a scattering problem and evaluates its fields.
Definition scattering.hpp:96
std::int32_t Tag
Integer tag of a physical group (Gmsh convention: positive; 0 means untagged).
Definition mesh.hpp:23
Definition absorption.hpp:21
Vector conical_shape_residual_derivative(const ConicalScattering &problem, const ConicalSolution &solution, const NodeField &velocity, Real relative_step=1e-6)
The same for the conical solver, stacked as (in-plane | scaled longitudinal).
Complex shape_sensitivity(const ComplexNodeField &gradient, const NodeField &velocity)
ComplexNodeField shape_gradient(const Scattering< Dim > &problem, const ScatteringSolution< Dim > &solution, const Vector &adjoint, Real relative_step=1e-6)
std::function< Vector(const fespace::NedelecDofMap< Dim > &)> Functional
A linear functional given on any DoF map of the mesh: returns q with Q(E_h) = qᵀ e_h.
Definition goal_oriented.hpp:28
ComplexNodeField conical_shape_gradient(const ConicalScattering &problem, const ConicalSolution &solution, const ConicalAdjoint &adjoint, Real relative_step=1e-6)
The same for the conical solver.
Index num_geometry_nodes(const mesh::Mesh< Dim > &mesh)
Number of geometry nodes of the mesh: vertices plus edge nodes for order 2.
Vector shape_residual_derivative(const Scattering< Dim > &problem, const ScatteringSolution< Dim > &solution, const NodeField &velocity, Real relative_step=1e-6)
Vector conical_functional_shape_derivative(const fespace::NedelecDofMap< 2 > &transverse, const fespace::DofMap< 2 > &longitudinal, const ConicalFunctional &functional, const NodeField &velocity, Real functional_step=1e-6)
The same for a conical functional, stacked as (in-plane | scaled longitudinal).
Complex conical_shape_derivative(const ConicalScattering &problem, const ConicalSolution &solution, const ConicalFunctional &functional, const NodeField &velocity, Real relative_step=1e-6, Real functional_step=1e-6)
The same for the conical solver and a ConicalFunctional.
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > NodeField
Definition shape_sensitivity.hpp:48
Eigen::Matrix< Complex, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > ComplexNodeField
Complex node field, the gradient of a complex goal.
Definition shape_sensitivity.hpp:50
void move_nodes(mesh::Mesh< Dim > &mesh, const NodeField &velocity, Real t)
Vector functional_shape_derivative(const fespace::NedelecDofMap< Dim > &dofs, const Functional< Dim > &functional, const NodeField &velocity, Real functional_step=1e-6)
Complex shape_derivative(const Scattering< Dim > &problem, const ScatteringSolution< Dim > &solution, const Functional< Dim > &functional, const NodeField &velocity, Real relative_step=1e-6, Real functional_step=1e-6)
std::function< std::pair< Vector, Vector >(const fespace::NedelecDofMap< 2 > &, const fespace::DofMap< 2 > &)> ConicalFunctional
Definition conical_goal.hpp:27
NodeField region_normal_velocity(const mesh::Mesh< Dim > &mesh, mesh::Tag tag)
double Real
Definition types.hpp:15
std::int64_t Index
global indices (DoFs, entities)
Definition types.hpp:17
Eigen::Matrix< Complex, Eigen::Dynamic, 1 > Vector
Definition types.hpp:20
std::complex< double > Complex
Definition types.hpp:16
Adjoint of the conical solver as block coefficients (in-plane and scaled longitudinal).
Definition sensitivity.hpp:73
Definition conical_scattering.hpp:152
Coefficients of the unknown field on the DoF map.
Definition scattering.hpp:86