Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider accepting Fortran doubles to MUSICA-Fortran API functions #187

Open
mattldawson opened this issue Aug 7, 2024 · 0 comments
Open
Labels
question Further information is requested

Comments

@mattldawson
Copy link
Collaborator

Currently, MUSICA-Fortran API functions expect C types as arguments. e.g., here:

musica/fortran/micm.F90

Lines 247 to 261 in 42f5079

subroutine solve(this, time_step, temperature, pressure, air_density, num_concentrations, concentrations, &
num_user_defined_reaction_rates, user_defined_reaction_rates, solver_state, solver_stats, error)
use musica_util, only: string_t, string_t_c, error_t_c, error_t
class(micm_t) :: this
real(c_double), intent(in) :: time_step
real(c_double), intent(in) :: temperature
real(c_double), intent(in) :: pressure
real(c_double), intent(in) :: air_density
integer(c_int), intent(in) :: num_concentrations
real(c_double), intent(inout) :: concentrations(*)
integer(c_int), intent(in) :: num_user_defined_reaction_rates
real(c_double), intent(inout) :: user_defined_reaction_rates(*)
type(string_t), intent(out) :: solver_state
type(solver_stats_t), intent(out) :: solver_stats
type(error_t), intent(out) :: error

Consider modifying these functions to accept Fortran types (whose kind is defined as a parameter in a shared constants module), and then copying scalars to C types internally and passing arrays as type(c_ptr) instead of, e.g., real(kind=c_double)

@mattldawson mattldawson added the question Further information is requested label Aug 7, 2024
@mattldawson mattldawson added this to the MICM, TUV-x in CAM-SIMA milestone Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant