Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
ae6d9359
Commit
ae6d9359
authored
Oct 20, 2011
by
andy
Browse files
BUG: Corrected basic source and derived classes I/O
parent
dd506c3f
Changes
13
Hide whitespace changes
Inline
Side-by-side
src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C
View file @
ae6d9359
...
...
@@ -75,11 +75,11 @@ Foam::actuationDiskSource::actuationDiskSource
)
:
basicSource
(
name
,
modelType
,
dict
,
mesh
),
dict
_
(
dict
.
subDict
(
modelType
+
"Coeffs"
)),
diskDir_
(
dict
_
.
lookup
(
"diskDir"
)),
Cp_
(
readScalar
(
dict
_
.
lookup
(
"Cp"
))),
Ct_
(
readScalar
(
dict
_
.
lookup
(
"Ct"
))),
diskArea_
(
readScalar
(
dict
_
.
lookup
(
"diskArea"
)))
coeffs
_
(
dict
.
subDict
(
modelType
+
"Coeffs"
)),
diskDir_
(
coeffs
_
.
lookup
(
"diskDir"
)),
Cp_
(
readScalar
(
coeffs
_
.
lookup
(
"Cp"
))),
Ct_
(
readScalar
(
coeffs
_
.
lookup
(
"Ct"
))),
diskArea_
(
readScalar
(
coeffs
_
.
lookup
(
"diskArea"
)))
{
Info
<<
" - creating actuation disk zone: "
<<
this
->
name
()
<<
endl
;
...
...
@@ -132,20 +132,8 @@ void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
void
Foam
::
actuationDiskSource
::
writeData
(
Ostream
&
os
)
const
{
os
<<
indent
<<
token
::
BEGIN_BLOCK
<<
incrIndent
<<
nl
;
os
.
writeKeyword
(
"name"
)
<<
this
->
name
()
<<
token
::
END_STATEMENT
<<
nl
;
if
(
dict_
.
found
(
"note"
))
{
os
.
writeKeyword
(
"note"
)
<<
string
(
dict_
.
lookup
(
"note"
))
<<
token
::
END_STATEMENT
<<
nl
;
}
os
<<
indent
<<
"actuationDisk"
;
os
<<
indent
<<
name_
<<
endl
;
dict_
.
write
(
os
);
os
<<
decrIndent
<<
indent
<<
token
::
END_BLOCK
<<
endl
;
}
...
...
@@ -153,13 +141,11 @@ bool Foam::actuationDiskSource::read(const dictionary& dict)
{
if
(
basicSource
::
read
(
dict
))
{
const
dictionary
&
sourceDict
=
dict
.
subDict
(
name
());
const
dictionary
&
subDictCoeffs
=
sourceDict
.
subDict
(
typeName
+
"Coeffs"
);
subDictCoeffs
.
readIfPresent
(
"diskDir"
,
diskDir_
);
subDictCoeffs
.
readIfPresent
(
"Cp"
,
Cp_
);
subDictCoeffs
.
readIfPresent
(
"Ct"
,
Ct_
);
subDictCoeffs
.
readIfPresent
(
"diskArea"
,
diskArea_
);
coeffs_
=
dict
.
subDict
(
typeName
+
"Coeffs"
);
coeffs_
.
readIfPresent
(
"diskDir"
,
diskDir_
);
coeffs_
.
readIfPresent
(
"Cp"
,
Cp_
);
coeffs_
.
readIfPresent
(
"Ct"
,
Ct_
);
coeffs_
.
readIfPresent
(
"diskArea"
,
diskArea_
);
checkData
();
...
...
src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H
View file @
ae6d9359
...
...
@@ -74,8 +74,8 @@ protected:
// Protected data
//-
Sub dictionary with actuationDisk informa
tion
const
dictionary
&
dict
_
;
//-
Coefficients dic
tion
ary
dictionary
coeffs
_
;
//- Disk area normal
vector
diskDir_
;
...
...
src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C
View file @
ae6d9359
...
...
@@ -277,28 +277,20 @@ bool Foam::basicSource::isActive()
void
Foam
::
basicSource
::
addSu
(
Foam
::
fvMatrix
<
vector
>&
Eqn
)
{
notImplemented
(
"Foam::basicSource addSu(Foam::fvMatrix<vector>& Eqn)"
);
notImplemented
(
"Foam::basicSource addSu(Foam::fvMatrix<vector>& Eqn)"
);
}
void
Foam
::
basicSource
::
addSu
(
Foam
::
fvMatrix
<
scalar
>&
Eqn
)
{
notImplemented
(
"Foam::basicSource addSu(Foam::fvMatrix<scalar>& Eqn)"
);
notImplemented
(
"Foam::basicSource addSu(Foam::fvMatrix<scalar>& Eqn)"
);
}
void
Foam
::
basicSource
::
setValue
(
Foam
::
fvMatrix
<
scalar
>&
Eqn
)
{
notImplemented
(
"Foam::basicSource setValue(Foam::fvMatrix<scalar>& Eqn)"
);
notImplemented
(
"Foam::basicSource setValue(Foam::fvMatrix<scalar>& Eqn)"
);
}
// ************************************************************************* //
src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceIO.C
View file @
ae6d9359
...
...
@@ -77,10 +77,9 @@ void Foam::basicSource::writeData(Ostream& os) const
bool
Foam
::
basicSource
::
read
(
const
dictionary
&
dict
)
{
const
dictionary
&
sourceDict
=
dict
.
subDict
(
name_
);
active_
=
readBool
(
sourceDict
.
lookup
(
"active"
));
timeStart_
=
readScalar
(
sourceDict
.
lookup
(
"timeStart"
));
duration_
=
readScalar
(
sourceDict
.
lookup
(
"duration"
));
active_
=
readBool
(
dict
.
lookup
(
"active"
));
timeStart_
=
readScalar
(
dict
.
lookup
(
"timeStart"
));
duration_
=
readScalar
(
dict
.
lookup
(
"duration"
));
return
true
;
}
...
...
src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.C
View file @
ae6d9359
...
...
@@ -51,12 +51,12 @@ Foam::basicSourceList::basicSourceList
forAllConstIter
(
dictionary
,
dict
,
iter
)
{
const
word
&
name
=
iter
().
keyword
();
const
dictionary
&
d
ict
=
iter
().
dict
();
const
dictionary
&
sourceD
ict
=
iter
().
dict
();
this
->
set
(
i
++
,
basicSource
::
New
(
name
,
d
ict
,
mesh
)
basicSource
::
New
(
name
,
sourceD
ict
,
mesh
)
);
}
}
...
...
@@ -108,7 +108,8 @@ bool Foam::basicSourceList::read(const dictionary& dict)
bool
allOk
=
true
;
forAll
(
*
this
,
i
)
{
bool
ok
=
this
->
operator
[](
i
).
read
(
dict
);
basicSource
&
bs
=
this
->
operator
[](
i
);
bool
ok
=
bs
.
read
(
dict
.
subDict
(
bs
.
name
()));
allOk
=
(
allOk
&&
ok
);
}
return
allOk
;
...
...
@@ -117,12 +118,6 @@ bool Foam::basicSourceList::read(const dictionary& dict)
bool
Foam
::
basicSourceList
::
writeData
(
Ostream
&
os
)
const
{
// Write size of list
os
<<
nl
<<
this
->
size
();
// Write beginning of contents
os
<<
nl
<<
token
::
BEGIN_LIST
;
// Write list contents
forAll
(
*
this
,
i
)
{
...
...
@@ -130,9 +125,6 @@ bool Foam::basicSourceList::writeData(Ostream& os) const
this
->
operator
[](
i
).
writeData
(
os
);
}
// Write end of contents
os
<<
token
::
END_LIST
<<
token
::
END_STATEMENT
<<
nl
;
// Check state of IOstream
return
os
.
good
();
}
...
...
src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/explicitSetValue.C
View file @
ae6d9359
...
...
@@ -72,11 +72,9 @@ void Foam::explicitSetValue::setFieldData(const dictionary& dict)
}
else
{
FatalErrorIn
(
"explicitSetValue::setFieldData"
)
<<
"header not OK "
<<
io
.
name
()
<<
exit
(
FatalError
);
FatalErrorIn
(
"explicitSetValue::setFieldData"
)
<<
"header not OK for field "
<<
io
.
name
()
<<
abort
(
FatalError
);
}
}
...
...
@@ -96,9 +94,9 @@ Foam::explicitSetValue::explicitSetValue
)
:
basicSource
(
name
,
modelType
,
dict
,
mesh
),
dict
_
(
dict
.
subDict
(
modelType
+
"Coeffs"
))
coeffs
_
(
dict
.
subDict
(
modelType
+
"Coeffs"
))
{
setFieldData
(
dict
_
.
subDict
(
"fieldData"
));
setFieldData
(
coeffs
_
.
subDict
(
"fieldData"
));
}
...
...
src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/explicitSetValue.H
View file @
ae6d9359
...
...
@@ -89,8 +89,8 @@ protected:
// Protected data
//-
Sub dictionary for time activated explicit sources
const
dictionary
&
dict
_
;
//-
Coefficients dictionary
dictionary
coeffs
_
;
// Protected functions
...
...
@@ -119,10 +119,7 @@ public:
//- Return clone
autoPtr
<
explicitSetValue
>
clone
()
const
{
notImplemented
(
"autoPtr<explicitSetValue> clone() const"
);
notImplemented
(
"autoPtr<explicitSetValue> clone() const"
);
return
autoPtr
<
explicitSetValue
>
(
NULL
);
}
...
...
src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/explicitSetValueIO.C
View file @
ae6d9359
...
...
@@ -29,22 +29,8 @@ License
void
Foam
::
explicitSetValue
::
writeData
(
Ostream
&
os
)
const
{
os
<<
indent
<<
name_
<<
nl
<<
indent
<<
token
::
BEGIN_BLOCK
<<
incrIndent
<<
nl
;
if
(
scalarFields_
.
size
()
>
0
)
{
os
.
writeKeyword
(
"scalarFields"
)
<<
scalarFields_
<<
token
::
END_STATEMENT
<<
nl
;
}
if
(
vectorFields_
.
size
()
>
0
)
{
os
.
writeKeyword
(
"vectorFields"
)
<<
vectorFields_
<<
token
::
END_STATEMENT
<<
nl
;
}
os
<<
decrIndent
<<
indent
<<
token
::
END_BLOCK
<<
endl
;
os
<<
indent
<<
name_
<<
endl
;
dict_
.
write
(
os
);
}
...
...
@@ -52,12 +38,8 @@ bool Foam::explicitSetValue::read(const dictionary& dict)
{
if
(
basicSource
::
read
(
dict
))
{
const
dictionary
&
sourceDict
=
dict
.
subDict
(
name
());
const
dictionary
&
subDictCoeffs
=
sourceDict
.
subDict
(
typeName
+
"Coeffs"
);
setFieldData
(
subDictCoeffs
.
subDict
(
"fieldData"
));
coeffs_
=
dict
.
subDict
(
typeName
+
"Coeffs"
);
setFieldData
(
coeffs_
.
subDict
(
"fieldData"
));
return
true
;
}
else
...
...
src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.C
View file @
ae6d9359
...
...
@@ -112,8 +112,8 @@ Foam::explicitSource::explicitSource
)
:
basicSource
(
name
,
modelType
,
dict
,
mesh
),
dict
_
(
dict
.
subDict
(
modelType
+
"Coeffs"
)),
volumeMode_
(
volumeModeTypeNames_
.
read
(
dict
_
.
lookup
(
"volumeMode"
)))
coeffs
_
(
dict
.
subDict
(
modelType
+
"Coeffs"
)),
volumeMode_
(
volumeModeTypeNames_
.
read
(
coeffs
_
.
lookup
(
"volumeMode"
)))
{
setFieldData
(
dict_
.
subDict
(
"fieldData"
));
}
...
...
src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.H
View file @
ae6d9359
...
...
@@ -110,8 +110,8 @@ protected:
// Protected data
//-
Sub dictionary for time activated explicit sources
const
dictionary
&
dict
_
;
//-
Coefficients dictionary
dictionary
coeffs
_
;
//- Volume mode
volumeModeType
volumeMode_
;
...
...
src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSourceIO.C
View file @
ae6d9359
...
...
@@ -29,25 +29,8 @@ License
void
Foam
::
explicitSource
::
writeData
(
Ostream
&
os
)
const
{
os
<<
indent
<<
name_
<<
nl
<<
indent
<<
token
::
BEGIN_BLOCK
<<
incrIndent
<<
nl
;
os
.
writeKeyword
(
"volumeMode"
)
<<
volumeModeTypeNames_
[
volumeMode_
]
<<
token
::
END_STATEMENT
<<
nl
;
if
(
scalarFields_
.
size
()
>
0
)
{
os
.
writeKeyword
(
"scalarFields"
)
<<
scalarFields_
<<
token
::
END_STATEMENT
<<
nl
;
}
if
(
vectorFields_
.
size
()
>
0
)
{
os
.
writeKeyword
(
"vectorFields"
)
<<
vectorFields_
<<
token
::
END_STATEMENT
<<
nl
;
}
os
<<
decrIndent
<<
indent
<<
token
::
END_BLOCK
<<
endl
;
os
<<
indent
<<
name_
<<
endl
;
dict_
.
write
(
os
);
}
...
...
@@ -55,12 +38,8 @@ bool Foam::explicitSource::read(const dictionary& dict)
{
if
(
basicSource
::
read
(
dict
))
{
const
dictionary
&
sourceDict
=
dict
.
subDict
(
name
());
const
dictionary
&
subDictCoeffs
=
sourceDict
.
subDict
(
typeName
+
"Coeffs"
);
setFieldData
(
subDictCoeffs
.
subDict
(
"fieldData"
));
coeffs_
=
dict
.
subDict
(
typeName
+
"Coeffs"
);
setFieldData
(
coeffs_
.
subDict
(
"fieldData"
));
return
true
;
}
else
...
...
src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.C
View file @
ae6d9359
...
...
@@ -53,10 +53,10 @@ Foam::radialActuationDiskSource::radialActuationDiskSource
)
:
actuationDiskSource
(
name
,
modelType
,
dict
,
mesh
),
d
ict_
(
dict
.
subDict
(
modelType
+
"Coeffs"
)),
coeffsD
ict_
(
dict
.
subDict
(
modelType
+
"Coeffs"
)),
coeffs_
()
{
d
ict_
.
lookup
(
"coeffs"
)
>>
coeffs_
;
coeffsD
ict_
.
lookup
(
"coeffs"
)
>>
coeffs_
;
Info
<<
" - creating radial actuation disk zone: "
<<
this
->
name
()
<<
endl
;
}
...
...
@@ -114,14 +114,12 @@ bool Foam::radialActuationDiskSource::read(const dictionary& dict)
{
if
(
basicSource
::
read
(
dict
))
{
const
dictionary
&
sourceDict
=
dict
.
subDict
(
name
());
const
dictionary
&
subDictCoeffs
=
sourceDict
.
subDict
(
typeName
+
"Coeffs"
);
subDictCoeffs
.
readIfPresent
(
"diskDir"
,
diskDir_
);
subDictCoeffs
.
readIfPresent
(
"Cp"
,
Cp_
);
subDictCoeffs
.
readIfPresent
(
"Ct"
,
Ct_
);
subDictCoeffs
.
readIfPresent
(
"diskArea"
,
diskArea_
);
subDictCoeffs
.
lookup
(
"coeffs"
)
>>
coeffs_
;
const
dictionary
&
coeffsDict_
=
dict
.
subDict
(
typeName
+
"Coeffs"
);
coeffsDict_
.
readIfPresent
(
"diskDir"
,
diskDir_
);
coeffsDict_
.
readIfPresent
(
"Cp"
,
Cp_
);
coeffsDict_
.
readIfPresent
(
"Ct"
,
Ct_
);
coeffsDict_
.
readIfPresent
(
"diskArea"
,
diskArea_
);
coeffsDict_
.
lookup
(
"coeffs"
)
>>
coeffs_
;
return
true
;
}
else
...
...
src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.H
View file @
ae6d9359
...
...
@@ -62,7 +62,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class radialActuationDiskSource Declaration
Class radialActuationDiskSource Declaration
\*---------------------------------------------------------------------------*/
class
radialActuationDiskSource
...
...
@@ -71,8 +71,8 @@ class radialActuationDiskSource
{
// Private data
//-
Sub dictionary with model informa
tion
const
dictionary
&
d
ict_
;
//-
Coefficients dic
tion
ary
dictionary
coeffsD
ict_
;
//- Coeffcients for the radial distribution
FixedList
<
scalar
,
3
>
coeffs_
;
...
...
@@ -123,7 +123,7 @@ public:
// Public Functions
//-Source term to fvMatrix<vector>
//-
Source term to fvMatrix<vector>
virtual
void
addSu
(
fvMatrix
<
vector
>&
UEqn
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment