Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs
2011-12-02 10:40:23 +00:00
13 changed files with 266 additions and 65 deletions

View File

@ -69,11 +69,26 @@
</Documentation> </Documentation>
</IntVectorProperty> </IntVectorProperty>
<!-- Interpolate Fields check-box -->
<IntVectorProperty
name="UiInterpolateVolFields"
command="SetInterpolateVolFields"
number_of_elements="1"
is_internal="1"
default_values="1"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Interpolate volume fields into point fields
</Documentation>
</IntVectorProperty>
<!-- Extrapolate Patches check-box --> <!-- Extrapolate Patches check-box -->
<IntVectorProperty <IntVectorProperty
name="ExtrapolatePatches" name="UiExtrapolatePatches"
command="SetExtrapolatePatches" command="SetExtrapolatePatches"
number_of_elements="1" number_of_elements="1"
is_internal="1"
default_values="0" default_values="0"
animateable="0"> animateable="0">
<BooleanDomain name="bool"/> <BooleanDomain name="bool"/>

View File

@ -59,7 +59,7 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
pqAutoGeneratedObjectPanel(proxy, p) pqAutoGeneratedObjectPanel(proxy, p)
{ {
// create first sublayout (at top of the panel) // create first sublayout (at top of the panel)
QGridLayout *form = new QGridLayout(); QGridLayout* form = new QGridLayout();
this->PanelLayout->addLayout(form, 0, 0, 1, -1); this->PanelLayout->addLayout(form, 0, 0, 1, -1);
vtkSMProperty* prop = 0; vtkSMProperty* prop = 0;
@ -107,6 +107,9 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
); );
} }
QFrame* hline1 = new QFrame(this);
hline1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
form->addWidget(hline1, 1, 0, 1, 2);
// checkbox for caching mesh // checkbox for caching mesh
if ((prop = this->proxy()->GetProperty("UiCacheMesh")) != 0) if ((prop = this->proxy()->GetProperty("UiCacheMesh")) != 0)
@ -124,7 +127,7 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
"Cache the fvMesh in memory." "Cache the fvMesh in memory."
); );
form->addWidget(CacheMesh_, 1, 0, Qt::AlignLeft); form->addWidget(CacheMesh_, 2, 0, Qt::AlignLeft);
connect connect
( (
CacheMesh_, CacheMesh_,
@ -152,7 +155,7 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
); );
// row/col 0,1 // row/col 0,1
form->addWidget(ShowPatchNames_, 1, 1, Qt::AlignLeft); form->addWidget(ShowPatchNames_, 2, 1, Qt::AlignLeft);
connect connect
( (
ShowPatchNames_, ShowPatchNames_,
@ -180,7 +183,7 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
); );
// row/col 1,0 // row/col 1,0
form->addWidget(IncludeSets_, 2, 0, Qt::AlignLeft); form->addWidget(IncludeSets_, 3, 0, Qt::AlignLeft);
connect connect
( (
IncludeSets_, IncludeSets_,
@ -209,7 +212,7 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
); );
// row/col 1,1 // row/col 1,1
form->addWidget(IncludeZones_, 2, 1, Qt::AlignLeft); form->addWidget(IncludeZones_, 3, 1, Qt::AlignLeft);
connect connect
( (
IncludeZones_, IncludeZones_,
@ -219,6 +222,63 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
); );
} }
// checkbox for vol field interpolation
if ((prop = this->proxy()->GetProperty("UiInterpolateVolFields")) != 0)
{
// immediate update on the Server Manager side
prop->SetImmediateUpdate(true);
InterpolateVolFields_ = new QCheckBox("Interpolate volFields");
InterpolateVolFields_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
InterpolateVolFields_->setToolTip
(
"Interpolate volFields into pointFields"
);
// row/col 1,1
form->addWidget(InterpolateVolFields_, 4, 0, Qt::AlignLeft);
connect
(
InterpolateVolFields_,
SIGNAL(stateChanged(int)),
this,
SLOT(InterpolateVolFieldsToggled())
);
}
// checkbox for extrapolate patches
if ((prop = this->proxy()->GetProperty("UiExtrapolatePatches")) != 0)
{
// immediate update on the Server Manager side
prop->SetImmediateUpdate(true);
ExtrapolatePatches_ = new QCheckBox("Extrapolate Patches");
ExtrapolatePatches_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
ExtrapolatePatches_->setToolTip
(
"Extrapolate internalField to non-constraint patches"
);
// row/col 1,1
form->addWidget(ExtrapolatePatches_, 4, 1, Qt::AlignLeft);
connect
(
ExtrapolatePatches_,
SIGNAL(stateChanged(int)),
this,
SLOT(ExtrapolatePatchesToggled())
);
}
QFrame* hline2 = new QFrame(this);
hline2->setFrameStyle(QFrame::HLine | QFrame::Sunken);
form->addWidget(hline2, 5, 0, 1, 2);
} }
@ -255,8 +315,7 @@ void pqPV3FoamReaderPanel::ZeroTimeToggled()
this->proxy()->GetProperty("UiZeroTime") this->proxy()->GetProperty("UiZeroTime")
)->SetElement(0, ZeroTime_->isChecked()); )->SetElement(0, ZeroTime_->isChecked());
// update everything this->setModified();
RefreshPressed();
} }
@ -306,7 +365,32 @@ void pqPV3FoamReaderPanel::IncludeZonesToggled()
{ {
this->proxy()->UpdatePropertyInformation(prop); this->proxy()->UpdatePropertyInformation(prop);
} }
}
void pqPV3FoamReaderPanel::ExtrapolatePatchesToggled()
{
vtkSMProperty* prop;
vtkSMIntVectorProperty::SafeDownCast
(
this->proxy()->GetProperty("UiExtrapolatePatches")
)->SetElement(0, ExtrapolatePatches_->isChecked());
this->setModified();
}
void pqPV3FoamReaderPanel::InterpolateVolFieldsToggled()
{
vtkSMProperty* prop;
vtkSMIntVectorProperty::SafeDownCast
(
this->proxy()->GetProperty("UiInterpolateVolFields")
)->SetElement(0, InterpolateVolFields_->isChecked());
this->setModified();
} }

