Skip to content

Commit 72da1ec

Browse files
author
Francesco Rizzi
committed
doc: update default Galerkin page
1 parent 2a177fe commit 72da1ec

File tree

1 file changed

+37
-11
lines changed

1 file changed

+37
-11
lines changed

docs/source/endtoend/swe_galerkin_default.rst

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ Step 1: execute FOMs
4545
# from within $BUILDDIR/end-to-end-roms/2d_swe_galerkin_default
4646
python3 $REPOSRC/wf_foms.py --wf wf.yaml
4747
48-
When we run the FOM driver, the following C++ code is being executed:
48+
This driver script automates this first stage by creating input files,
49+
generating run directories and running the C++ executable
50+
to generate all the FOM train and test data at the points specified
51+
in the yaml file. For exposition purposes, we show below the actual
52+
C++ code executed during this stage to run a single FOM:
4953

5054
.. literalinclude:: ../../../end-to-end-roms/cpp/run_fom_explicit.hpp
5155
:language: cpp
@@ -66,6 +70,8 @@ At the end, doing ``tree -L 1 .`` should produce:
6670
├── plot.py
6771
└── wf.yaml
6872
73+
Where we see the run train and test directories and their corresponding IDs.
74+
6975
Step 2: offline rom
7076
-------------------
7177

@@ -74,8 +80,10 @@ Step 2: offline rom
7480
# from within $BUILDDIR/end-to-end-roms/2d_swe_galerkin_default
7581
python3 $REPOSRC/wf_offline_rom.py --wf wf.yaml
7682
77-
The offline rom takes care of using the FOM training data to compute the POD modes,
78-
and creates all data into an "offline_rom" subdirectory:
83+
The offline rom takes care of using the FOM training data to compute
84+
the POD modes, and creates all data into an "offline_rom" subdirectory.
85+
Specifically, in this case the demo specifies that *all* the training
86+
runs should be used to compute POD modes.
7987

8088
.. code-block:: bash
8189
@@ -88,7 +96,6 @@ and creates all data into an "offline_rom" subdirectory:
8896
├── state_singular_values.txt
8997
└── state_snapshots.bin
9098
91-
9299
Step 3: galerkin rom
93100
--------------------
94101

@@ -97,12 +104,31 @@ Step 3: galerkin rom
97104
# from within $BUILDDIR/end-to-end-roms/2d_swe_galerkin_default
98105
python3 $REPOSRC/wf_galerkin.py --wf wf.yaml
99106
100-
The following C++ code is being executed:
107+
This driver script automates all the Galerkin runs.
108+
Specifically, it creates all the run directories, writes all input files,
109+
prepares initial conditions and runs the actual Galerkin run at every test point.
110+
For exposition purposes, we show below the actual
111+
C++ code executed during this stage to run a single Galerkin run:
101112

102113
.. literalinclude:: ../../../end-to-end-roms/cpp/run_default_galerkin.hpp
103114
:language: cpp
104115
:lines: 57-79, 82-87, 92
105116

117+
More specifically, what happens here is the following:
118+
119+
- the total number of modes used varies and is computed by truncating
120+
the basis using the energy values specified in the workflow file
121+
at the top: the higher the target energy, the more modes it uses
122+
(the code doing this computes the energy of the singular
123+
values of the POD modes and truncate based on the target energy,
124+
and again this is done automatically by our driver script)
125+
126+
- the reduced initial condition is read from file but here simply
127+
corresponds to the projection of the FOM initial condition onto the basis
128+
129+
- note that we also monitor the evolution of the reduced state and
130+
store its history into file (this will be used for the postprocessing)
131+
106132
At the end, you should have the following directory structure:
107133

108134
.. code-block:: bash
@@ -154,22 +180,22 @@ you need to cleanup all the existing content, which can you easily do as follows
154180
# from within $BUILDDIR/end-to-end-roms/2d_swe_galerkin_default
155181
python3 clean.py
156182
157-
158-
- you can try to use a different simulation time for the train and test
159-
so that you can assess how the ROM performs in a time extrapolation regime:
183+
- a different simulation time for the train and test runs
184+
so that you can assess how the ROM performs in a time extrapolation regime.
185+
This can easily be done by just replacing:
160186

161187
.. code-block:: yaml
162188
163189
fom:
164190
# ...
165191
train:
166192
finalTime: 5.0
167-
193+
# ...
168194
test:
169195
finalTime: 6.0
170196

171-
- you can edit the ``parameterSpace`` section of the workflow file to
172-
add new test points for example as follows:
197+
- add new test points to the ``parameterSpace`` section of the workflow
198+
file to as follows:
173199

174200
.. code-block:: yaml
175201

0 commit comments

Comments
 (0)