mam
v1.0
A Modal Aerosol Model
Toggle main menu visibility
Main Page
Related Pages
Modules
Modules List
Module Members
All
a
c
d
g
k
l
m
n
o
p
r
s
v
w
Functions/Subroutines
a
c
d
g
l
m
n
o
p
r
s
v
w
Variables
Data Types List
Data Types List
Data Types
Class Hierarchy
Data Fields
All
a
c
d
g
i
l
m
n
p
r
s
v
w
Functions/Subroutines
a
c
d
g
l
m
n
p
r
s
v
w
Variables
Files
File List
File Members
All
Functions/Subroutines
Variables
•
All
Classes
Namespaces
Files
Functions
Variables
Pages
doxygen_files
code_structure.F90
Go to the documentation of this file.
1
!> \page code_structure MAM Code Structure
2
!!
3
!! MAM code is being developed to demonstrate the possibility of
4
!! applying a common interface for aerosol packages that host models can
5
!! use to maintan the state of an aerosol system, retrieve aerosol
6
!! properties required by other model components, and advance the aerosol
7
!! state during a simulation.
8
!!
9
!! It is also being developed to apply contemporary best practice for
10
!! design and testing. This document lays out the science requirements and
11
!! design principles for MAM, provides an overview of the refactored
12
!! codebase, and describes in more detail specific parts of the code where
13
!! object-oriented design patterns have been applied to components of the
14
!! MAM codebase.
15
!!
16
!! ## Software Requirements ##
17
!!
18
!! ### Aerosol–Radiation Interface ###
19
!!
20
!! - Permit radiation schemes to use whatever wavelength grid they want
21
!! and not have to be aware of the native wavelength grid of the
22
!! aerosol package
23
!!
24
!! - Perform expensive setup for optical property calculations during
25
!! initialization (reading files, setting up interpolations, etc.)
26
!!
27
!! - Remove assumptions of the way aerosols are represented from the
28
!! radiation code (mode number, size, shape, sectional schemes, etc.)
29
!!
30
!! - Allow radiation schemes interested in optical properties to maintain
31
!! their own wavelength grids (i.e., not have aerosol packages maintain
32
!! grids for every scheme that needs aerosol optical properties)
33
!!
34
!! ## Design Principles ##
35
!!
36
!! MAM is being developed according to the
37
!! [recommendations for MUSICA contributors](https://ncar.github.io/musica-core/html/contributors.html)
38
!! and following the
39
!! [MUSICA style guide](https://ncar.github.io/musica-core/html/coding_style.html).
40
!! Here we outline some specific design principles from these guides
41
!! that are particularly relevant to the MAM code structure, and briefly
42
!! describe how they are acheived.
43
!!
44
!! - An aerosol package shoud compile as a library with a clearly defined
45
!! application programming interface (API).
46
!! - The [MAM GitHub repository](https://github.com/NCAR/mam)
47
!! includes CMake configurations that
48
!! allow a user to build the MAM library. Interactions with MAM primarily
49
!! occur through instances of the \c mam_core::core_t class. Documentation for the
50
!! \c mam_core::core_t class acts as the MAM API. Integration tests included
51
!! in the repository can be used as examples of how to use the MAM API.
52
!!
53
!! - An aerosol package should be comprised of functions that are of
54
!! limited, clearly defined scope and purpose for readability and testability.
55
!! - Functions are almost all less than 40 lines long. Functions are
56
!! designed to do one specific task, with clear documentation. Function
57
!! arguments are clearly defined with units.
58
!!
59
!! - An aerosol package should employ automated testing with a
60
!! combination of integration and unit tests, with a goal of 100% code
61
!! coverage by unit tests.
62
!! - The MAM library, along with the \c aerosol and \c musica-core
63
!! libraries it links to, use CMake with CTest to maintain the suite of
64
!! tests. GitHub Actions automates testing, document generation, and code
65
!! coverage assessment using \c gcov. [CodeCov.io](https://about.codecov.io/)
66
!! is used to visualize the coverage reports.
67
!!
68
!! - An aerosol package should employ data and implementation hiding to
69
!! the extent possible to facilitate the interoperability of aerosol
70
!! packages with distinct parameterizations and ways of representing
71
!! aerosol systems.
72
!! - The MAM code base is object-oriented with almost entirely private
73
!! class data members. Aerosol information and functionality are exposed
74
!! through type-bound procedures of each class.
75
!!
76
!! ## Codebase Overview ##
77
!!
78
!! ### Library Structure ###
79
!!
80
!! The MAM software packages comprises three libraries, each of which
81
!! provides specific functionality required to simulate the modal aerosol
82
!! system.
83
!!
84
!! - \b musica-core: The [musica-core](https://github.com/NCAR/musica-core)
85
!! library includes a set of classes that perform general, reusable
86
!! tasks and are applicable to a variety of MUSICA software components,
87
!! including MAM. Some \c musica-core classes used by MAM are
88
!! \c string_t, \c config_t, \c io_t, \c grid_t, and \c
89
!! interpolator_t. These are described in more detail below and in the
90
!! [musica-core documentation](https://ncar.github.io/musica-core/index.html)
91
!!
92
!! - \b aerosol-interface: The
93
!! [aerosol-interface](https://github.com/NCAR/aerosol-interface)
94
!! library defines the common aerosol API used for MUSICA aerosol
95
!! packages including MAM.
96
!! The \c aerosol-interface library also includes some classes for
97
!! general use by aerosol packages that expose the API.
98
!! These include the \c wavelength_grid_t, optics_t, and
99
!! \c environmental_state_t classes.
100
!!
101
!! - \b mam: The [mam](https://github.com/NCAR/mam) library provides
102
!! the core functionality needed to simulate the modal aerosol system
103
!! exposed through the common aerosol API. The primary interactions
104
!! through instances of the \c mam_core::core_t class, which manages
105
!! MAM aerosol configuration, and instances of the
106
!! \c mam_core::state_t class, which maintains the state of a MAM
107
!! aerosol.
108
!!
109
!! ### Object Structure ###
110
!!
111
!! The MAM class diagram including classes from the \c aerosol-interface
112
!! and \c musica-core libraries is shown below
113
!!
114
!! \htmlinclude doc/doxygen_files/images/mam-class-diagram.html
115
!!
116
!! The boxes of various color indicate general functionality provided by
117
!! sets of related classes.
118
!!
119
!! Things to note in the class structure:
120
!!
121
!! - both the whole MAM aerosol and individual modes extend the aerosol
122
!! API. This would allow a radiation or other package work with the
123
!! full set of modes or a single mode interchangeably, similar to the
124
!! effect of applying the Composite Pattern.
125
!!
126
!! - Interpolators apply the Strategy Pattern, whereby you can specify
127
!! how you want an interpolation to be calculated when you create an
128
!! \b interpolator_t object. See
129
!! [here](https://ncar.github.io/musica-core/html/structmusica__interpolator_1_1interpolator__t.html#details)
130
!! for an example of how to use \c interpolator_t objects.
131
!!
132
!! - Reusable components, like \c interpolator_t, \c lookup_axis_t,
133
!! \c lookup_2D_axis_t, and \c grid_t, are
134
!! included in the \c musica-core library and can be extended if needed
135
!! for specific applications, as in the case of \c wavelength_grid_t.
136
!!
137
!! - Class data members are private.
138
!!
139
!! - Class, variable, and function names are meaningful and include
140
!! units where applicable
141
!!
142
!! ### Workflow ###
143
!!
144
!! The over workflow for MAM interactions with radiaion are show below.
145
!!
146
!! #### Initialization ####
147
!! \htmlinclude doc/doxygen_files/images/mam-radiation-workflow-initialization.html
148
!!
149
!! #### Run-Time ####
150
!! \htmlinclude doc/doxygen_files/images/mam-radiation-workflow-runtime.html
151
!!
152
!! ### Testing ###
153
!!
154
!! Tests are stored in the \c test/ folder with integration tests in
155
!! \c test/integration/ and unit tests in \c test/unit/. There are
156
!! currently two integration tests:
157
!!
158
!! - \b current_cam: This test was extracted from the CAM code base and
159
!! used to test against during development of the refactored MAM--RRTMG
160
!! interactions.
161
!!
162
!! - \b radiation: This test serves as an example of how an arbitrary
163
!! radiation package can interact with MAM. The results of the optical
164
!! property calculations are not evaluated.
165
!!
166
!! The unit tests are organized into files of the same name as those in
167
!! \b src/ with additional mock classes and configuration files.
168
!!
Generated on Mon Aug 15 2022 15:01:05 for mam by
1.9.4