Skip to content

Commit

Permalink
Rename bc->wrk to bc->usrwrk in documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
aprilnovak committed Jul 8, 2023
1 parent 06cb7eb commit 48356da
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 67 deletions.
34 changes: 17 additions & 17 deletions doc/content/source/problems/NekRSProblem.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ is always the same in `nrs->usrwrk`, but with any unused slots cleared out.
!table id=usrwrk_nrsp caption=Quantities written into the scratch space array by Cardinal. In the last column, `n` indicates that the value is case-dependent depending on what features you have enabled.
| Slice | Quantity | When Will It Be Created? | How to Access in the `.oudf` File |
| :- | :- | :- | :- |
| 0 | Boundary heat flux | if `boundary` is set on `NekRSMesh` | `bc->wrk[n * bc->fieldOffset + bc->idM]` |
| 1 | Volumetric heat source | if `volume` is true on `NekRSMesh` | `bc->wrk[n * bc->fieldOffset + bc->idM]` |
| 2 | Mesh x-displacement | if `moving_mesh` is true on `NekRSMesh` | `bc->wrk[n * bc->fieldOffset + bc->idM]` |
| 3 | Mesh y-displacement | if `moving_mesh` is true on `NekRSMesh` | `bc->wrk[n * bc->fieldOffset + bc->idM]` |
| 4 | Mesh z-displacement | if `moving_mesh` is true on `NekRSMesh` | `bc->wrk[n * bc->fieldOffset + bc->idM]` |
| 0 | Boundary heat flux | if `boundary` is set on `NekRSMesh` | `bc->usrwrk[n * bc->fieldOffset + bc->idM]` |
| 1 | Volumetric heat source | if `volume` is true on `NekRSMesh` | `bc->usrwrk[n * bc->fieldOffset + bc->idM]` |
| 2 | Mesh x-displacement | if `moving_mesh` is true on `NekRSMesh` | `bc->usrwrk[n * bc->fieldOffset + bc->idM]` |
| 3 | Mesh y-displacement | if `moving_mesh` is true on `NekRSMesh` | `bc->usrwrk[n * bc->fieldOffset + bc->idM]` |
| 4 | Mesh z-displacement | if `moving_mesh` is true on `NekRSMesh` | `bc->usrwrk[n * bc->fieldOffset + bc->idM]` |

The total number of slots in the scratch space that are allocated by Cardinal
is controlled with the `n_usrwrk_slots` parameter.
Expand All @@ -171,17 +171,17 @@ would print out at the start of your simulation. You could use slices 1 onwards
for custom purposes.

