v0.12.1
Classes | Typedefs | Functions | Variables
photon_diffusion.cpp File Reference
#include <stdlib.h>
#include <cmath>
#include <BasicFiniteElements.hpp>

Go to the source code of this file.

Classes

struct  ElementsAndOps< DIM >
 
struct  Monitor
 [Push operators to pipeline] More...
 
struct  PhotonDiffusion
 

Typedefs

using DomainEle = VolumeElementForcesAndSourcesCore
 [Define dimension] More...
 
using DomainEleOp = DomainEle::UserDataOperator
 
using BoundaryEle = FaceElementForcesAndSourcesCore
 
using BoundaryEleOp = BoundaryEle::UserDataOperator
 
using PostProcEle = PostProcVolumeOnRefinedMesh
 
using OpDomainMass = FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, 1 >
 
using OpDomainGradGrad = FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpGradGrad< 1, 1, SPACE_DIM >
 
using OpDomainTimesScalarField = FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpBaseTimesScalarField< 1 >
 
using OpDomainGradTimesVec = FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpGradTimesTensor< 1, 1, SPACE_DIM >
 
using OpDomainSource = FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, 1 >
 
using OpBoundaryMass = FormsIntegrators< BoundaryEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, 1 >
 
using OpBoundaryTimeScalarField = FormsIntegrators< BoundaryEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpBaseTimesScalarField< 1 >
 
using OpBoundarySource = FormsIntegrators< BoundaryEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, 1 >
 

Functions

int main (int argc, char *argv[])
 

Variables

static char help [] = "...\n\n"
 
constexpr int SPACE_DIM = 3
 [Define dimension] More...
 
double n = 1.44
 refractive index of diffusive medium More...
 
double c = 30.
 speed of light (cm/ns) More...
 
double v = c / n
 phase velocity of light in medium (cm/ns) More...
 
double mu_a = 0.09
 absorption coefficient (cm^-1) More...
 
double mu_sp = 16.5
 scattering coefficient (cm^-1) More...
 
double flux = 1e3
 impulse magnitude More...
 
double duration = 0.05
 impulse duration (ns) More...
 
PetscBool from_initial = PETSC_TRUE
 
PetscBool output_volume = PETSC_FALSE
 
int order = 3
 
int save_every_nth_step = 1
 
double A = 3.0
 
double h = 0.5 / A
 convective heat coefficient More...
 
double D = 1. / (3. * (mu_a + mu_sp))
 
double inv_v = 1. / v
 

Typedef Documentation

◆ BoundaryEle

Definition at line 37 of file photon_diffusion.cpp.

◆ BoundaryEleOp

Definition at line 38 of file photon_diffusion.cpp.

◆ DomainEle

[Define dimension]

Definition at line 35 of file photon_diffusion.cpp.

◆ DomainEleOp

Definition at line 36 of file photon_diffusion.cpp.

◆ OpBoundaryMass

using OpBoundaryMass = FormsIntegrators<BoundaryEleOp>::Assembly< PETSC>::BiLinearForm<GAUSS>::OpMass<1, 1>
Examples
photon_diffusion.cpp.

Definition at line 52 of file photon_diffusion.cpp.

◆ OpBoundarySource

using OpBoundarySource = FormsIntegrators<BoundaryEleOp>::Assembly< PETSC>::LinearForm<GAUSS>::OpSource<1, 1>

Definition at line 56 of file photon_diffusion.cpp.

◆ OpBoundaryTimeScalarField

Examples
photon_diffusion.cpp.

Definition at line 54 of file photon_diffusion.cpp.

◆ OpDomainGradGrad

using OpDomainGradGrad = FormsIntegrators<DomainEleOp>::Assembly< PETSC>::BiLinearForm<GAUSS>::OpGradGrad<1, 1, SPACE_DIM>
Examples
photon_diffusion.cpp.

Definition at line 43 of file photon_diffusion.cpp.

◆ OpDomainGradTimesVec

using OpDomainGradTimesVec = FormsIntegrators<DomainEleOp>::Assembly< PETSC>::LinearForm<GAUSS>::OpGradTimesTensor<1, 1, SPACE_DIM>
Examples
photon_diffusion.cpp.

Definition at line 47 of file photon_diffusion.cpp.

◆ OpDomainMass

using OpDomainMass = FormsIntegrators<DomainEleOp>::Assembly< PETSC>::BiLinearForm<GAUSS>::OpMass<1, 1>
Examples
photon_diffusion.cpp.

Definition at line 41 of file photon_diffusion.cpp.

◆ OpDomainSource

using OpDomainSource = FormsIntegrators<DomainEleOp>::Assembly< PETSC>::LinearForm<GAUSS>::OpSource<1, 1>
Examples
photon_diffusion.cpp.

Definition at line 49 of file photon_diffusion.cpp.

