CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

in modifying "advective"B.C.

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 11, 2020, 05:28
Default in modifying "advective"B.C.
  #1
New Member
 
Kosuke Seto
Join Date: Jan 2020
Posts: 10
Rep Power: 6
Kosuke Seto is on a distinguished road
Hi, FOAMers.

I'm modifying the "advective" boundary condition to make sound generated from flow fields go through the boundaries without reflecting.
I do know that the boundary condition "waveTransmissive" will do, but this is for the compressible analysis, and I'm doing incompressible ones so I'm modifying "advective".

My question is as follows.

In this boundary condition, the member function "advectionSpeed()" determine the speed of the sound at the boundaries.

Code:
// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //

template<class Type>
Foam::tmp<Foam::scalarField>
Foam::soundAdvectiveFvPatchField<Type>::advectionSpeed() const
{
    const surfaceScalarField& phi =
        this->db().objectRegistry::template lookupObject<surfaceScalarField>
        (phiName_);

    fvsPatchField<scalar> phip =
        this->patch().template lookupPatchField<surfaceScalarField, scalar>
        (
            phiName_
        );

    if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
    {
        const fvPatchScalarField& rhop =
            this->patch().template lookupPatchField<volScalarField, scalar>
            (
                rhoName_
            );

        return phip/(rhop*this->patch().magSf());
    }
    else
    {
    
        return phip/this->patch().magSf();
    }
}
I wanna change the expression in "return" statement like "return 340" because the sound speed is 340m/s.
Off cause, the situation is not this easy.

Then, how can I configure the sound speed here?
From above, the variable phip is declared as fvsPatchField<scalar>, but writing
fvsPatchField<scalar> soundSpeed_;
in the header file doesn't work.

Thanks for any help!
Kosuke
Kosuke Seto is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Modifying stressedFoam for geometric non-linearity mn14cat OpenFOAM Programming & Development 0 May 25, 2020 12:20
Create a new field without modifying built-in solver? gryphaea1635 OpenFOAM Pre-Processing 1 November 4, 2019 05:13
Compile error when modifying LESdelta Alisa_W OpenFOAM Programming & Development 0 January 26, 2019 10:40
Modifying the laplacian operator mlawson OpenFOAM Running, Solving & CFD 22 July 16, 2018 05:56
IGG - modifying curves evan247 Fidelity CFD 2 December 8, 2015 06:00


All times are GMT -4. The time now is 07:32.