View File

@ -77,6 +77,13 @@ class pqPV3FoamReaderPanel
//- IncludeZones checkbox //- IncludeZones checkbox
QCheckBox* IncludeZones_; QCheckBox* IncludeZones_;
//- InterpolateVolFields checkbox
QCheckBox* InterpolateVolFields_;
//- ExtrapolatePatches checkbox
QCheckBox* ExtrapolatePatches_;
protected slots: protected slots:
void CacheMeshToggled(); void CacheMeshToggled();
@ -85,6 +92,8 @@ protected slots:
void ShowPatchNamesToggled(); void ShowPatchNamesToggled();
void IncludeSetsToggled(); void IncludeSetsToggled();
void IncludeZonesToggled(); void IncludeZonesToggled();
void InterpolateVolFieldsToggled();
void ExtrapolatePatchesToggled();
public: public:
@ -97,7 +106,6 @@ public:
//- Destructor //- Destructor
// virtual ~pqPV3FoamReaderPanel(); // virtual ~pqPV3FoamReaderPanel();
}; };

View File

@ -85,6 +85,7 @@ vtkPV3FoamReader::vtkPV3FoamReader()
IncludeSets = 0; IncludeSets = 0;
IncludeZones = 0; IncludeZones = 0;
ShowPatchNames = 0; ShowPatchNames = 0;
InterpolateVolFields = 1;
UpdateGUI = 0; UpdateGUI = 0;

View File

@ -121,6 +121,11 @@ public:
virtual void SetShowPatchNames(int); virtual void SetShowPatchNames(int);
vtkGetMacro(ShowPatchNames, int); vtkGetMacro(ShowPatchNames, int);
// Description:
// OpenFOAM volField interpolation
vtkSetMacro(InterpolateVolFields, int);
vtkGetMacro(InterpolateVolFields, int);
// Description: // Description:
// Get the current timestep // Get the current timestep
int GetTimeStep(); int GetTimeStep();
@ -170,6 +175,7 @@ public:
void SelectionModified(); void SelectionModified();
protected: protected:
//- Construct null //- Construct null
@ -203,6 +209,7 @@ protected:
//- The file name for this case //- The file name for this case
char* FileName; char* FileName;
private: private:
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
@ -224,6 +231,7 @@ private:
int IncludeSets; int IncludeSets;
int IncludeZones; int IncludeZones;
int ShowPatchNames; int ShowPatchNames;
int InterpolateVolFields;
//- Dummy variable/switch to invoke a reader update //- Dummy variable/switch to invoke a reader update
int UpdateGUI; int UpdateGUI;

View File

