| 5 | 1/1 | 返回列表 |
| 查看: 1269 | 回復: 7 | ||
| 當前只顯示滿足指定條件的回帖,點擊這里查看本話題的所有回帖 | ||
[求助]
fluent UDF編寫 已有2人參與
|
||
|
哪位大神能幫忙看下,為什么會有下面的錯誤,應該如何解決 Error: G:\\simulate\\UDF\\EvEn\\EvEn.c: line 22: invalid type conversion: int -> array 2 of float. 代碼如下: DEFINE_PROPERTY(argon_density, cell, thread) { real sigma[5][2] = { { 300, 1.6224 }, { 500, 0.9734 }, { 1000, 0.4867 }, { 1500, 0.32448 }, { 2000, 0.24336 } }; //錯誤就是這行Error: G:\\simulate\\UDF\\EvEn\\EvEn.c: line 22: invalid type conversion: int -> array 2 of float. real x[2], y[2]; real sigmaval; real temp; int n; temp = C_T(cell, thread); sigmaval = 1.6224; for (n = 0; n < 5; n++) { if ((temp>sigma[n][0]) && (temp <= sigma[n + 1][0])) { x[0] = sigma[n][0]; x[1] = sigma[n][1]; y[0] = sigma[n+1][0]; y[1] = sigma[n+1][1]; sigmaval = (y[1] - x[1]) / (y[0] - x[0])*(temp - x[0]) + x[1]; } } if (temp >2000) sigmaval = 0.24336; return sigmaval; } |
木蟲 (正式寫手)
|
沒有問題。 你是不是有多余的空格之類的? 我的可以編譯成功: DEFINE_PROPERTY(argon_density, cell, thread) {real sigma[5][2]={{300,1.6224},{500,0.9734},{1000,0.4867},{1500,0.32448},{2000,0.24336}}; real x[2], y[2]; real sigmaval; real temp; int n; temp = C_T(cell, thread); sigmaval = 1.6224; for (n = 0; n < 5; n++) { if ((temp>sigma[n][0]) && (temp <= sigma[n + 1][0])) {x[0] = sigma[n][0]; x[1] = sigma[n][1]; y[0] = sigma[n+1][0]; y[1] = sigma[n+1][1]; sigmaval = (y[1] - x[1]) / (y[0] - x[0])*(temp - x[0]) + x[1]; } } if (temp >2000) sigmaval = 0.24336; return sigmaval; } |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 一志愿太原理工安全工程300分,求調(diào)劑 +5 | 0857求調(diào)劑. 2026-03-24 | 6/300 |
|
|---|---|---|---|---|
|
[考研] 本科雙非材料,跨考一志愿華電085801電氣,283求調(diào)劑,任何專業(yè)都可以 +6 | 芝士雪baoo 2026-03-28 | 7/350 |
|
|
[考研] 311(085601)求調(diào)劑 +4 | liziyeyeye 2026-03-28 | 4/200 |
|
|
[考研] 本科新能源科學與工程,一志愿華理能動285求調(diào)劑 +3 | AZMK 2026-03-27 | 5/250 |
|
|
[考研] 085600,材料與化工321分求調(diào)劑 +9 | 大饞小子 2026-03-28 | 9/450 |
|
|
[考研] 求調(diào)劑 +3 | QiMing7 2026-03-25 | 4/200 |
|
|
[考研] 346求調(diào)劑 一志愿070303有機化學 +3 | 蘿卜燉青菜 2026-03-28 | 3/150 |
|
|
[考研] 304求調(diào)劑 +6 | 曼殊2266 2026-03-27 | 6/300 |
|
|
[考研] 材料與化工(0856)304求B區(qū)調(diào)劑 +8 | 邱gl 2026-03-27 | 8/400 |
|
|
[考研] 調(diào)劑 +3 | 好好讀書。 2026-03-28 | 3/150 |
|
|
[考研] 277跪求調(diào)劑 +5 | 1915668 2026-03-27 | 9/450 |
|
|
[考研] 0703化學/290求調(diào)劑/本科經(jīng)歷豐富/工科也可 +9 | 丹青奶蓋 2026-03-26 | 10/500 |
|
|
[考研] 291求調(diào)劑 +7 | 孅華 2026-03-22 | 7/350 |
|
|
[考研] 308求調(diào)劑 +7 | 墨墨漠 2026-03-25 | 7/350 |
|
|
[考研] 329求調(diào)劑 +7 | 鈕恩雪 2026-03-25 | 7/350 |
|
|
[考研] 中國科學院深圳先進技術研究院-光纖傳感課題組招生-中國科學院大學、深圳理工大學聯(lián)培 +5 | YangTyu1 2026-03-26 | 5/250 |
|
|
[考研] 化學調(diào)劑一志愿上海交通大學336分-本科上海211 +4 | 小魚愛有機 2026-03-25 | 4/200 |
|
|
[考研] 材料與化工304求B區(qū)調(diào)劑 +3 | 邱gl 2026-03-25 | 3/150 |
|
|
[考研] 284求調(diào)劑 +3 | yanzhixue111 2026-03-23 | 6/300 |
|
|
[論文投稿] 急發(fā)核心期刊論文 +3 | 賢達問津 2026-03-23 | 5/250 |
|