35 void Foam::DMDModels::STDMD::filterIndexed
38 const UList<label>& indices
42 List<Type> lstWithin(indices.size());
46 for (
const label i : indices)
48 lstWithin[j] = lst[i];
51 lst.transfer(lstWithin);
55 template<
class MatrixType>
56 void Foam::DMDModels::STDMD::filterIndexed
59 const UList<label>& indices
63 MatrixType matWithin(
labelPair(mat.m(), indices.size()));
67 for (
const label i : indices)
69 matWithin.subColumn(j) = mat.subColumn(i);
72 mat.transfer(matWithin);
77 bool Foam::DMDModels::STDMD::modes()
79 typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
80 typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
82 if (mesh_.foundObject<VolFieldType>(fieldName_))
84 return calcModes<VolFieldType>();
86 else if (mesh_.foundObject<SurfaceFieldType>(fieldName_))
88 return calcModes<SurfaceFieldType>();
95 template<
class GeoFieldType>
96 bool Foam::DMDModels::STDMD::calcModes()
98 typedef typename GeoFieldType::value_type Type;
101 if (magsi_.size() > nModes_)
103 magsi_.resize(nModes_);
107 const RMatrix primitiveMode(Qupper_*RxInv_);
112 for (
const label magi : magsi_)
118 "modeRe_" + std::to_string(modei)
119 +
"_" + fieldName_ +
"_" + name_,
120 mesh_.time().timeName(),
135 "modeIm_" + std::to_string(modei)
136 +
"_" + fieldName_ +
"_" + name_,
137 mesh_.time().timeName(),
148 if (modeRe.size() != 0 && !empty_)
150 if (patches_.empty())
152 auto&
re = modeRe.primitiveFieldRef();
153 auto& im = modeIm.primitiveFieldRef();
155 calcMode(
re, im, primitiveMode, magi);
162 mesh_.boundaryMesh().patchSet(patches_).sortedToc()
165 for (
const label patchi : patchis)
167 auto&
re = modeRe.boundaryFieldRef()[patchi];
168 auto& im = modeIm.boundaryFieldRef()[patchi];
170 calcMode(
re, im, primitiveMode, magi, rowi);
186 template<
class GeoFieldType>
187 typename std::enable_if
189 std::is_same<Foam::scalar, typename GeoFieldType::value_type>::value,
191 >
::type Foam::DMDModels::STDMD::calcMode
193 GeoFieldType& modeRe,
194 GeoFieldType& modeIm,
195 const RMatrix& primitiveMode,
200 const label szfld = modeRe.size();
202 for (label i = rowi; i < szfld + rowi; ++i)
205 for (label j = 0; j < evecs_.m(); ++j)
207 mode += primitiveMode(i, j)*evecs_(j, magi);
209 const label
k = (i-rowi)%szfld;
210 modeRe[
k] =
mode.real();
211 modeIm[
k] =
mode.imag();
216 template<
class GeoFieldType>
217 typename std::enable_if
219 !std::is_same<Foam::scalar, typename GeoFieldType::value_type>::value,
221 >
::type Foam::DMDModels::STDMD::calcMode
223 GeoFieldType& modeRe,
224 GeoFieldType& modeIm,
225 const RMatrix& primitiveMode,
230 const label szfld = modeRe.size();
231 const label szfldcmps =
234 for (label i = rowi; i < szfldcmps + rowi; ++i)
237 for (label j = 0; j < evecs_.m(); ++j)
239 mode += primitiveMode(i, j)*evecs_(j, magi);
241 const label
k = (i-rowi)%szfld;
242 const label m = (i-rowi)/szfld;
243 modeRe[
k][m] =
mode.real();
244 modeIm[
k][m] =
mode.imag();
const dimensionedScalar re
Classical electron radius: default SI units: [m].
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
label k
Boltzmann constant.
Ignore writing from objectRegistry::writeObject()
const dimensionSet dimless
Dimensionless.
static const char *const typeName
Typename for Field.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Pair< label > labelPair
A pair of labels.
List< label > labelList
A List of labels.
mode_t mode(const fileName &name, const bool followLink=true)
Return the file mode, normally following symbolic links.
Do not request registration (bool: false)
static constexpr const zero Zero
Global zero (0)