◆ OpDomainTimesScalarField

Examples
photon_diffusion.cpp.

Definition at line 45 of file photon_diffusion.cpp.

◆ PostProcEle

Definition at line 39 of file photon_diffusion.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)
Examples
photon_diffusion.cpp.

Definition at line 469 of file photon_diffusion.cpp.

469  {
470 
471  // Initialisation of MoFEM/PETSc and MOAB data structures
472  const char param_file[] = "param_file.petsc";
473  MoFEM::Core::Initialize(&argc, &argv, param_file, help);
474 
475  // Add logging channel for example
476  auto core_log = logging::core::get();
477  core_log->add_sink(
478  LogManager::createSink(LogManager::getStrmWorld(), "PHOTON"));
479  LogManager::setLog("PHOTON");
480  MOFEM_LOG_TAG("PHOTON", "photon_diffusion")
481 
482  // Error handling
483  try {
484  // Register MoFEM discrete manager in PETSc
485  DMType dm_name = "DMMOFEM";
486  CHKERR DMRegister_MoFEM(dm_name);
487 
488  // Create MOAB instance
489  moab::Core mb_instance; // mesh database
490  moab::Interface &moab = mb_instance; // mesh database interface
491 
492  // Create MoFEM instance
493  MoFEM::Core core(moab); // finite element database
494  MoFEM::Interface &m_field = core; // finite element interface
495 
496  // Run the main analysis
497  PhotonDiffusion heat_problem(m_field);
498  CHKERR heat_problem.runProgram();
499  }
500  CATCH_ERRORS;
501 
502  // Finish work: cleaning memory, getting statistics, etc.
504 
505  return 0;
506 }
std::string param_file
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:385
#define CHKERR
Inline error check.
Definition: definitions.h:548
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition: DMMMoFEM.cpp:59
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
Definition: LogManager.hpp:340
CoreTmp< 0 > Core
Definition: Core.hpp:1095
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1949
static char help[]
Core (interface) class.
Definition: Core.hpp:92
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition: Core.cpp:85
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:125
Deprecated interface functions.

Variable Documentation

◆ A

double A = 3.0

◆ c

double c = 30.

speed of light (cm/ns)

Examples
photon_diffusion.cpp.

Definition at line 60 of file photon_diffusion.cpp.

◆ D

double D = 1. / (3. * (mu_a + mu_sp))
Examples
photon_diffusion.cpp.

Definition at line 76 of file photon_diffusion.cpp.

◆ duration

double duration = 0.05

impulse duration (ns)

Examples
photon_diffusion.cpp.

Definition at line 65 of file photon_diffusion.cpp.

◆ flux

double flux = 1e3

impulse magnitude

Examples
UnsaturatedFlow.hpp, hcurl_divergence_operator_2d.cpp, and photon_diffusion.cpp.

Definition at line 64 of file photon_diffusion.cpp.

◆ from_initial

PetscBool from_initial = PETSC_TRUE
Examples
photon_diffusion.cpp.

Definition at line 67 of file photon_diffusion.cpp.

◆ h

double h = 0.5 / A

convective heat coefficient

Examples
PlasticOpsMonitor.hpp, and photon_diffusion.cpp.

Definition at line 75 of file photon_diffusion.cpp.

◆ help

char help[] = "...\n\n"
static
Examples
photon_diffusion.cpp.

Definition at line 27 of file photon_diffusion.cpp.

◆ inv_v

double inv_v = 1. / v
Examples
photon_diffusion.cpp.

Definition at line 77 of file photon_diffusion.cpp.

◆ mu_a

double mu_a = 0.09

absorption coefficient (cm^-1)

Examples
photon_diffusion.cpp.

Definition at line 62 of file photon_diffusion.cpp.

◆ mu_sp

double mu_sp = 16.5

scattering coefficient (cm^-1)

Examples
photon_diffusion.cpp.

Definition at line 63 of file photon_diffusion.cpp.

◆ n

double n = 1.44

refractive index of diffusive medium

Examples
photon_diffusion.cpp.

Definition at line 59 of file photon_diffusion.cpp.

◆ order

int order = 3
Examples
photon_diffusion.cpp.

Definition at line 70 of file photon_diffusion.cpp.

◆ output_volume

PetscBool output_volume = PETSC_FALSE
Examples
photon_diffusion.cpp.

Definition at line 68 of file photon_diffusion.cpp.

◆ save_every_nth_step

int save_every_nth_step = 1

◆ SPACE_DIM

constexpr int SPACE_DIM = 3
constexpr

[Define dimension]

Examples
photon_diffusion.cpp.

Definition at line 32 of file photon_diffusion.cpp.

◆ v

double v = c / n

phase velocity of light in medium (cm/ns)

Examples
photon_diffusion.cpp.

Definition at line 61 of file photon_diffusion.cpp.