You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ Getting started with APECSS is easy. After downloading APECSS in the directory `
34
34
-````APECSS_DIR```` to the directory in which APECSS is located. Using bash, for instance, simply execute the command ````export APECSS_DIR=<path to APECSS>```` or, even better, add this command to your bash profile.
35
35
-````USRLIB_DIR```` to the directory in which libm.a or libm.dylib (the standard _math_ library) is located. This may, for instance, be ````/usr/lib64/```` on Linux systems or ````/usr/lib/```` on MacOS systems.
36
36
37
-
Now, navigate into the folder ````$APECSS_DIR/lib```` and execute ````./compile_lib.sh````. This shell script will compile the APECSS library using _cmake_ with the ````CMakeLists.txt```` file provided in this folder. By default, APECSS is compiled with double precision and in _Release_ mode, meaning all optimization flags are enabled. That's it, you've succesfully compiled APECSS!
37
+
Now, navigate into the folder ````$APECSS_DIR/lib```` and execute ````./compile_lib.sh````. This shell script will compile the APECSS library using _cmake_ with the ````CMakeLists.txt```` file provided in this folder. By default, APECSS is compiled with double precision and in _Release_ mode, meaning all optimization flags are enabled. That's it, you've successfully compiled APECSS!
38
38
39
39
There are several ways in which you can use the APECSS library. You can either incorporate selected features of APECSS into your own software or you can program an interface to use APECSS as a standalone program. Some representative examples are given in the ````$APECSS_DIR/examples```` directory. Each directory contains the following:
40
40
- A ````README.md```` file explaining the purpose and specificities of this/these example(s).
Copy file name to clipboardExpand all lines: documentation/chapters/using.tex
+49-17Lines changed: 49 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -192,38 +192,70 @@ \subsection{Structures}
192
192
193
193
\subsection{Important functions}
194
194
195
-
Here we briefly outline how to use some of the key functions of APECSS.
196
-
197
195
Whenever using APECSS, at least one {\tt APECSS\_Bubble} structure has to be available and, if multiple bubbles are part of a simulation, each bubble has to be represented by a separate {\tt APECSS\_Bubble} structure. A single {\tt APECSS\_Bubble} structure is allocated and initialized as follows:
The function {\tt apecss\_bubble\_initializestruct()} ensures that all pointers (to arrays, other structures and functions) that are part of the {\tt APECSS\_Bubble} structure are initialized to {\tt NULL}. This is important because the processing of options and any checks for allocation depend on {\tt NULL} to indicate that a given pointer in not yet allocated or not in use.
203
-
204
-
Once a {\tt APECSS\_Bubble} structure is allocated and initialize, default values ought to be set, the {\tt *.apecss} options file is to be read and the chosen options have to be processed. In the standalone examples found in {\tt\$APECSS\_DIR/examples} this is done with the falling function calls:
205
-
\begin{lstlisting}[style=CStyle]
206
-
apecss_options_setdefault(Bubble);
207
-
char OptionsDir[APECSS_STRINGLENGTH];
208
-
sprintf(OptionsDir, "./run.apecss"); // Relative path to the options file.
209
-
apecss_options_readfile(Bubble, OptionsDir);
210
-
apecss_options_process(Bubble);
201
+
Then, we wish to set default values for the bubble parameters and read the relevant options from the options file:
202
+
\begin{lstlisting}[style=CStyle,numbers=none]
203
+
apecss_bubble_setdefaultoptions(Bubble);
204
+
apecss_bubble_readoptions(Bubble, OptionsDir);
205
+
\end{lstlisting}\vspace{-0.75em}
206
+
While setting default values is strongly advised, it is optional. The relative path to the options file may be set as
207
+
\begin{lstlisting}[style=CStyle,numbers=none]
208
+
char OptionsDir[APECSS_STRINGLENGTH];
209
+
sprintf(OptionsDir, "./run.apecss"); // Relative path to the options file.
210
+
\end{lstlisting}
211
+
212
+
In general, the properties of a gas ({\tt struct APECSS\_Gas}), a liquid ({\tt struct APECSS\_Liquid}) and a gas-liquid interface ({\tt struct APECSS\_Interface}), as well as the parameters for the ODE solver ({\tt struct APECSS\_NumericsODE}), have to be associated with a bubble, through the structure pointers {\tt *Gas}, {\tt *Liquid}, {\tt *Interface} and {\tt *NumericsODE} readily available in the {\tt APECSS\_Bubble} structure. In a single-bubble simulation this is obviously straightforward, we have one gas, one liquid and one interface that are associated with the bubble. In addition we have one set of solver parameters. In a multi-bubble simulation, however, we likely also have, for instance, only a single liquid (i.e.~all bubbles are situated in the same body of liquid), to which, in this case, all bubbles are associated to. Generally, the user is free in defining as many gases, liquids, interfaces and sets of solver parameters as deemed necessary, the only rule is that each bubble has to be associated with a gas, a liquid, an interface and a single set of solver parameters. Once these structures holding the fluid properties and the solver parameters are allocated, default values ought to be set, the user-defined options are read from file and the bubble(s) is/are successfully associated with its/their desired fluid properties and solver parameters. For a single-bubble simulation, this may look in a general form like:
Note that opening and reading the options file from disk is a relatively expensive (we are talking about a few microseconds). For some of the single-bubble examples in {\tt\$APECSS\_DIR/examples} reading the options file is the most expensive operation by some margin. Therefore, if performance is of the essence, it might be worth hard coding the options instead of reading the options file.
235
+
236
+
After reading the options file, the {\tt apecss\_*\_processoptions()} functions are called to process options and make the relevant modeling choices:
237
+
\begin{lstlisting}[style=CStyle,numbers=none]
238
+
apecss_gas_processoptions(Gas);
239
+
apecss_liquid_processoptions(Liquid);
240
+
apecss_interface_processoptions(Interface);
241
+
apecss_odesolver_processoptions(NumericsODE);
242
+
apecss_bubble_processoptions(Bubble);
211
243
\end{lstlisting}\vspace{-0.75em}
212
-
While setting default values is advised, for instance using the function {\tt apecss\_options\_setdefault()}, it is optional. Processing the given options correctly, however, is critical to the working of APECSS and the using the function {\tt apecss\_options\_process()} is strongly encouraged.
244
+
Processing the given options correctlyis critical to the working of APECSS.
213
245
214
-
Now that all options have been read and processed, the bubble has to be initialized based on the given options. This includes, for instance, computing the initial gas density and, if applicablehardcore radius or co-volume.
215
-
\begin{lstlisting}[style=CStyle]
246
+
Now that all options have been read and processed, the bubble has to be initialized based on the given options. This includes, for instance, computing the initial gas pressure inside the bubble (if it is not specified by the user) or, if applicable, the hardcore radius of the bubble.
247
+
\begin{lstlisting}[style=CStyle,numbers=none]
216
248
apecss_bubble_initialize(Bubble);
217
-
\end{lstlisting}%\vspace{-0.75em}
249
+
\end{lstlisting}
218
250
219
251
The heart of APECSS is, of course, the solver. The solver is split into three separate functions that (i) initialize the solver, (ii) run the solver and (iii) wrap up (i.e.~finalize) the solver:
220
-
\begin{lstlisting}[style=CStyle]
252
+
\begin{lstlisting}[style=CStyle,numbers=none]
221
253
apecss_bubble_solver_initialize(Bubble);
222
254
apecss_bubble_solver_run(tend, Bubble);
223
255
apecss_bubble_solver_finalize(Bubble);
224
256
\end{lstlisting}\vspace{-0.75em}
225
257
The initialization of the solver with {\tt apecss\_bubble\_solver\_initialize()} makes sure all counters, the solution error variable and, if applicable, result variables are initialized correctly. The function {\tt apecss\_bubble\_solver\_run()} contains the time-stepping procedure that executes the solver until a specified end time {\tt tend}, given as the first argument of the function call. In the examples found in {\tt\$APECSS\_DIR/examples}, the function {\tt apecss\_bubble\_solver\_run()} is only called once with {\tt tend = Bubble->tEnd}, i.e.~the end of the simulation. However, the user is free to call the function {\tt apecss\_bubble\_solver\_run()} an \underline{arbitrary number of times}, with any meaningful end time. This facilitates coupling APECSS to other numerical software frameworks, where {\tt tend} then could for instance be the end of the next time-step of a fluid dynamics solver. As an example simply chopping the simulation up into five equal-sized parts would look like:
0 commit comments