Femtet2026.0マクロヘルプ/マニュアル
 

平均温度の計算

'//////////////////////////////////////////////

'     積分実行

'//////////////////////////////////////////////

Sub ExecInteg()

    

    Set Gogh = Femtet.Gogh

    

    Dim BtrArray(0) As Long

    Dim dT_ave As New CComplex

    Dim dTV As New CComplex

    Dim dV As New CComplex

    

    '積分するBodyAttributeの設定

    BtrArray(0) = 0

       

    ' 積分実行

    If Gogh.IntegralAtBody(BtrArray, AddressOf CalcTV, dTV) = False Then

        Femtet.ShowLastError

    End If

 

    ' 積分実行

    If Gogh.IntegralAtBody(BtrArray, AddressOf CalcV, dV) = False Then

        Femtet.ShowLastError

    End If

    

    dT_ave.Real = dTV.Real / dV.Real

    

    '結果表示

    MsgBox dT_ave.Real, vbInformation, "平均温度"

    

End Sub

 

 

'////////////////////////////////////////////

'     被積分関数

'////////////////////////////////////////////

Sub CalcTV(cVal As CComplex)

    Set Gogh = Femtet.Gogh

    

    ' 温度

    Dim T As New CComplex

    Gogh.Watt.Potential = WATT_TEMPERATURE_C

    Gogh.Watt.Integral.GetPotential T

    

    cVal.Real = T.Real

End Sub

 

 

'////////////////////////////////////////////

'     被積分関数

'////////////////////////////////////////////

Sub CalcV(cVal As CComplex)

    cVal.Real = 1

End Sub