|
|
<!-- --- title: Developer Upgrade Guide (OpenFOAM-v1612) -->
|
|
|
|
|
|
[![home](/icons/home.svg "wiki home")](/home)
|
|
|
[![upgrade](/icons/chevrons-up.svg "upgrade guide")][upgrade-guide]
|
|
|
[![code](/icons/code.svg "coding patterns")][code-patterns]
|
|
|
|
|
|
[[_TOC_]]
|
|
|
|
|
|
## Geometric field access
|
|
|
|
|
|
The following examples show manipulation of `scalar` fields; similar constructs are used for other primitive types, i.e. `vector`, `sphericalTensor`, `symmTensor` and tensor classes.
|
|
|
|
|
|
### Internal field
|
|
|
|
|
|
OLD
|
|
|
```
|
|
|
const scalarField& isf = field.internalField();
|
|
|
scalarField& isf = field.internalField();
|
|
|
```
|
|
|
|
|
|
NEW
|
|
|
```
|
|
|
const scalarField& isf = field.primitiveField();
|
|
|
scalarField& isf = field.primitiveFieldRef();
|
|
|
```
|
|
|
|
|
|
### Dimensioned internal field
|
|
|
|
|
|
OLD
|
|
|
```
|
|
|
const volScalarField::DimensionedInternalField& dsf = field.dimensionedInternalField();
|
|
|
volScalarField::DimensionedInternalField& dsf = field.dimensionedInternalField();
|
|
|
```
|
|
|
|
|
|
NEW
|
|
|
```
|
|
|
const volScalarField::Internal& dsf = field()();
|
|
|
const volScalarField::Internal& dsf = field.internalField();
|
|
|
volScalarField::Internal& dsf = field.ref();
|
|
|
```
|
|
|
|
|
|
### Boundary field
|
|
|
|
|
|
OLD:
|
|
|
```
|
|
|
const volScalarField::GeometricBoundaryField& bsf = field.boundaryField();
|
|
|
volScalarField::GeometricBoundaryField& bsf = field.boundaryField();
|
|
|
```
|
|
|
|
|
|
NEW
|
|
|
```
|
|
|
const volScalarField::Boundary& bsf = field.boundaryField();
|
|
|
volScalarField::Boundary& bsf = field.boundaryFieldRef();
|
|
|
```
|
|
|
|
|
|
### Patch field
|
|
|
|
|
|
OLD
|
|
|
```
|
|
|
fvPatchScalarField& psf = ...
|
|
|
const volScalarField::DimensionedInternalField& dsf = psf.dimensionedInternalField();
|
|
|
|
|
|
const scalarField& psif = psf.internalField();
|
|
|
```
|
|
|
|
|
|
NEW
|
|
|
```
|
|
|
fvPatchScalarField& psf = ...
|
|
|
const volScalarField::Internal& dsf = psf.internalField();
|
|
|
|
|
|
const scalarField& psif = psf.primitiveField();
|
|
|
```
|
|
|
|
|
|
### Temporary fields
|
|
|
|
|
|
OLD:
|
|
|
```
|
|
|
tmp<volScalarField> tField = ...
|
|
|
volScalarField& non_const_field = tField();
|
|
|
const volScalarField& const_field = tField();
|
|
|
```
|
|
|
|
|
|
NEW
|
|
|
```
|
|
|
tmp<volScalarField> tField = ...
|
|
|
volScalarField& non_const_field = tField().ref();
|
|
|
const volScalarField& const_field = tField();
|
|
|
```
|
|
|
### Function objects
|
|
|
The `functionObjectState` class has been renamed `stateFunctionObject`
|
|
|
|
|
|
|
|
|
[code-patterns]: /coding/patterns/patterns
|
|
|
[upgrade-guide]: /upgrade/upgrade
|
|
|
|
|
|
[v1612-notes]: https://www.openfoam.com/releases/openfoam-v1612+/ |