Fortran90 function

Numerical methods and mathematical models of Elmer
Post Reply
ScientistRenzo
Posts: 57
Joined: 14 Mar 2021, 21:01
Antispam: Yes

Fortran90 function

Post by ScientistRenzo »

Hello. I have a complex heat source. I will try to learn how to make it myself, but maybe it will be easy for you :)

I wrote up a C language pseudocode description. I've never used time like this in C, by the way.

I would like 100 seconds of a heat source. And then the heat source to be 0, because I want to see how the object cools down.
note I use "++" (integer incrementation notation), yet I need more precision.
for example time_ON will be 1.2345

Code: Select all

double Period = 10;
double time = 0;
double time_ON = 4.567

while (time < 100)
{
    double tpulse = 0;

    for ( ; tpulse < time_ON && time < 100; tpulse++, time++)
    {
        Heat Source = (...)
    }

    for ( ; tpulse < Period && time < 100; tpulse++, time++)
    {
        Heat Source = (...)
    }
}

Heat Source = 0
The SIF video tutorial and ElmerProgrammer's tutorial have instructed me to use something of the form

Heat Source = Variable coordinate 1, coordinate 2, coordinate 3, time
Procedure "mymodule" "myprocedure"

where "mymodule" is a .f90 file and "myprocedure" is a FUNCTION in fortran90


Compile with
$ elmerf90 -o mymodule.so mymodule.f90 or
> elmerf90 -o mymodule.dll mymodule.f90
Last edited by ScientistRenzo on 24 Mar 2021, 17:16, edited 1 time in total.
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Fortran90 function

Post by kevinarden »

Post Reply