|
| v0.14.0
|
◆ PhotonDiffusion() [1/2]
◆ PhotonDiffusion() [2/2]
◆ assembleSystem() [1/2]
◆ assembleSystem() [2/2]
- Examples
- photon_diffusion.cpp.
Definition at line 284 of file initial_diffusion.cpp.
290 auto add_domain_base_ops = [&](
auto &pipeline) {
291 auto jac_ptr = boost::make_shared<MatrixDouble>();
292 auto det_ptr = boost::make_shared<VectorDouble>();
298 auto add_domain_lhs_ops = [&](
auto &pipeline) {
300 "PHOTON_FLUENCE_RATE",
"PHOTON_FLUENCE_RATE",
301 [](
const double,
const double,
const double) {
return 1; }));
304 auto add_domain_rhs_ops = [&](
auto &pipeline) {
310 add_domain_base_ops(pipeline_mng->getOpDomainLhsPipeline());
311 add_domain_base_ops(pipeline_mng->getOpDomainRhsPipeline());
312 add_domain_lhs_ops(pipeline_mng->getOpDomainLhsPipeline());
313 add_domain_rhs_ops(pipeline_mng->getOpDomainRhsPipeline());
◆ boundaryCondition() [1/2]
◆ boundaryCondition() [2/2]
- Examples
- photon_diffusion.cpp.
Definition at line 257 of file initial_diffusion.cpp.
265 std::string entity_name = it->getName();
266 if (entity_name.compare(0, 3,
"INT") == 0) {
268 boundary_ents,
true);
272 Range boundary_verts;
275 boundary_ents.merge(boundary_verts);
279 simple->getProblemName(),
"PHOTON_FLUENCE_RATE", boundary_ents);
◆ checkResults()
◆ createCommonData()
◆ initialCondition() [1/2]
◆ initialCondition() [2/2]
◆ outputResults() [1/2]
◆ outputResults() [2/2]
- Examples
- photon_diffusion.cpp.
Definition at line 349 of file initial_diffusion.cpp.
353 auto post_proc_fe = boost::make_shared<PostProcEle>(
mField);
355 auto u_ptr = boost::make_shared<VectorDouble>();
356 post_proc_fe->getOpPtrVector().push_back(
361 post_proc_fe->getOpPtrVector().push_back(
365 post_proc_fe->getPostProcMesh(), post_proc_fe->getMapGaussPts(),
367 {{
"PHOTON_FLUENCE_RATE", u_ptr}},
377 pipeline_mng->getDomainRhsFE() = post_proc_fe;
378 CHKERR pipeline_mng->loopFiniteElements();
379 CHKERR post_proc_fe->writeFile(
"out_initial.h5m");
◆ readMesh() [1/2]
◆ readMesh() [2/2]
◆ runProgram() [1/2]
◆ runProgram() [2/2]
◆ setIntegrationRules() [1/2]
◆ setIntegrationRules() [2/2]
◆ setupProblem() [1/2]
◆ setupProblem() [2/2]
- Examples
- photon_diffusion.cpp.
Definition at line 151 of file initial_diffusion.cpp.
182 MOFEM_LOG(
"INITIAL", Sev::inform) <<
"Refractive index: " <<
n;
183 MOFEM_LOG(
"INITIAL", Sev::inform) <<
"Speed of light (cm/ns): " <<
c;
185 <<
"Phase velocity in medium (cm/ns): " <<
v;
187 <<
"Absorption coefficient (cm^-1): " <<
mu_a;
189 <<
"Scattering coefficient (cm^-1): " <<
mu_sp;
190 MOFEM_LOG(
"INITIAL", Sev::inform) <<
"Diffusion coefficient D : " <<
D;
198 MOFEM_LOG(
"INITIAL", Sev::inform) <<
"Approximation order: " <<
order;
◆ solveSystem() [1/2]
◆ solveSystem() [2/2]
- Examples
- photon_diffusion.cpp.
Definition at line 318 of file initial_diffusion.cpp.
322 auto solver = pipeline_mng->createKSP();
324 CHKERR KSPSetFromOptions(solver);
327 auto dm =
simple->getDM();
331 MOFEM_LOG(
"INITIAL", Sev::inform) <<
"Solver start";
333 CHKERR VecGhostUpdateBegin(X, INSERT_VALUES, SCATTER_FORWARD);
334 CHKERR VecGhostUpdateEnd(X, INSERT_VALUES, SCATTER_FORWARD);
338 <<
"writing vector in binary to " <<
out_file_name <<
" ...";
340 PetscViewerBinaryOpen(PETSC_COMM_WORLD,
out_file_name, FILE_MODE_WRITE,
343 PetscViewerDestroy(&viewer);
345 MOFEM_LOG(
"INITIAL", Sev::inform) <<
"Solver done";
◆ sourceFunction()
Pulse is infinitely short.
- Note
- It is good approximation of pulse in femtosecond scale. To make it longer one can apply third integral over time.
-
Note analysis in photon_diffusion is shifted in time by initial_time.
- Parameters
-
- Returns
- double
Definition at line 94 of file initial_diffusion.cpp.
99 auto phi_pulse = [&](
const double r_s,
const double phi_s) {
100 const double xs = r_s * cos(phi_s);
101 const double ys = r_s * sin(phi_s);
106 const double P1 = xp * xp + yp * yp + zp1 * zp1;
107 const double P2 = xp * xp + yp * yp + zp2 * zp2;
108 return r_s * (exp(-P1 /
A) - exp(-P2 /
A));
111 auto f = [&](
const double r_s) {
112 auto g = [&](
const double phi_s) {
return phi_pulse(r_s, phi_s); };
113 return gauss_kronrod<double, 15>::integrate(
114 g, 0, 2 * M_PI, 0, std::numeric_limits<float>::epsilon());
118 gauss_kronrod<double, 15>::integrate(
119 f, 0,
beam_radius, 0, std::numeric_limits<float>::epsilon());
◆ boundaryLhsFEPtr
boost::shared_ptr<FEMethod> PhotonDiffusion::boundaryLhsFEPtr |
|
private |
◆ boundaryMarker
boost::shared_ptr<std::vector<unsigned char> > PhotonDiffusion::boundaryMarker |
|
private |
◆ boundaryRhsFEPtr
boost::shared_ptr<FEMethod> PhotonDiffusion::boundaryRhsFEPtr |
|
private |
◆ commonDataPtr
boost::shared_ptr<CommonData> PhotonDiffusion::commonDataPtr |
|
private |
◆ domainLhsFEPtr
boost::shared_ptr<FEMethod> PhotonDiffusion::domainLhsFEPtr |
|
private |
◆ mField
The documentation for this struct was generated from the following files:
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
double mu_sp
scattering coefficient (cm^-1)
Problem manager is used to build and partition problems.
boost::shared_ptr< CommonData > commonDataPtr
virtual MPI_Comm & get_comm() const =0
virtual int get_comm_rank() const =0
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, 1 > OpDomainMass
PipelineManager interface.
MoFEMErrorCode setIntegrationRules()
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
Simple interface for fast problem set-up.
double flux_magnitude
impulse magnitude
MoFEMErrorCode readMesh()
MoFEMErrorCode setupProblem()
const double c
speed of light (cm/ns)
#define CHKERR
Inline error check.
auto createDMVector(DM dm)
Get smart vector from DM.
auto createGhostVector(MPI_Comm comm, PetscInt n, PetscInt N, PetscInt nghost, const PetscInt ghosts[])
Create smart ghost vector.
virtual moab::Interface & get_moab()=0
Simple interface for fast problem set-up.
MoFEM::Interface & mField
MoFEMErrorCode initialCondition()
double mu_a
absorption coefficient (cm^-1)
void simple(double P1[], double P2[], double P3[], double c[], const int N)
BcMapByBlockName & getBcMapByBlockName()
Get the bc map.
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
Get value at integration points for scalar field.
const double n
refractive index of diffusive medium
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, 1 > OpDomainSource
MoFEMErrorCode solveSystem()
MoFEMErrorCode boundaryCondition()
const double v
phase velocity of light in medium (cm/ns)
boost::shared_ptr< FEMethod > & getDomainLhsFE()
MoFEMErrorCode assembleSystem()
#define MOFEM_LOG(channel, severity)
Log.
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
Set inverse jacobian to base functions.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
PetscErrorCode PetscOptionsGetScalar(PetscOptions *, const char pre[], const char name[], PetscScalar *dval, PetscBool *set)
static double sourceFunction(const double x, const double y, const double z)
Pulse is infinitely short.
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
OpCalculateHOJacForVolume OpCalculateHOJacVolume
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
Post post-proc data at points from hash maps.
MoFEMErrorCode outputResults()