24小时热门版块排行榜    

CyRhmU.jpeg
查看: 9211  |  回复: 6
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

haofayi

银虫 (正式写手)

[求助] comsol中分段函数的输入已有3人参与

请教朋友,comsol 里温度是矩形波,简单地说,t=0-12h,  温度=298K, t=12-24h,温度=308K,在参数设置里怎么输入?? 我看到有个论坛上说是T=298*(t>=0 & t<=12)+308*(t>12 & t<=24) , 但输入后提示不对。  不知道如何处理??万分感谢。  还看到有用 int1(T) 的,这个可以吗??这个函数什么意思?
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

努力吧
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zws8745987

木虫 (正式写手)

楼主解决了吗?怎么做的?
7楼2019-04-04 16:30:30
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 7 个回答

hanshoubao

新虫 (初入文坛)

自定义分段函数

[ 发自小木虫客户端 ]
2楼2015-03-06 22:06:49
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

relive012429

铁杆木虫 (职业作家)

【答案】应助回帖

★ ★ ★ ★ ★ ★
感谢参与,应助指数 +1
haofayi: 金币+6, ★★★很有帮助 2015-03-07 14:47:05
在comsol里面有自定义的分段函数,和数学公式一样定义的啊,piecewise函数
Move forward with grateful heart.
3楼2015-03-07 13:27:00
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

564265182

木虫 (小有名气)

【答案】应助回帖

感谢参与,应助指数 +1
软件界面,help>search "step function" 里面有详细说明:
PARAMETERS
Enter a Location (s0) of the step. The value of the step function is the initial level for input values that are smaller than the location of the step. In the From field, enter a start level (Lstart . In the To field, enter a final level (Lend). For an input variable s, a start location s0, and initial level Lstart and a final level Lend, the step function’s value is Lstart for s < s0 and Lend for s ≥ s0.

不过对于瞬态问题求解,为了保证这阶跃点附近点的结果精度以及模型的收敛,不建议直接step阶跃函数。函数说分段的,这断点处没办法微分运算。需要高级选项做平滑处理。

在global>definitions>functions> step
function name step1
parameters    location 12;   from 298;   to 308
smoothing     size of transition zone 0.05或者更小,number of continuous derivatives 2或者1
后面调用step1 函数了,

当然也可以选用你提到的interpolation插值函数
相应的 t f(t) 填入关键点,如 0,298; 11.95,298;12,303;  12.05,308;  24,308. 会生成需要的函数
以后调用int1 函数

总之需要避免剧烈的突变造成的函数不连续,真实情况温度也不是跳变的。
4楼2015-03-09 11:30:09
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
信息提示
请填处理意见