-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoxygen.h
More file actions
47 lines (39 loc) · 1.59 KB
/
oxygen.h
File metadata and controls
47 lines (39 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef FIELDS_OXYGEN_H_
#define FIELDS_OXYGEN_H_
#include "core/pde.h"
#include "core/composite_field.h"
#include "infra/sim_param.h"
namespace bdm {
namespace skibidy {
// Oxygen PDE channel.
// Dermal vasculature supplies O2 at basement membrane. O2 diffuses through
// tissue and is consumed by cells. Source term reads the Vascular field for
// perfusion state, coupling O2 supply to explicit vessel integrity.
struct OxygenPDE : public PDE {
const char* GetName() const override { return fields::kOxygen; }
int GetId() const override { return fields::kOxygenId; }
void Init(Simulation* sim) override {
auto* sp = sim->GetParam()->Get<SimParam>();
DefineGrid(sim, sp->oxygen_diffusion, sp->oxygen_decay);
ModelInitializer::InitializeSubstance(GetId(),
[sp](real_t x, real_t y, real_t z) {
return GridContext::ExpDecay(z, sp->oxygen_basal_conc,
sp->oxygen_decay_length);
});
}
void ApplyWound(Simulation* sim, real_t cx, real_t cy, real_t r) override {
ZeroInWound(sim);
}
// Dermal O2 source: pins dermal voxels to target proportional to
// local vascular perfusion. All damage/recovery logic lives in VascularPDE.
void ApplySource(Simulation* sim, const CompositeField& fields) override {
auto* sp = sim->GetParam()->Get<SimParam>();
auto* o2_grid = Grid(sim);
auto* vasc_grid = fields.Grid(fields::kVascular, sim);
GridContext ctx(o2_grid, sp);
GridContext::PinDermal(o2_grid, vasc_grid, ctx, sp->oxygen_basal_conc);
}
};
} // namespace skibidy
} // namespace bdm
#endif // FIELDS_OXYGEN_H_