AIで遊んでみたCHATGPT
ダルシーワイズバッハだと租度(管の仕上がりの荒さ素材としての荒さ)
租度が高い→流れにくい
租度が低い→流れやすい
基本75mm以上の大口径の計算で行われる計算方式
材質と租度の参考値
材質 | 粗度(e)参考値(mm) |
---|---|
ステンレス鋼管(新品) | 0.002〜0.015 |
鋳鉄管(古い) | 0.26〜1.5 |
銅管 | 0.0015 |
塩ビ管 | 0.0015〜0.007 |
なんで、小口径で計算することとしたか
結論から言うと、ウエストン公式そのものは材質によって変わらないんだけど、
**摩擦係数や内部粗さ(粗度係数)**などが材質に依存してるから、
式に使う一部の値を変える必要がある
AI返答まま、まあ、そうなんだけど、一応給水管の水理計算の延長部分での精度のために
参考までに作成をAIに依頼した
ウエストン公式のまま使う(簡易・早い)
-
精度はやや落ちるが、材質問わずおおまかな設計用にはOK
-
とおるの現場で「50mm以下の給水管でステンレス配管を使う想定」なら、そのまま使っても大きくは外さない可能性大
案2:粗度を指定してダルシー・ワイズバッハ式に変更(精密計算)
-
こちらは次の形:
h=f⋅Ld⋅V22gh = f \cdot \frac{L}{d} \cdot \frac{V^2}{2g}
-
f
(摩擦係数)は、レイノルズ数と粗度から導出(or ムーディ図を使う)
AIが出したダルシーワイズバッハのソースコード
function darcy_calculator_shortcode() {
ob_start(); ?>
<form id="darcy-form">
<label for="pipeType">管種:</label>
<select id="pipeType" onchange="updateRoughness()">
<option value="polyethylene">ポリエチレン管</option>
<option value="stainless_steel">ステンレス鋼管</option>
<option value="pvc">塩ビ管</option>
<option value="cast_iron">鋳鉄管</option>
</select><br><br>
<label for="roughness">粗度 e(mm):</label>
<input type="text" id="roughness" readonly><br><br>
<label for="velocity">流速 V(m/s):</label>
<select id="velocity">
<option value="1.5">1.5</option>
<option value="2.0">2.0</option>
</select><br><br>
<label for="length">管長 L(m):</label>
<input type="number" id="length" step="0.1" required><br><br>
<label for="diameter">管内径 d(mm):</label>
<input type="number" id="diameter" step="0.1" required><br><br>
<button type="button" onclick="calculateDarcy()">計算する</button>
</form>
<p id="result"></p>
<script>
const roughnessMap = {
polyethylene: 0.0001,
stainless_steel: 0.0015,
pvc: 0.002,
cast_iron: 0.26
};
function updateRoughness() {
const type = document.getElementById("pipeType").value;
document.getElementById("roughness").value = roughnessMap[type];
}
function calculateDarcy() {
const V = parseFloat(document.getElementById("velocity").value);
const L = parseFloat(document.getElementById("length").value);
const d_mm = parseFloat(document.getElementById("diameter").value);
const d = d_mm / 1000;
const g = 9.8;
const pipeType = document.getElementById("pipeType").value;
const e = roughnessMap[pipeType];
document.getElementById("roughness").value = e;
const Re = (V * d) / (1e-6); // 動粘性係数:水で仮定 1e-6 m²/s
const relRoughness = e / d;
// Swamee-Jain 式で摩擦係数 f を求める
const f = 0.25 / Math.pow(
Math.log10((relRoughness / 3.7) + (5.74 / Math.pow(Re, 0.9))),
2
);
const h = f * (L / d) * ((V * V) / (2 * g));
document.getElementById("result").innerText =
`粗度 e = ${e} mm\nレイノルズ数 Re = ${Re.toFixed(0)}\n摩擦係数 f = ${f.toFixed(4)}\n損失水頭 h = ${h.toFixed(4)} m`;
}
// 初期設定
document.addEventListener('DOMContentLoaded', updateRoughness);
</script>
<?php
return ob_get_clean();
}
add_shortcode('darcy_calc', 'darcy_calculator_shortcode');
使い方
使い方
-
WordPressの「コードスニペット」や
functions.php
にコピペ -
投稿や固定ページに