150 {
152
155 double area = getMeasure();
156 auto t_w = getFTensor0IntegrationWeight();
157 auto nb_gauss_pts = getGaussPts().size2();
158 double totalEnergy = 0.0;
159 int index = 0;
160
162
163 double blockPermittivity = 0.0;
164
165 if (
m.second.internalDomainEnts.find(getFEEntityHandle()) !=
166 m.second.internalDomainEnts.end()) {
168 if (
n.second.domainEnts.find(getFEEntityHandle()) !=
169 n.second.domainEnts.end()) {
170 blockPermittivity =
n.second.epsPermit;
171 }
172 }
173
174 for (int gg = 0; gg != nb_gauss_pts; gg++) {
175 totalEnergy += 0.5 * t_negative_grad_u(
I) * t_negative_grad_u(
I) *
176 blockPermittivity * t_w * area;
177 ++t_negative_grad_u;
178 ++t_w;
179 }
180 }
181 }
183
185 }
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
const double n
refractive index of diffusive medium
FTensor::Tensor1< FTensor::PackPtr< T *, S >, Tensor_Dim > getFTensor1FromMat(ublas::matrix< T, L, A > &data)
Get tensor rank 1 (vector) form data matrix.
MoFEMErrorCode VecSetValues(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
constexpr IntegrationType I
FTensor::Index< 'm', 3 > m