0

Subroutines in Fortran user-written model

I am wondering if I can use subroutines/functions inside the model Fortran code, similarly to how we use functions in other coding languages?

This is just to simplify the code, so instead of having several instances of the same code block, I can just call the subroutine with the relevant inputs/outputs.

Thanks

jordbud's avatar
1
jordbud
asked 2026-07-13 22:11:43 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

Yes, you can write functions and subroutines and use them in several user models.

perolofl's avatar
3.8k
perolofl
answered 2026-07-14 12:14:16 -0500
edit flag offensive 0 remove flag delete link

Comments

If I am using VARs and CONs, will I need to store them before calling the subroutine, then recall them inside the subroutine? Or am I able to pass the variables directly into the subroutine and return the modified value?

jordbud's avatar jordbud (2026-07-22 20:34:01 -0500) edit
add a comment see more comments

Your Answer

Login/Signup to Answer