@ -505,6 +505,7 @@ class vtkPV3Foam
const fvMesh&, const fvMesh&,
const PtrList<PrimitivePatchInterpolation<primitivePatch> >&, const PtrList<PrimitivePatchInterpolation<primitivePatch> >&,
const IOobjectList&, const IOobjectList&,
const bool interpFields,
vtkMultiBlockDataSet* output vtkMultiBlockDataSet* output
); );

View File

@ -120,25 +120,27 @@ void Foam::vtkPV3Foam::convertVolFields
} }
bool interpFields = reader_->GetInterpolateVolFields();
convertVolFields<scalar> convertVolFields<scalar>
( (
mesh, ppInterpList, objects, output mesh, ppInterpList, objects, interpFields, output
); );
convertVolFields<vector> convertVolFields<vector>
( (
mesh, ppInterpList, objects, output mesh, ppInterpList, objects, interpFields, output
); );
convertVolFields<sphericalTensor> convertVolFields<sphericalTensor>
( (
mesh, ppInterpList, objects, output mesh, ppInterpList, objects, interpFields, output
); );
convertVolFields<symmTensor> convertVolFields<symmTensor>
( (
mesh, ppInterpList, objects, output mesh, ppInterpList, objects, interpFields, output
); );
convertVolFields<tensor> convertVolFields<tensor>
( (
mesh, ppInterpList, objects, output mesh, ppInterpList, objects, interpFields, output
); );
if (debug) if (debug)

View File

@ -48,6 +48,7 @@ void Foam::vtkPV3Foam::convertVolFields
const fvMesh& mesh, const fvMesh& mesh,
const PtrList<PrimitivePatchInterpolation<primitivePatch> >& ppInterpList, const PtrList<PrimitivePatchInterpolation<primitivePatch> >& ppInterpList,
const IOobjectList& objects, const IOobjectList& objects,
const bool interpFields,
vtkMultiBlockDataSet* output vtkMultiBlockDataSet* output
) )
{ {
@ -74,6 +75,19 @@ void Foam::vtkPV3Foam::convertVolFields
// Interpolated field (demand driven) // Interpolated field (demand driven)
autoPtr<GeometricField<Type, pointPatchField, pointMesh> > ptfPtr; autoPtr<GeometricField<Type, pointPatchField, pointMesh> > ptfPtr;
if (interpFields)
{
if (debug)
{
Info<< "convertVolFieldBlock interpolating:" << tf.name()
<< endl;
}
ptfPtr.reset
(
volPointInterpolation::New(tf.mesh()).interpolate(tf).ptr()
);
}
// Convert activated internalMesh regions // Convert activated internalMesh regions
@ -154,14 +168,17 @@ void Foam::vtkPV3Foam::convertVolFields
datasetNo datasetNo
); );
convertPatchPointField if (interpFields)
( {
tf.name(), convertPatchPointField
ppInterpList[patchId].faceToPointInterpolate(tpptf)(), (
output, tf.name(),
arrayRangePatches_, ppInterpList[patchId].faceToPointInterpolate(tpptf)(),
datasetNo output,
); arrayRangePatches_,
datasetNo
);
}
} }
else else
{ {
@ -174,14 +191,17 @@ void Foam::vtkPV3Foam::convertVolFields
datasetNo datasetNo
); );
convertPatchPointField if (interpFields)
( {
tf.name(), convertPatchPointField
ppInterpList[patchId].faceToPointInterpolate(ptf)(), (
output, tf.name(),
arrayRangePatches_, ppInterpList[patchId].faceToPointInterpolate(ptf)(),
datasetNo output,
); arrayRangePatches_,
datasetNo
);
}
} }
} }
@ -285,29 +305,18 @@ void Foam::vtkPV3Foam::convertVolFieldBlock
decompLst[datasetNo] decompLst[datasetNo]
); );
if (!ptfPtr.valid()) if (ptfPtr.valid())
{ {
if (debug) convertPointField
{
Info<< "convertVolFieldBlock interpolating:" << tf.name()
<< endl;
}
ptfPtr.reset
( (
volPointInterpolation::New(tf.mesh()).interpolate(tf).ptr() ptfPtr(),
tf,
output,
range,
datasetNo,
decompLst[datasetNo]
); );
} }
convertPointField
(
ptfPtr(),
tf,
output,
range,
datasetNo,
decompLst[datasetNo]
);
} }
} }
} }

View File

