View Issue Details

IDProjectCategoryView StatusLast Update
0001368OpenFOAMBugpublic2014-08-08 11:55
Reporteruser976Assigned Tohenry  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinuxOSUbuntuOS Version12.04
Summary0001368: uniformFixedGradient causes scalar field to explode to infinity
DescriptionI have been running a version of pimpleFoam with the addition of a scalar transport equation, testing it on the pitzdaily tutorial case. With the uniformFixedGradient condition (constant value) set on the upper wall I have seen the internal field values rocket to infinity by the first output step. Using the fixedGradient condition with the same value doesn't display the problem, the solution is as expected.

I appear to have remedied the situation by placing a call to fixedGradientFvPatchField<Type>::evaluate() after the call to fixedGradientFvPatchField<Type>::updateCoeffs() in the updateCoeffs() method of uniformFixedGradient, but I don't know if this is a robust, efficient or sensible solution.
Steps To ReproduceModify version of pimpleFoam to include scalar transport, specify boundary condition of scalar on upper surface to uniformFixedGradient, with zero inlet and zeroGradient outlet.
TagsNo tags attached.

Activities

henry

2014-08-07 16:56

manager   ~0003196

When you say "by the first output step" do you mean the first step executed or the first written? If the latter how many time-steps were executed before the first written step?

I have studied the code and I believe the error is in the constructor rather than the updateCoeffs and an evaluate() is needed at the end of

template<class Type>
uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
(
    const fvPatch& p,
    const DimensionedField<Type, volMesh>& iF,
    const dictionary& dict
)
:
    fixedGradientFvPatchField<Type>(p, iF),
    uniformGradient_(DataEntry<Type>::New("uniformGradient", dict))
{
    if (dict.found("gradient"))
    {
        this->gradient() = Field<Type>("gradient", dict, p.size());
    }
    else
    {
        const scalar t = this->db().time().timeOutputValue();
        this->gradient() = uniformGradient_->value(t);
    }

    this->evaluate();
}

user976

2014-08-08 09:37

  ~0003197

Hi Henry,

Yes, it was occurring on the first time-step, written or not. I tried it with the modification as you suggest and it fixed the problem, as well as making sense.

Robin

henry

2014-08-08 11:54

manager   ~0003198

Resolved by commit b9839e576d57f1ad96da36b681db2da81daf36b2

Issue History

Date Modified Username Field Change
2014-08-06 12:58 user976 New Issue
2014-08-07 16:56 henry Note Added: 0003196
2014-08-08 09:37 user976 Note Added: 0003197
2014-08-08 11:54 henry Note Added: 0003198
2014-08-08 11:54 henry Status new => resolved
2014-08-08 11:54 henry Resolution open => fixed
2014-08-08 11:54 henry Assigned To => henry