2#ifndef __ELECTROSTATICS_HPP__ 
    3#define __ELECTROSTATICS_HPP__ 
   65    PetscInt ghosts[2] = {0, 1};
 
 
   76      boost::shared_ptr<DataAtIntegrationPts> common_data_ptr,
 
   77      boost::shared_ptr<std::map<int, BlockData>> int_block_sets_ptr,
 
   81    std::fill(&doEntities[MBVERTEX], &doEntities[MBMAXTYPE], 
false);
 
   82    doEntities[MBVERTEX] = 
true;
 
 
   86                        EntityType col_type, 
EntData &row_data,
 
   90      if (
m.second.interfaceEnts.find(getFEEntityHandle()) !=
 
   91          m.second.interfaceEnts.end()) {
 
 
 
  106      boost::shared_ptr<DataAtIntegrationPts> common_data_ptr,
 
  107      boost::shared_ptr<map<int, BlockData>> perm_block_sets_ptr,
 
  111    std::fill(&doEntities[MBVERTEX], &doEntities[MBMAXTYPE], 
false);
 
  112    doEntities[MBVERTEX] = 
true;
 
 
  120    for (
auto &
m : (*permBlockSetsPtr)) {
 
  121      if (
m.second.domainEnts.find(getFEEntityHandle()) !=
 
  122          m.second.domainEnts.end()) {
 
 
 
  138      boost::shared_ptr<MatrixDouble> grad_u_negative,
 
  139      boost::shared_ptr<std::map<int, BlockData>> perm_block_sets_ptr,
 
  140      boost::shared_ptr<std::map<int, BlockData>> int_domain_block_sets_ptr,
 
  141      boost::shared_ptr<DataAtIntegrationPts> common_data_ptr,
 
  147    std::fill(&doEntities[MBVERTEX], &doEntities[MBMAXTYPE], 
false);
 
  148    doEntities[MBVERTEX] = 
true;
 
 
  153    auto t_negative_grad_u = getFTensor1FromMat<SPACE_DIM>(*
gradUNegative);
 
  155    double area = getMeasure();
 
  156    auto t_w = getFTensor0IntegrationWeight();
 
  157    auto nb_gauss_pts = getGaussPts().size2();
 
  158    double totalEnergy = 0.0;
 
  163      double blockPermittivity = 0.0;
 
  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;
 
  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;
 
 
 
  199      boost::shared_ptr<MatrixDouble> grad_u_negative,
 
  200      boost::shared_ptr<VectorDouble> energy_densiity_ptr,
 
  201      boost::shared_ptr<std::map<int, BlockData>> perm_block_sets_ptr,
 
  202      boost::shared_ptr<DataAtIntegrationPts> common_data_ptr)
 
  206    std::fill(&doEntities[MBVERTEX], &doEntities[MBMAXTYPE], 
false);
 
  207    doEntities[MBVERTEX] = 
true;
 
 
  216    size_t nb_gauss_pts = getGaussPts().size2();
 
  220    auto t_negative_grad_u = getFTensor1FromMat<SPACE_DIM>(*
gradUNegative);
 
  222    double blockPermittivity = 0.0;
 
  224      if (
n.second.domainEnts.find(getFEEntityHandle()) !=
 
  225          n.second.domainEnts.end()) {
 
  226        blockPermittivity = 
n.second.epsPermit;
 
  230    for (
int gg = 0; gg != nb_gauss_pts; gg++) {
 
  232          0.5 * t_negative_grad_u(
I) * t_negative_grad_u(
I) * blockPermittivity;
 
 
 
  251      boost::shared_ptr<MatrixDouble> grad_u_negative,
 
  252      boost::shared_ptr<MatrixDouble> grad_times_perm,
 
  253      boost::shared_ptr<std::map<int, BlockData>> perm_block_sets_ptr,
 
  254      boost::shared_ptr<DataAtIntegrationPts> common_data_ptr)
 
  258    std::fill(&doEntities[MBVERTEX], &doEntities[MBMAXTYPE], 
false);
 
  259    doEntities[MBVERTEX] = 
true;
 
 
  268    size_t nb_gauss_pts = getGaussPts().size2();
 
  271    auto t_grad_times_perm = getFTensor1FromMat<SPACE_DIM>(*
gradTimesPerm);
 
  272    auto t_negative_grad_u = getFTensor1FromMat<SPACE_DIM>(*
gradUNegative);
 
  274    double blockPermittivity = 0.0;
 
  276      if (
n.second.domainEnts.find(getFEEntityHandle()) !=
 
  277          n.second.domainEnts.end()) {
 
  278        blockPermittivity = 
n.second.epsPermit;
 
  281    for (
int gg = 0; gg != nb_gauss_pts; gg++) {
 
  282      t_grad_times_perm(
I) = t_negative_grad_u(
I) * blockPermittivity;
 
 
 
  302      const std::string 
field_name, boost::shared_ptr<MatrixDouble> grad_ptr,
 
  303      boost::shared_ptr<MatrixDouble> d_jump,
 
  304      boost::shared_ptr<DataAtIntegrationPts> common_data_ptr,
 
  305      boost::shared_ptr<std::map<int, BlockData>> perm_block_sets_ptr)
 
  311    std::fill(&doEntities[MBVERTEX], &doEntities[MBMAXTYPE], 
false);
 
  312    doEntities[MBVERTEX] = 
true;
 
 
  319    auto t_field_grad = getFTensor1FromMat<SPACE_DIM>(*
gradPtr);
 
  321    double blockPermittivity = 0.0;
 
  324      if (
n.second.domainEnts.find(getFEEntityHandle()) !=
 
  325          n.second.domainEnts.end()) {
 
  326        blockPermittivity = 
n.second.epsPermit;
 
  329    auto N_InLoop = getNinTheLoop();
 
  330    auto sensee = getSkeletonSense();
 
  331    auto nb_gauss_pts = getGaussPts().size2();
 
  337    auto t_jump = getFTensor1FromMat<SPACE_DIM>(*
djump);
 
  339    for (
int gg = 0; gg != nb_gauss_pts; gg++) {
 
  340      t_jump(
i) -= t_field_grad(
i) * blockPermittivity * sensee;
 
 
  350  boost::shared_ptr<MatrixDouble> 
djump;
 
 
  359      const std::string 
field_name, boost::shared_ptr<MatrixDouble> d_jump,
 
  361      boost::shared_ptr<std::map<int, BlockData>> electrode_block_sets_ptr)
 
  364    std::fill(&doEntities[MBVERTEX], &doEntities[MBMAXTYPE], 
false);
 
  365    doEntities[MBVERTEX] = 
true;
 
 
  371    auto fe_ent = getFEEntityHandle();
 
  372    auto nb_gauss_pts = getGaussPts().size2();
 
  373    double area = getMeasure();
 
  375    auto t_jump = getFTensor1FromMat<SPACE_DIM>(*
dJumpPtr);
 
  376    auto t_normal = getFTensor1NormalsAtGaussPts();
 
  377    auto t_w = getFTensor0IntegrationWeight();
 
  379      double alphaPart = 0.0;
 
  380      if (
m.second.electrodeEnts.find(fe_ent) != 
m.second.electrodeEnts.end()) {
 
  382        for (
int gg = 0; gg != nb_gauss_pts; gg++) {
 
  384          t_r(
i) = t_normal(
i);
 
  386          alphaPart += (t_jump(
i) * t_r(
i)) * t_w * area;
 
  391        CHKERR ::VecSetValues(
petscVec, 1, &index, &alphaPart,
 
 
 
  408                  boost::shared_ptr<MatrixDouble> grad_u)
 
 
  413                        DataForcesAndSourcesCore::EntData &data) {
 
  416    const size_t nb_gauss_pts = getGaussPts().size2();
 
  419    auto t_grad_u = getFTensor1FromMat<SPACE_DIM>(*
gradU);
 
  420    auto t_negative_grad_u = getFTensor1FromMat<SPACE_DIM>(*
gradUNegative);
 
  423    for (
int gg = 0; gg != nb_gauss_pts; gg++) {
 
  424      t_negative_grad_u(
I) = -t_grad_u(
I);
 
 
  434  boost::shared_ptr<MatrixDouble> 
gradU;
 
 
ForcesAndSourcesCore::UserDataOperator UserDataOperator
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
Tensor1< T, Tensor_Dim > normalize()
#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.
FormsIntegrators< IntEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< BASE_DIM, FIELD_DIM > OpInterfaceRhsVectorF
PipelineManager::ElementsAndOpsByDim< SPACE_DIM >::BoundaryEle IntEle
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpGradGrad< BASE_DIM, FIELD_DIM, SPACE_DIM > OpDomainLhsMatrixK
constexpr auto domainField
intPostProc< SPACE_DIM >::intEle IntElementForcesAndSourcesCore
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< BASE_DIM, FIELD_DIM > OpBodySourceVectorb
FTensor::Index< 'i', SPACE_DIM > i
const double n
refractive index of diffusive medium
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
auto createGhostVector(MPI_Comm comm, PetscInt n, PetscInt N, PetscInt nghost, const PetscInt ghosts[])
Create smart ghost vector.
MoFEMErrorCode VecSetValues(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
FormsIntegrators< DomainEleOp >::Assembly< A >::BiLinearForm< I >::OpGradGrad< 1, FIELD_DIM, SPACE_DIM > OpGradGrad
constexpr IntegrationType I
#define EXECUTABLE_DIMENSION
ElementsAndOps< SPACE_DIM >::SideEle SideEle
constexpr auto field_name
FTensor::Index< 'm', 3 > m
SmartPetscObj< Vec > petscVec
DataAtIntegrationPts(MoFEM::Interface &m_field)
virtual MPI_Comm & get_comm() const =0
virtual int get_comm_rank() const =0
Deprecated interface functions.
Data on single entity (This is passed as argument to DataOperator::doWork)
structure to get information from mofem into EntitiesFieldData
Template struct for dimension-specific finite element types.
intrusive_ptr for managing petsc objects
boost::shared_ptr< std::map< int, BlockData > > intBlockSetsPtr
boost::shared_ptr< DataAtIntegrationPts > commonDataPtr
OpBlockChargeDensity(boost::shared_ptr< DataAtIntegrationPts > common_data_ptr, boost::shared_ptr< std::map< int, BlockData > > int_block_sets_ptr, const std::string &field_name)
MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, EntData &row_data, EntData &col_data)
boost::shared_ptr< DataAtIntegrationPts > commonDataPtr
boost::shared_ptr< map< int, BlockData > > permBlockSetsPtr
OpBlockPermittivity(boost::shared_ptr< DataAtIntegrationPts > common_data_ptr, boost::shared_ptr< map< int, BlockData > > perm_block_sets_ptr, const std::string &field_name)
MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
boost::shared_ptr< std::map< int, BlockData > > permBlockSetsPtr
boost::shared_ptr< MatrixDouble > djump
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
boost::shared_ptr< MatrixDouble > gradPtr
OpElectricDispJump(const std::string field_name, boost::shared_ptr< MatrixDouble > grad_ptr, boost::shared_ptr< MatrixDouble > d_jump, boost::shared_ptr< DataAtIntegrationPts > common_data_ptr, boost::shared_ptr< std::map< int, BlockData > > perm_block_sets_ptr)
boost::shared_ptr< DataAtIntegrationPts > commonDataPtr
OpElectricField(boost::shared_ptr< MatrixDouble > grad_u_negative, boost::shared_ptr< MatrixDouble > grad_u)
MoFEMErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
boost::shared_ptr< MatrixDouble > gradU
boost::shared_ptr< MatrixDouble > gradUNegative
boost::shared_ptr< std::map< int, BlockData > > elecBlockSetsPtr
SmartPetscObj< Vec > petscVec
OpElectrodeCharge(const std::string field_name, boost::shared_ptr< MatrixDouble > d_jump, SmartPetscObj< Vec > alpha_vec, boost::shared_ptr< std::map< int, BlockData > > electrode_block_sets_ptr)
boost::shared_ptr< MatrixDouble > dJumpPtr
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
boost::shared_ptr< MatrixDouble > gradUNegative
MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
boost::shared_ptr< DataAtIntegrationPts > commonDataPtr
boost::shared_ptr< std::map< int, BlockData > > permBlockSetsPtr
boost::shared_ptr< VectorDouble > energyDensity
OpEnergyDensity(const std::string &field_name, boost::shared_ptr< MatrixDouble > grad_u_negative, boost::shared_ptr< VectorDouble > energy_densiity_ptr, boost::shared_ptr< std::map< int, BlockData > > perm_block_sets_ptr, boost::shared_ptr< DataAtIntegrationPts > common_data_ptr)
boost::shared_ptr< std::map< int, BlockData > > permBlockSetsPtr
OpGradTimesPerm(const std::string &field_name, boost::shared_ptr< MatrixDouble > grad_u_negative, boost::shared_ptr< MatrixDouble > grad_times_perm, boost::shared_ptr< std::map< int, BlockData > > perm_block_sets_ptr, boost::shared_ptr< DataAtIntegrationPts > common_data_ptr)
boost::shared_ptr< MatrixDouble > gradTimesPerm
boost::shared_ptr< MatrixDouble > gradUNegative
boost::shared_ptr< DataAtIntegrationPts > commonDataPtr
MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
boost::shared_ptr< std::map< int, BlockData > > intDomainBlocksetsPtr
boost::shared_ptr< std::map< int, BlockData > > permBlockSetsPtr
boost::shared_ptr< DataAtIntegrationPts > commonDataPtr
SmartPetscObj< Vec > petscTotalEnergy
boost::shared_ptr< MatrixDouble > gradUNegative
OpTotalEnergy(const std::string &field_name, boost::shared_ptr< MatrixDouble > grad_u_negative, boost::shared_ptr< std::map< int, BlockData > > perm_block_sets_ptr, boost::shared_ptr< std::map< int, BlockData > > int_domain_block_sets_ptr, boost::shared_ptr< DataAtIntegrationPts > common_data_ptr, SmartPetscObj< Vec > petsc_vec_energy)
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)