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

Actuator Disk model using Variable scaling method v2006

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 14, 2020, 05:27
Default Actuator Disk model using Variable scaling method v2006
  #1
Member
 
Kabir Shariff
Join Date: Oct 2016
Location: France
Posts: 53
Rep Power: 10
Kbshariff is on a distinguished road
Hello Foamers,

I am working on simulation of tidal turbine using actuator disk with Openfoam, I use the FROUDE method and it works well with good results.

I now want to use the VARIABLE SCALING METHOD that is recently added to OF v2006 release. When I use the method, I have this error.
The reason for using this model is that it will allow me define the thrust force based on disk location, not the free sream velocity. In a system of turbine cluster, the free stream velocity is not consistent with turbines downstream.



Code:
 --> FOAM FATAL ERROR: 
[2] Velocity spatial-averaged on actuator disk is zero.
Please check if the initial U field is zero.
[2] 
[2]     From void Foam::fv::actuationDiskSource::calcVariableScalingMethod(const AlphaFieldType&, const RhoFieldType&, Foam::fvMatrix<Foam::Vector<double> >&) [with AlphaFieldType = Foam::geometricOneField; RhoFieldType = Foam::geometricOneField]
[2]     in file sources/derived/actuationDiskSource/actuationDiskSourceTemplates.C at line 201.
How ca, I defined the vemocity at the actuator disk location?

here if actuator disk code in fvOptions

Code:
disk1
{
    type            actuationDiskSource;
    variant         variableScaling;
    selectionMode   cellSet;
    cellSet         actuationDisk1;
    diskArea        0.00785;
    diskDir         (1 0 0);
    writeToFile     true;
    sink            true;
    Cp              0.47;
    Ct              0.7;
    monitorMethod   points;
    monitorCoeffs
    {
        points
        (
            (-0.5 0 0)
        );
    }
}

Thank you
Kbshariff is offline   Reply With Quote

Old   December 15, 2020, 10:15
Default
  #2
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13
HPE is on a distinguished road
Hi,

The error message can be traced to actuationDiskSourceTemplates.C:199

Code:
    if (mag(Udisk) < SMALL)
    {
        FatalErrorInFunction
            << "Velocity spatial-averaged on actuator disk is zero." << nl
            << "Please check if the initial U field is zero."
            << exit(FatalError);
    }
If you scroll down the file a bit, you will come across the following lines:

Code:
    // Calibrated thrust/power coeffs from power/thrust curves (LSRMTK:Eq. 6)
    const scalar CtStar = Ct*sqr(magUref/magUdisk);
    const scalar CpStar = Cp*pow3(magUref/magUdisk);
`magUdisk` is in the denominator. `magUdisk=0` will throw a zero-division floating-point exception, and your simulation will terminate without any useful warning message. The previous error message tries to warn you that your simulation calculates zero `magUdisk`, which is not acceptable for the following calculations.

Please see if your simulation settings are correct (since you are not allowed to have zero spatial-averaged flow speed on the rotor disk). Otherwise, if you would have any other suggestion or think that there is a bug somewhere, please issue a bug ticket in GitLab.
HPE is offline   Reply With Quote

Old   March 9, 2021, 08:25
Default
  #3
Member
 
Kabir Shariff
Join Date: Oct 2016
Location: France
Posts: 53
Rep Power: 10
Kbshariff is on a distinguished road
Quote:
Originally Posted by HPE View Post
Hi,

The error message can be traced to actuationDiskSourceTemplates.C:199

Code:
    if (mag(Udisk) < SMALL)
    {
        FatalErrorInFunction
            << "Velocity spatial-averaged on actuator disk is zero." << nl
            << "Please check if the initial U field is zero."
            << exit(FatalError);
    }
If you scroll down the file a bit, you will come across the following lines:

Code:
    // Calibrated thrust/power coeffs from power/thrust curves (LSRMTK:Eq. 6)
    const scalar CtStar = Ct*sqr(magUref/magUdisk);
    const scalar CpStar = Cp*pow3(magUref/magUdisk);
`magUdisk` is in the denominator. `magUdisk=0` will throw a zero-division floating-point exception, and your simulation will terminate without any useful warning message. The previous error message tries to warn you that your simulation calculates zero `magUdisk`, which is not acceptable for the following calculations.

Please see if your simulation settings are correct (since you are not allowed to have zero spatial-averaged flow speed on the rotor disk). Otherwise, if you would have any other suggestion or think that there is a bug somewhere, please issue a bug ticket in GitLab.

Hello,

Thank you for the response, I have set a value to the internal field and the simulation is running. The U internalField is a global value that is applied in the entire domain.

I want to simulate multiple turbines using the variable scaling method, I have defined the turbine location using topoSets and created corresponding actuationDiskSource for each turbine in fvoptions.
My question is how do I define the Udisk to be selected based on topoSet defined?