@ -120,11 +120,17 @@ do
-archOption | --archOption) -archOption | --archOption)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument" [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
archOption="$2" archOption="$2"
# replace WM_ARCH_OPTION=... current_archOption=`grep WM_ARCH_OPTION= etc/bashrc | sed "s/export WM_ARCH_OPTION=//"`
_inlineSed \ if [ "$archOption" != "$current_archOption" ]
etc/bashrc \ then
'/^[^#]/s@WM_ARCH_OPTION=.*@WM_ARCH_OPTION='"$archOption@" \ # replace WM_ARCH_OPTION=...
"Replacing WM_ARCH_OPTION setting by '$archOption'" _inlineSed \
etc/bashrc \
'/^[^#]/s@WM_ARCH_OPTION=.*@WM_ARCH_OPTION='"$archOption@" \
"Replacing WM_ARCH_OPTION setting by '$archOption'"
else
echo "WM_ARCH_OPTION already set to $archOption"
fi
shift 2 shift 2
;; ;;
-paraviewInstall | --paraviewInstall) -paraviewInstall | --paraviewInstall)

View File

@ -94,7 +94,7 @@ Foam::cyclicAMIFvPatchField<Type>::cyclicAMIFvPatchField
"cyclicAMIFvPatchField<Type>::cyclicAMIFvPatchField" "cyclicAMIFvPatchField<Type>::cyclicAMIFvPatchField"
"(" "("
"const fvPatch&, " "const fvPatch&, "
"const Field<Type>&, " "const DimensionedField<Type, volMesh>&, "
"const dictionary&" "const dictionary&"
")", ")",
dict dict
@ -106,7 +106,7 @@ Foam::cyclicAMIFvPatchField<Type>::cyclicAMIFvPatchField
<< exit(FatalIOError); << exit(FatalIOError);
} }
if (this->coupled()) if (!dict.found("value") && this->coupled())
{ {
this->evaluate(Pstream::blocking); this->evaluate(Pstream::blocking);
} }

View File

@ -367,6 +367,52 @@ Foam::scalar Foam::liquidProperties::D(scalar p, scalar T, scalar Wb) const
} }
Foam::scalar Foam::liquidProperties::pvInvert(scalar p)
{
scalar T = Tc_;
scalar deltaT = 10.0;
scalar dp0 = pv(p, T) - p;
label n = 0;
while ((n < 200) && (mag(deltaT) > 1.0e-3))
{
n++;
scalar pBoil = pv(p, T);
scalar dp = pBoil - p;
if ((dp > 0.0) && (dp0 > 0.0))
{
T -= deltaT;
}
else
{
if ((dp < 0.0) && (dp0 < 0.0))
{
T += deltaT;
}
else
{
deltaT *= 0.5;
if ((dp > 0.0) && (dp0 < 0.0))
{
T -= deltaT;
}
else
{
T += deltaT;
}
}
}
dp0 = dp;
}
return T;
}
void Foam::liquidProperties::writeData(Ostream& os) const void Foam::liquidProperties::writeData(Ostream& os) const
{ {

View File

@ -251,6 +251,10 @@ public:
//- Vapour diffussivity [m2/s] with specified binary pair //- Vapour diffussivity [m2/s] with specified binary pair
virtual scalar D(scalar p, scalar T, scalar Wb) const; virtual scalar D(scalar p, scalar T, scalar Wb) const;
//- Invert the vapour pressure relationship to retrieve the
// boiling temperuture as a function of temperature
virtual scalar pvInvert(scalar p);
// I-O // I-O

View File

@ -10,6 +10,7 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class volScalarField; class volScalarField;
location "0";
object p; object p;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -23,36 +24,52 @@ boundaryField
inlet inlet
{ {
type uniformTotalPressure; type uniformTotalPressure;
rho none;
psi none;
gamma 1;
p0 40;
pressure table pressure table
( (
(0 10) (0 10)
(1 40) (1 40)
); );
p0 40; // only used for restarts
U U;
phi phi;
rho none;
psi none;
gamma 1;
value uniform 40; value uniform 40;
} }
outlet1 outlet1
{ {
type fixedValue; type fixedValue;
value uniform 10; value uniform 10;
} }
outlet2 outlet2
{ {
type fixedValue; type fixedValue;
value uniform 0; value uniform 0;
} }
baffles
{
type zeroGradient;
}
fan_half0
{
type fan;
patchType cyclic;
jump uniform 0;
f 2(100 -0.1);
value uniform 0;
}
fan_half1
{
type fan;
patchType cyclic;
jump uniform 0;
f 2(100 -0.1);
value uniform 0;
}
defaultFaces defaultFaces
{ {
type zeroGradient; type zeroGradient;
} }
} }
// ************************************************************************* // // ************************************************************************* //