!listing id=l11 caption=Table printed at start of Cardinal simulation that describes available scratch space for a case that couples NekRS to MOOSE via volumetric power density, but not via boundaries or a moving mesh. A total of 7 slots are allocated by setting `n_usrwrk_slots` to 7
------------------------------------------------------------------
| Slice | Quantity | How to Access in NekRS BCs |
------------------------------------------------------------------
| 0 | heat_source | bc->wrk[0 * bc->fieldOffset + bc->idM] |
| 1 | unused | bc->wrk[1 * bc->fieldOffset + bc->idM] |
| 2 | unused | bc->wrk[2 * bc->fieldOffset + bc->idM] |
| 3 | unused | bc->wrk[3 * bc->fieldOffset + bc->idM] |
| 4 | unused | bc->wrk[4 * bc->fieldOffset + bc->idM] |
| 5 | unused | bc->wrk[5 * bc->fieldOffset + bc->idM] |
| 6 | unused | bc->wrk[6 * bc->fieldOffset + bc->idM] |
------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
| Quantity | How to Access (.oudf) | How to Access (.udf) |
---------------------------------------------------------------------------------------------------
| heat_source | bc->usrwrk[0 * bc->fieldOffset + bc->idM] | nrs->usrwrk[0 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[1 * bc->fieldOffset + bc->idM] | nrs->usrwrk[1 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[2 * bc->fieldOffset + bc->idM] | nrs->usrwrk[2 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[3 * bc->fieldOffset + bc->idM] | nrs->usrwrk[3 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[4 * bc->fieldOffset + bc->idM] | nrs->usrwrk[4 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[5 * bc->fieldOffset + bc->idM] | nrs->usrwrk[5 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[6 * bc->fieldOffset + bc->idM] | nrs->usrwrk[6 * nrs->fieldOffset + n] |
---------------------------------------------------------------------------------------------------

!include seg_fault_warning.md

Expand All @@ -193,7 +193,7 @@ boundary for normalization (stored in the postprocessor `flux_integral`) are sen
to NekRS.
Then, all that is required to use a heat flux transferred by MOOSE is to
apply it in the `scalarNeumannConditions` boundary condition.
Below, `bc->wrk` is the same as `nrs->o_usrwrk`, or the scratch space on the
Below, `bc->usrwrk` is the same as `nrs->o_usrwrk`, or the scratch space on the
device; this function applies the heat flux computed by MOOSE to the flux boundaries.

!listing /test/tests/cht/pebble/onepebble2.oudf language=cpp
Expand Down
44 changes: 22 additions & 22 deletions doc/content/source/problems/NekRSSeparateDomainProblem.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ is always the same in `nrs->usrwrk`, but with any unused slots cleared out.
!table id=usrwrk_nrssdp caption=Quantities written into the scratch space array by Cardinal. In the last column, `n` indicates that the value is case-dependent depending on what features you have enabled.
| Slice | Quantity | When Will It Be Created? | How to Access in the `.oudf` File |
| :- | :- | :- | :- |
| 0 | Inlet velocity | if `coupling_type` includes `inlet` | `bc->wrk[n * bc->fieldOffset + bc->idM]` |
| 1 | Inlet temperature | if `coupling_type` includes `inlet` and NekRS's case files include a temperature solve | `bc->wrk[n * bc->fieldOffset + bc->idM]` |
| 2 | Inlet scalar01 | if `coupling_type` includes `inlet` and `coupled_scalars` includes `scalar01` | `bc->wrk[n * bc->fieldOffset + bc->idM]` |
| 3 | Inlet scalar02 | if `coupling_type` includes `inlet` and `coupled_scalars` includes `scalar02` | `bc->wrk[n * bc->fieldOffset + bc->idM]` |
| 4 | Inlet scalar03 | if `coupling_type` includes `inlet` and `coupled_scalars` includes `scalar03` | `bc->wrk[n * bc->fieldOffset + bc->idM]` |
| 0 | Inlet velocity | if `coupling_type` includes `inlet` | `bc->usrwrk[n * bc->fieldOffset + bc->idM]` |
| 1 | Inlet temperature | if `coupling_type` includes `inlet` and NekRS's case files include a temperature solve | `bc->usrwrk[n * bc->fieldOffset + bc->idM]` |
| 2 | Inlet scalar01 | if `coupling_type` includes `inlet` and `coupled_scalars` includes `scalar01` | `bc->usrwrk[n * bc->fieldOffset + bc->idM]` |
| 3 | Inlet scalar02 | if `coupling_type` includes `inlet` and `coupled_scalars` includes `scalar02` | `bc->usrwrk[n * bc->fieldOffset + bc->idM]` |
| 4 | Inlet scalar03 | if `coupling_type` includes `inlet` and `coupled_scalars` includes `scalar03` | `bc->usrwrk[n * bc->fieldOffset + bc->idM]` |

The total number of slots in the scratch space that are allocated by Cardinal
is controlled with the `n_usrwrk_slots` parameter.
Expand All @@ -163,17 +163,17 @@ A table similar to the following would print out at the start of your simulation
You could use slices 2 onwards for custom purposes.

!listing id=l11 caption=Table printed at start of Cardinal simulation that describes available scratch space for a case that couples NekRS to MOOSE via an inlet and with the second passive scalar, but without the first passive scalar or a temperature solve. A total of 7 slots are allocated by setting `n_usrwrk_slots` to 7
------------------------------------------------------------------
| Slice | Quantity | How to Access in NekRS BCs |
------------------------------------------------------------------
| 0 | velocity | bc->wrk[0 * bc->fieldOffset + bc->idM] |
| 1 | scalar02 | bc->wrk[1 * bc->fieldOffset + bc->idM] |
| 2 | unused | bc->wrk[2 * bc->fieldOffset + bc->idM] |
| 3 | unused | bc->wrk[3 * bc->fieldOffset + bc->idM] |
| 4 | unused | bc->wrk[4 * bc->fieldOffset + bc->idM] |
| 5 | unused | bc->wrk[5 * bc->fieldOffset + bc->idM] |
| 6 | unused | bc->wrk[6 * bc->fieldOffset + bc->idM] |
------------------------------------------------------------------
------------------------------------------------------------------------------------------------
| Quantity | How to Access (.oudf) | How to Access (.udf) |
------------------------------------------------------------------------------------------------
| velocity | bc->usrwrk[0 * bc->fieldOffset + bc->idM] | nrs->usrwrk[0 * nrs->fieldOffset + n] |
| scalar02 | bc->usrwrk[1 * bc->fieldOffset + bc->idM] | nrs->usrwrk[1 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[2 * bc->fieldOffset + bc->idM] | nrs->usrwrk[2 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[3 * bc->fieldOffset + bc->idM] | nrs->usrwrk[3 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[4 * bc->fieldOffset + bc->idM] | nrs->usrwrk[4 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[5 * bc->fieldOffset + bc->idM] | nrs->usrwrk[5 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[6 * bc->fieldOffset + bc->idM] | nrs->usrwrk[6 * nrs->fieldOffset + n] |
------------------------------------------------------------------------------------------------

!include seg_fault_warning.md

Expand All @@ -194,7 +194,7 @@ Example for a flat velocity(x) profile:
!listing language=cpp
void velocityDirichletConditions(bcData *bc)
{
bc->u = bc->wrk[bc->idM];
bc->u = bc->usrwrk[bc->idM];
bc->v = 0.0;
bc->w = 0.0;
}
Expand All @@ -204,10 +204,10 @@ Example for a flat temperature and scalar profiles:
!listing language=cpp
void scalarDirichletConditions(bcData *bc)
{
if(bc->scalarId==0) bc->s = bc->wrk[bc->idM + bc->fieldOffset]; // temperature
if(bc->scalarId==1) bc->s = bc->wrk[bc->idM + 2*bc->fieldOffset]; // scalar01
if(bc->scalarId==2) bc->s = bc->wrk[bc->idM + 3*bc->fieldOffset]; // scalar02
if(bc->scalarId==3) bc->s = bc->wrk[bc->idM + 4*bc->fieldOffset]; // scalar03
if(bc->scalarId==0) bc->s = bc->usrwrk[bc->idM + bc->fieldOffset]; // temperature
if(bc->scalarId==1) bc->s = bc->usrwrk[bc->idM + 2*bc->fieldOffset]; // scalar01
if(bc->scalarId==2) bc->s = bc->usrwrk[bc->idM + 3*bc->fieldOffset]; // scalar02
if(bc->scalarId==3) bc->s = bc->usrwrk[bc->idM + 4*bc->fieldOffset]; // scalar03
}

Example for fully-developed velocity(x) profile for laminar pipe flow:
Expand All @@ -219,7 +219,7 @@ void velocityDirichletConditions(bcData *bc)
dfloat zi = bc->z;
dfloat rsq = yi*yi + zi*zi;
dfloat Rsq = 0.5*0.5; // Radius^2
dfloat Uavg = bc->wrk[bc->idM];
dfloat Uavg = bc->usrwrk[bc->idM];

bc->u = 2*Uavg*(1-rsq/Rsq);
bc->v = 0.0;
Expand Down
4 changes: 2 additions & 2 deletions doc/content/source/problems/seg_fault_warning.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
!alert warning
Allocation of `nrs->usrwrk` and `nrs->o_usrwrk` is done automatically.
If you attempt to run a NekRS input file that accesses `bc->wrk` in the
If you attempt to run a NekRS input file that accesses `bc->usrwrk` in the
`.oudf` file *without* a Cardinal executable (e.g. like
`nrsmpi case 4`), then that scratch space will have to be manually allocated in
the `.udf` file, or else your input will seg fault. This will not be typically
encountered by most users, but if you really do want to run the NekRS input files
intended for a Cardinal case with the NekRS executable (perhaps for debugging),
we recommend simply replacing `bc->wrk` by a dummy value, such as `bc->flux = 0.0`
we recommend simply replacing `bc->usrwrk` by a dummy value, such as `bc->flux = 0.0`
for the boundary heat flux use case. This just replaces a value that normally comes from MOOSE by a fixed
value. All other aspects of the NekRS case files should not require modification.
24 changes: 12 additions & 12 deletions doc/content/source/userobjects/NekScalarValue.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ When running the input file, you will then see a table like the following print:
How to Access: C++ code to use in NekRS files; for the .udf instructions,
'n' indicates a loop variable over GLL points
---------------------------------------------------------------------------------------------
| Quantity | How to Access (.oudf) | How to Access (.udf) |
---------------------------------------------------------------------------------------------
| scalar1 | bc->wrk[0 * bc->fieldOffset + 0] | nrs->usrwrk[0 * nrs->fieldOffset + 0] |
| scalar2 | bc->wrk[0 * bc->fieldOffset + 1] | nrs->usrwrk[0 * nrs->fieldOffset + 1] |
| unused | bc->wrk[1 * bc->fieldOffset + bc->idM] | nrs->usrwrk[1 * nrs->fieldOffset + n] |
| unused | bc->wrk[2 * bc->fieldOffset + bc->idM] | nrs->usrwrk[2 * nrs->fieldOffset + n] |
| unused | bc->wrk[3 * bc->fieldOffset + bc->idM] | nrs->usrwrk[3 * nrs->fieldOffset + n] |
| unused | bc->wrk[4 * bc->fieldOffset + bc->idM] | nrs->usrwrk[4 * nrs->fieldOffset + n] |
| unused | bc->wrk[5 * bc->fieldOffset + bc->idM] | nrs->usrwrk[5 * nrs->fieldOffset + n] |
| unused | bc->wrk[6 * bc->fieldOffset + bc->idM] | nrs->usrwrk[6 * nrs->fieldOffset + n] |
---------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
| Quantity | How to Access (.oudf) | How to Access (.udf) |
------------------------------------------------------------------------------------------------
| scalar1 | bc->usrwrk[0 * bc->fieldOffset + 0] | nrs->usrwrk[0 * nrs->fieldOffset + 0] |
| scalar2 | bc->usrwrk[0 * bc->fieldOffset + 1] | nrs->usrwrk[0 * nrs->fieldOffset + 1] |
| unused | bc->usrwrk[1 * bc->fieldOffset + bc->idM] | nrs->usrwrk[1 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[2 * bc->fieldOffset + bc->idM] | nrs->usrwrk[2 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[3 * bc->fieldOffset + bc->idM] | nrs->usrwrk[3 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[4 * bc->fieldOffset + bc->idM] | nrs->usrwrk[4 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[5 * bc->fieldOffset + bc->idM] | nrs->usrwrk[5 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[6 * bc->fieldOffset + bc->idM] | nrs->usrwrk[6 * nrs->fieldOffset + n] |
------------------------------------------------------------------------------------------------
```

Suppose we want to use these two scalar values to set a Dirichlet temperature boundary
Expand Down
2 changes: 1 addition & 1 deletion doc/content/tutorials/cht1.md
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ input in the `.oudf` file. For each function, the `bcData` object contains all i
about the current boundary that is "calling" the function; `bc->id` is the boundary ID,
`bc->s` is the scalar (temperature) solution at the present [!ac](GLL) point, and
`bc->flux` is the flux (of temperature) at the present [!ac](GLL) point. The
`bc->wrk` array is a scratch space to which the heat flux values coming from MOOSE are
`bc->usrwrk` array is a scratch space to which the heat flux values coming from MOOSE are
written. These OCCA functions then get called directly within NekRS.

Finally, the `fluid.udf` file contains user-defined C++ functions through
Expand Down
2 changes: 1 addition & 1 deletion doc/content/tutorials/cht2.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ flux boundaries, or `f` for the `[TEMPERATURE]` block. Other settings are largel

The assignment of boundary condition values is performed in the
`sfr_7pin.oudf` file, shown below. Note that for boundaries 1 and 2, where we want to receive
heat flux from MOOSE, we set the value of the flux equal to `bc->wrk[bc->idM]`, or
heat flux from MOOSE, we set the value of the flux equal to `bc->usrwrk[bc->idM]`, or
the scratch array that is written by [NekRSProblem](/problems/NekRSProblem.md).

!listing /tutorials/sfr_7pin/sfr_7pin.oudf language=cpp
Expand Down
22 changes: 11 additions & 11 deletions doc/content/tutorials/nekrs_stochastic.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,17 +300,17 @@ solve which shows:
How to Access: C++ code to use in NekRS files; for the .udf instructions,
'n' indicates a loop variable over GLL points
---------------------------------------------------------------------------------------------
| Quantity | How to Access (.oudf) | How to Access (.udf) |
---------------------------------------------------------------------------------------------
| flux | bc->wrk[0 * bc->fieldOffset + bc->idM] | nrs->usrwrk[0 * nrs->fieldOffset + n] |
| k | bc->wrk[1 * bc->fieldOffset + 0] | nrs->usrwrk[1 * nrs->fieldOffset + 0] |
| unused | bc->wrk[2 * bc->fieldOffset + bc->idM] | nrs->usrwrk[2 * nrs->fieldOffset + n] |
| unused | bc->wrk[3 * bc->fieldOffset + bc->idM] | nrs->usrwrk[3 * nrs->fieldOffset + n] |
| unused | bc->wrk[4 * bc->fieldOffset + bc->idM] | nrs->usrwrk[4 * nrs->fieldOffset + n] |
| unused | bc->wrk[5 * bc->fieldOffset + bc->idM] | nrs->usrwrk[5 * nrs->fieldOffset + n] |
| unused | bc->wrk[6 * bc->fieldOffset + bc->idM] | nrs->usrwrk[6 * nrs->fieldOffset + n] |
---------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
| Quantity | How to Access (.oudf) | How to Access (.udf) |
------------------------------------------------------------------------------------------------
| flux | bc->usrwrk[0 * bc->fieldOffset + bc->idM] | nrs->usrwrk[0 * nrs->fieldOffset + n] |
| k | bc->usrwrk[1 * bc->fieldOffset + 0] | nrs->usrwrk[1 * nrs->fieldOffset + 0] |
| unused | bc->usrwrk[2 * bc->fieldOffset + bc->idM] | nrs->usrwrk[2 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[3 * bc->fieldOffset + bc->idM] | nrs->usrwrk[3 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[4 * bc->fieldOffset + bc->idM] | nrs->usrwrk[4 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[5 * bc->fieldOffset + bc->idM] | nrs->usrwrk[5 * nrs->fieldOffset + n] |
| unused | bc->usrwrk[6 * bc->fieldOffset + bc->idM] | nrs->usrwrk[6 * nrs->fieldOffset + n] |
------------------------------------------------------------------------------------------------
```

This table will show you how the [NekScalarValues](https://cardinal.cels.anl.gov/source/userobjects/NekScalarValue.html)
Expand Down
2 changes: 1 addition & 1 deletion doc/content/tutorials/pincell_multiphysics.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ and temperature to a linear variation from 0 at the inlet to 1 at the outlet.

In the `.oudf` file, we define boundary conditions. On the flux boundary, we will
be sending a heat flux from MOOSE into NekRS, so we set the flux equal to the scratch
space array, `bc->wrk[bc->idM]`.
space array, `bc->usrwrk[bc->idM]`.

!listing /tutorials/pincell_multiphysics/fluid.oudf language=cpp

Expand Down

0 comments on commit 48356da

Please sign in to comment.