代码拉取完成,页面将自动刷新
#include "../include/exhaust_system.h"
#include "../include/units.h"
ExhaustSystem::ExhaustSystem() {
m_primaryFlowRate = 0;
m_outletFlowRate = 0;
m_collectorCrossSectionArea = 0;
m_length = 0;
m_primaryTubeLength = 0;
m_audioVolume = 0;
m_velocityDecay = 0;
m_flow = 0;
m_index = -1;
m_impulseResponse = nullptr;
}
ExhaustSystem::~ExhaustSystem() {
/* void */
}
void ExhaustSystem::initialize(const Parameters ¶ms) {
const double systemWidth = std::sqrt(params.collectorCrossSectionArea);
const double volume = params.collectorCrossSectionArea * params.length;
const double systemLength = params.length;
m_system.initialize(
units::pressure(1.0, units::atm),
volume,
units::celcius(25.0));
m_system.setGeometry(
systemLength,
systemWidth,
1.0,
0.0);
m_atmosphere.initialize(
units::pressure(1.0, units::atm),
units::volume(1000.0, units::m3),
units::celcius(25.0));
m_atmosphere.setGeometry(
units::distance(10.0, units::m),
units::distance(10.0, units::m),
1.0,
0.0);
m_primaryFlowRate = params.primaryFlowRate;
m_audioVolume = params.audioVolume;
m_outletFlowRate = params.outletFlowRate;
m_collectorCrossSectionArea = params.collectorCrossSectionArea;
m_velocityDecay = params.velocityDecay;
m_impulseResponse = params.impulseResponse;
m_length = params.length;
m_primaryTubeLength = params.primaryTubeLength;
}
void ExhaustSystem::destroy() {
/* void */
}
void ExhaustSystem::process(double dt) {
GasSystem::Mix airMix;
airMix.p_fuel = 0;
airMix.p_inert = 1.0;
airMix.p_o2 = 0.0;
m_atmosphere.reset(units::pressure(1.0, units::atm), units::celcius(25.0), airMix);
GasSystem::FlowParameters flowParams;
flowParams.crossSectionArea_0 = m_collectorCrossSectionArea;
flowParams.crossSectionArea_1 = units::area(10, units::m2);
flowParams.direction_x = 1.0;
flowParams.direction_y = 0.0;
flowParams.dt = dt;
flowParams.system_0 = &m_atmosphere;
flowParams.system_1 = &m_system;
flowParams.k_flow = m_outletFlowRate;
m_flow = m_system.flow(flowParams);
m_system.dissipateExcessVelocity();
m_system.updateVelocity(dt, m_velocityDecay);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。