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
f7f2d167
Commit
f7f2d167
authored
Dec 09, 2008
by
Mark Olesen
Browse files
extend fvSolution re-write to also include the 'smooth' entry
parent
d0795abc
Changes
4
Hide whitespace changes
Inline
Side-by-side
applications/utilities/preProcessing/foamUpgradeFvSolution/foamUpgradeFvSolution.C
View file @
f7f2d167
...
...
@@ -90,7 +90,12 @@ int main(int argc, char *argv[])
solutionDict
.
objectPath
()
+
".old"
);
solutionDict
.
regIOobject
::
write
();
solutionDict
.
writeObject
(
IOstream
::
ASCII
,
IOstream
::
currentVersion
,
IOstream
::
UNCOMPRESSED
);
Info
<<
"Backup to "
<<
(
solutionDict
.
objectPath
()
+
".old"
)
<<
nl
<<
"Write to "
<<
solutionDict
.
objectPath
()
<<
nl
<<
endl
;
...
...
src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H
View file @
f7f2d167
...
...
@@ -396,6 +396,9 @@ public:
public:
//- Find the smoother name (directly or from a sub-dictionary)
static
word
getName
(
const
dictionary
&
);
//- Runtime type information
virtual
const
word
&
type
()
const
=
0
;
...
...
src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSmoother.C
View file @
f7f2d167
...
...
@@ -36,6 +36,29 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam
::
word
Foam
::
lduMatrix
::
smoother
::
getName
(
const
dictionary
&
solverControls
)
{
word
name
;
// handle primitive or dictionary entry
const
entry
&
e
=
solverControls
.
lookupEntry
(
"smoother"
,
false
,
false
);
if
(
e
.
isDict
())
{
e
.
dict
().
lookup
(
"smoother"
)
>>
name
;
}
else
{
e
.
stream
()
>>
name
;
}
return
name
;
}
Foam
::
autoPtr
<
Foam
::
lduMatrix
::
smoother
>
Foam
::
lduMatrix
::
smoother
::
New
(
const
word
&
fieldName
,
...
...
src/OpenFOAM/matrices/solution/solution.C
View file @
f7f2d167
...
...
@@ -27,13 +27,23 @@ License
#include
"solution.H"
#include
"Time.H"
// these
two
are for old syntax compatibility:
// these are for old syntax compatibility:
#include
"BICCG.H"
#include
"ICCG.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include
"IStringStream.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
int
Foam
::
solution
::
debug
(
::
Foam
::
debug
::
debugSwitch
(
"solution"
,
0
));
// list of sub-dictionaries to rewrite
//! @cond localScope
static
const
Foam
::
List
<
Foam
::
word
>
subDictNames
(
Foam
::
IStringStream
(
"(preconditioner smoother)"
)()
);
//! @endcond localScope
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
solution
::
solution
(
const
objectRegistry
&
obr
,
const
fileName
&
dictName
)
...
...
@@ -91,32 +101,33 @@ Foam::label Foam::solution::upgradeSolverDict
subdict
.
add
(
"solver"
,
name
);
subdict
<<=
dictionary
(
is
);
// preconditioner can be a primitiveEntry w/o settings,
// or a dictionaryEntry.
// preconditioner and smoother entries can be
// 1) primitiveEntry w/o settings,
// 2) or a dictionaryEntry.
// transform primitiveEntry with settings -> dictionaryEntry
entry
*
precond
=
subdict
.
lookupEntryPtr
(
"preconditioner"
,
false
,
false
);
if
(
precond
&&
!
precond
->
isDict
())
forAll
(
subDictNames
,
dictI
)
{
Istream
&
is
=
precond
->
stream
()
;
is
>>
name
;
const
word
&
dictName
=
subDictNames
[
dictI
]
;
entry
*
ePtr
=
subdict
.
lookupEntryPtr
(
dictName
,
false
,
false
)
;
if
(
!
is
.
eof
())
if
(
ePtr
&&
!
ePtr
->
isDict
())
{
dictionary
precondDict
;
precondDict
.
add
(
"preconditioner"
,
name
);
precondDict
<<=
dictionary
(
is
);
Istream
&
is
=
ePtr
->
stream
();
is
>>
name
;
subdict
.
set
(
"preconditioner"
,
precondDict
);
if
(
!
is
.
eof
())
{
dictionary
newDict
;
newDict
.
add
(
dictName
,
name
);
newDict
<<=
dictionary
(
is
);
subdict
.
set
(
dictName
,
newDict
);
}
}
}
}
// write out information to help people adjust to the new syntax
if
(
verbose
)
{
...
...
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