Below is the code for calculating the thrust force using variable scaling method
Code:
template<class AlphaFieldType, class RhoFieldType>
void Foam::fv::actuationDiskSource::calcVariableScalingMethod
(
    const AlphaFieldType& alpha,
    const RhoFieldType& rho,
    fvMatrix<vector>& eqn
)
{
    const vectorField& U = eqn.psi();
    vectorField& Usource = eqn.source();
    const scalarField& cellsV = mesh_.V();

    // Monitor and average monitor-region U and rho
    vector Uref(Zero);
    scalar rhoRef = 0.0;
    label szMonitorCells = monitorCells_.size();

    for (const auto& celli : monitorCells_)
    {
        Uref += U[celli];
        rhoRef = rhoRef + rho[celli];
    }
    reduce(Uref, sumOp<vector>());
    reduce(rhoRef, sumOp<scalar>());
    reduce(szMonitorCells, sumOp<label>());

    if (szMonitorCells == 0)
    {
        FatalErrorInFunction
            << "No cell is available for incoming velocity monitoring."
            << exit(FatalError);
    }

    Uref /= szMonitorCells;
    const scalar magUref = mag(Uref);
    rhoRef /= szMonitorCells;

    // Monitor and average U and rho on actuator disk
    vector Udisk(Zero);
    scalar rhoDisk = 0.0;
    scalar totalV = 0.0;

    for (const auto& celli : cells_)
    {
        Udisk += U[celli]*cellsV[celli];
        rhoDisk += rho[celli]*cellsV[celli];
        totalV += cellsV[celli];
    }
    reduce(Udisk, sumOp<vector>());
    reduce(rhoDisk, sumOp<scalar>());
    reduce(totalV, sumOp<scalar>());

    if (totalV < SMALL)
    {
        FatalErrorInFunction
            << "No cell in the actuator disk."
            << exit(FatalError);
    }

    Udisk /= totalV;
    const scalar magUdisk = mag(Udisk);
    rhoDisk /= totalV;

    if (mag(Udisk) < SMALL)
    {
        FatalErrorInFunction
            << "Velocity spatial-averaged on actuator disk is zero." << nl
            << "Please check if the initial U field is zero."
            << exit(FatalError);
    }

    // Interpolated thrust/power coeffs from power/thrust curves
    const scalar Ct = sink_*UvsCtPtr_->value(magUref);
    const scalar Cp = sink_*UvsCpPtr_->value(magUref);

    if (Cp <= VSMALL || Ct <= VSMALL)
    {
        FatalErrorInFunction
           << "Cp and Ct must be greater than zero." << nl
           << "Cp = " << Cp << ", Ct = " << Ct
           << exit(FatalIOError);
    }

    // Calibrated thrust/power coeffs from power/thrust curves (LSRMTK:Eq. 6)
    const scalar CtStar = Ct*sqr(magUref/magUdisk);
    const scalar CpStar = Cp*pow3(magUref/magUdisk);

    // Compute calibrated thrust/power (LSRMTK:Eq. 5)
    const scalar T = 0.5*rhoRef*diskArea_*magSqr(Udisk & diskDir_)*CtStar;
    const scalar P = 0.5*rhoRef*diskArea_*pow3(mag(Udisk & diskDir_))*CpStar;

    for (const label celli : cells_)
    {
        Usource[celli] += (cellsV[celli]/totalV*T)*diskDir_;
    }

    if
    (
        mesh_.time().timeOutputValue() >= writeFileStart_
     && mesh_.time().timeOutputValue() <= writeFileEnd_
    )
    {
        Ostream& os = file();
        writeCurrentTime(os);

        os  << Uref << tab << Cp << tab << Ct << tab
            << Udisk << tab << CpStar << tab << CtStar << tab << T << tab << P
            << endl;
    }
}
Kbshariff is offline   Reply With Quote

Old   October 16, 2021, 18:45
Default
  #4
Member
 
Hüseyin Can Önel
Join Date: Sep 2018
Location: Ankara, Turkey
Posts: 47
Rep Power: 8
hconel is on a distinguished road
Hi Kbshariff,
I am also interested in the newly introduced Variable Scaling AD model.
This question might be irrelevant to the topic but, have you tried using the Variable Scaling AD in yawed configuration or in any other configuration where the swept disk area is not aligned with the cells?
Regards,
Huseyin
hconel is offline   Reply With Quote

Reply

Tags
actuationdisk, fvoptions,momentum source, v2006, variablescaling


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
hello Evry body please i want to used vof method and k-omega sst turbulence model fo luca007 FLUENT 4 February 20, 2017 10:17
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 08:00
error in COMSOL:'ERROR:6164 Duplicate Variable' bhushas COMSOL 1 May 30, 2008 05:35
Env variable not set gruber2 OpenFOAM Installation 5 December 30, 2005 05:27
Fortran variable ED for K-OMEGA model Viatcheslav Anissimov CFX 0 August 31, 2000 07:41


All times are GMT -4. The time now is 20:35.