AIBECS.jl icon indicating copy to clipboard operation
AIBECS.jl copied to clipboard

DSL with macros?

Open briochemc opened this issue 6 years ago • 2 comments

Maybe worth reworking the interface to be simpler and yielding more efficient code. I was thinking of something along the lines of

  1. Define tracers, e.g., DIP, DOP, POP, DFe, DO₂, maybe with a macro like

    @define_tracers DIP DOP POP DFe DO₂
    
  2. Then define functions and who they apply to, maybe something like

    @add_BGC_sink DIP → uptake : 1 / τ * DIP^2 / (DIP + k) * (z ≤ zₑ)
    @add_BGC_source POP : σ * uptake
    @add_BGC_source DOP : (1-σ) * uptake
    @add_BGC_transfer DOP → DIP : kDOP * DOP
    @add_BGC_transfer POP → DOP : kPOP * POP
    @add_restoring DIP : DIPgeo τgeo
    @add_external_source DFe : aeolian_DFe_source
    etc.
    
  3. Then be able to pack/unpack the tracers and also create efficient inplace F (as suggested in #10)

briochemc avatar Aug 02 '19 00:08 briochemc

Somehow it might be nice to have a struct detailing the model generated as well, i.e., containing metadata about the model. See DSL branch for trials.

briochemc avatar Aug 20 '19 07:08 briochemc

Also might be good to replace the current parameter API into something like

@parameters "MyParams" begin
    a | 1.0u"m/s"
    b | 2.0u"m^2"
end

Hopefully this issue in FieldMetadata.jl will help!

briochemc avatar Feb 27 '20 01:02 briochemc