Skip to content

Commit

Permalink
Merge pull request #13 from fedebenelli/4-work-on-the-documentation
Browse files Browse the repository at this point in the history
Added  more documentation and did some minor changes
  • Loading branch information
fedebenelli committed Feb 5, 2024
2 parents b5eee07 + 977ef9a commit c69cfac
Show file tree
Hide file tree
Showing 17 changed files with 1,076 additions and 872 deletions.
6 changes: 3 additions & 3 deletions doc/ford-front-matter.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ display: public
source: false
proc_internals: true
sort: permission-alpha
docmark_alt: -|
docmark: |
docmark_alt: !>
docmark: !
predocmark_alt: *
print_creation_date: true
creation_date: %Y-%m-%d %H:%M %z
md_extensions: markdown.extensions.toc
markdown.extensions.smarty
graph: true
license: MIT
license: MPL
page_dir:pages

{!../README.md!}
3 changes: 0 additions & 3 deletions doc/pages/subdir/index.md

This file was deleted.

8 changes: 4 additions & 4 deletions src/adiff/autodiff.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module yaeos_autodiff
!-| This module holds the diferent ways of automatic differentiation
use hyperdual_mod
implicit none
end module
!! This module holds the diferent ways of automatic differentiation
use hyperdual_mod
implicit none
end module
48 changes: 46 additions & 2 deletions src/adiff/autodiff_api/armodel_adiff_api.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
module yaeos_ar_models_hyperdual
!-| Module that contains the automatic differentiation logic for an Ar model
!! Module that contains the automatic differentiation logic for an Ar model.
!!
!! All that is needed to define an Ar model that uses automatic
!! differentiation with hyperdual numbers is to define a new derived type
!! that overloads the method to the Ar function that you want to use.
!! A minimal example follows:
!!
!! ```fortran
!! module newmodel
!! use yaeos_ar_models_hyperdual, only: ArModelAdiff
!!
!! type, extends(ArModelAdiff) :: YourNewModel
!! type(Substances) :: composition
!! real(8) :: parameters(:)
!! contains
!! procedure :: Ar => arfun
!! procedure :: get_v0 => v0
!! end type
!! contains
!! subroutine arfun(self, n, v, t, Ar)
!! class(YourNewModel), intent(in) :: self
!! type(hyperdual), intent(in) :: n(:) ! Number of moles
!! type(hyperdual), intent(in) :: v ! Volume [L]
!! type(hyperdual), intent(in) :: t ! Temperature [K]
!! type(hyperdual), intent(out) :: ar_value ! Residual Helmholtz Energy
!!
!! ! A very complicated residual helmholtz function of a mixture
!! Ar = sum(n) * v * t
!! end subroutine
!!
!! function v0(self, n, p, t)
!! class(YourNewModel), intent(in) :: self
!! real(pr), intent(in) :: n(:) ! Number of moles
!! real(pr), intent(in) :: p ! Pressure [bar]
!! real(pr), intent(in) :: t ! Temperature [K]
!! real(pr) :: v0
!!
!! v0 = self%parameters(3)
!! end function
!! ```
!!
!! A complete implementation of the PR76 Equation of State can me found in
!! `example/adiff/adiff_pr76.f90`
!!
use yaeos_constants, only: pr
use yaeos_models_ar, only: ArModel
use yaeos_autodiff
Expand Down Expand Up @@ -58,6 +101,8 @@ subroutine residual_helmholtz(&
end if
end if

Ar = d_Ar%f0

contains

subroutine get_dardn()
Expand Down Expand Up @@ -163,7 +208,6 @@ subroutine reset_vars()
d_v = v
d_t = t
end subroutine

end subroutine

end module
Loading

0 comments on commit c69cfac

Please sign in to comment.