Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
ded4f0b2
Commit
ded4f0b2
authored
Oct 30, 2008
by
Andrew Heather
Browse files
added option to set reference by point
parent
37cae8e7
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/finiteVolume/cfdTools/general/findRefCell/findRefCell.C
View file @
ded4f0b2
...
...
@@ -33,15 +33,68 @@ void Foam::setRefCell
const
volScalarField
&
field
,
const
dictionary
&
dict
,
label
&
refCelli
,
scalar
&
refValue
scalar
&
refValue
,
bool
forceReference
)
{
if
(
field
.
needReference
())
if
(
field
.
needReference
()
||
forceReference
)
{
word
refCellName
=
field
.
name
()
+
"RefCell"
;
word
refPointName
=
field
.
name
()
+
"RefPoint"
;
word
refValueName
=
field
.
name
()
+
"RefValue"
;
refCelli
=
readLabel
(
dict
.
lookup
(
refCellName
));
if
(
dict
.
found
(
refCellName
))
{
if
(
Pstream
::
master
())
{
refCelli
=
readLabel
(
dict
.
lookup
(
refCellName
));
}
else
{
refCelli
=
-
1
;
}
}
else
if
(
dict
.
found
(
refPointName
))
{
point
refPointi
(
dict
.
lookup
(
refPointName
));
refCelli
=
field
.
mesh
().
findCell
(
refPointi
);
label
hasRef
=
(
refCelli
>=
0
?
1
:
0
);
label
sumHasRef
=
returnReduce
<
label
>
(
hasRef
,
sumOp
<
label
>
());
if
(
sumHasRef
!=
1
)
{
FatalErrorIn
(
"void Foam::setRefCell"
"("
" const volScalarField&,"
" const dictionary&,"
" label& scalar&,"
" bool"
")"
)
<<
"Unable to set reference cell for field "
<<
field
.
name
()
<<
nl
<<
" Reference point "
<<
refPointName
<<
" found on multiple domains"
<<
nl
<<
abort
(
FatalError
);
}
}
else
{
FatalErrorIn
(
"void Foam::setRefCell"
"("
" const volScalarField&,"
" const dictionary&,"
" label& scalar&,"
" bool"
")"
)
<<
"Unable to set reference cell for field"
<<
field
.
name
()
<<
nl
<<
" Please supply either "
<<
refCellName
<<
" or "
<<
refPointName
<<
nl
<<
abort
(
FatalError
);
}
refValue
=
readScalar
(
dict
.
lookup
(
refValueName
));
}
}
...
...
src/finiteVolume/cfdTools/general/findRefCell/findRefCell.H
View file @
ded4f0b2
...
...
@@ -52,7 +52,8 @@ void setRefCell
const
volScalarField
&
field
,
const
dictionary
&
dict
,
label
&
refCelli
,
scalar
&
refValue
scalar
&
refValue
,
bool
forceReference
=
false
);
}
...
...
src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C
View file @
ded4f0b2
...
...
@@ -483,7 +483,7 @@ void Foam::fvMatrix<Type>::setReference
{
if
(
psi_
.
needReference
()
||
forceReference
)
{
if
(
Pstream
::
master
()
)
if
(
cell
>=
0
)
{
source
()[
cell
]
+=
diag
()[
cell
]
*
value
;
diag
()[
cell
]
+=
diag
()[
cell
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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