Skip to content
Snippets Groups Projects
Commit 06df44a5 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

COMP: protect against null tmp field (freestream BC)

parent b519a8e1
Branches
Tags
No related merge requests found
......@@ -38,7 +38,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField
)
:
inletOutletFvPatchField<Type>(p, iF),
freestreamBCPtr_()
freestreamBCPtr_(nullptr)
{}
......@@ -51,7 +51,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField
)
:
inletOutletFvPatchField<Type>(p, iF),
freestreamBCPtr_()
freestreamBCPtr_(nullptr)
{
fvPatchFieldBase::readDict(dict);
......@@ -93,7 +93,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField
)
:
inletOutletFvPatchField<Type>(ptf, p, iF, mapper),
freestreamBCPtr_()
freestreamBCPtr_(nullptr)
{
if (ptf.freestreamBCPtr_)
{
......@@ -110,7 +110,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField
)
:
inletOutletFvPatchField<Type>(ptf),
freestreamBCPtr_()
freestreamBCPtr_(nullptr)
{
if (ptf.freestreamBCPtr_)
{
......@@ -127,7 +127,7 @@ Foam::freestreamFvPatchField<Type>::freestreamFvPatchField
)
:
inletOutletFvPatchField<Type>(ptf, iF),
freestreamBCPtr_()
freestreamBCPtr_(nullptr)
{
if (ptf.freestreamBCPtr_)
{
......@@ -160,7 +160,7 @@ void Foam::freestreamFvPatchField<Type>::rmap
const auto& fsptf = refCast<const freestreamFvPatchField<Type>>(ptf);
if (fsptf.freestreamBCPtr_)
if (freestreamBCPtr_ && fsptf.freestreamBCPtr_)
{
freestreamBCPtr_->rmap(fsptf.freestreamBCPtr_(), addr);
}
......
......@@ -83,8 +83,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef freestreamFvPatchField_H
#define freestreamFvPatchField_H
#ifndef Foam_freestreamFvPatchField_H
#define Foam_freestreamFvPatchField_H
#include "inletOutletFvPatchField.H"
......@@ -102,7 +102,7 @@ class freestreamFvPatchField
:
public inletOutletFvPatchField<Type>
{
// Private data
// Private Data
//- BC to supply the freestream value
tmp<fvPatchField<Type>> freestreamBCPtr_;
......@@ -175,7 +175,13 @@ public:
}
// Member functions
// Member Functions
// Access
const Field<Type>& freestreamValue() const { return this->refValue(); }
Field<Type>& freestreamValue() { return this->refValue(); }
// Mapping functions
......@@ -193,19 +199,6 @@ public:
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
// Return defining fields
const Field<Type>& freestreamValue() const
{
return this->refValue();
}
Field<Type>& freestreamValue()
{
return this->refValue();
}
//- Write
virtual void write(Ostream&) const;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment