Skip to content

Feature/IncNS_Convective

Mohammad Hossain requested to merge feature/IncNS_Convective into master

Merge Request for Branch: feature/IncNS_Convective

This branch considers the constant flow rate condition with a scalar variable ( e.g., temperature).

The followings are the modifications:

Important changes: (1) VelocityCorrectionScheme.cpp: Line 364-378: Due to the addition of the scalar variable (the test case was a temperature field), the additional forcing term (source term) energies the fluid. This causes the pressure field to explode after few time iterations.

The following lines (364-378) are added to make the pressure BCs in Neumann boundaries to be Zero: // Zero pressure BCs in Neumann boundaries that may have been // set in the advection step. Array<OneD, const SpatialDomains::BoundaryConditionShPtr> PBndConds = m_pressure->GetBndConditions(); Array<OneD, MultiRegions::ExpListSharedPtr>
PBndExp = m_pressure->GetBndCondExpansions(); for(int n = 0; n < PBndConds.num_elements(); ++n) { if(PBndConds[n]->GetBoundaryConditionType() == SpatialDomains::eNeumann) { Vmath::Zero(PBndExp[n]->GetNcoeffs(), PBndExp[n]->UpdateCoeffs(),1); } }

(2) VelocityCorrectionScheme.cpp:Line 387-392: When the FlowrateForce is activated in the xml with an scalar field, the code provides error due to the mismatch of the number of elements in inarray[i]. Since the Stokes solver only needs velocity fields, number of convective fields (m_nConvectiveFields) is saved in the variable SaveNConvectiveFields, and the StokesSystem is solved using m_nConvectiveFields = m_spacedim. After the Stokes solution, m_nConvectiveFields is reset to the actual value saved in SaveNConvectiveFields. // Save the number of convective field in case it is not set // to spacedim. Only need velocity components for stokes forcing int SaveNConvectiveFields = m_nConvectiveFields; m_nConvectiveFields = m_spacedim; SolveUnsteadyStokesSystem(inTmp, m_flowrateStokes, 0.0, aii_dt); m_nConvectiveFields = SaveNConvectiveFields;

(3) VelocityCorrectionScheme.cpp:Line (408-409): The following lines are added // Replace pressure BCs with those evaluated from advection step m_extrapolation→CopyPressureHBCsToPbndExp(); -Note: part of the fix at point (1).

(4) library/SolverUtils/DriverSteadyState.cpp: Line (126-136): The following lines were added to run SFD method with scalar for incompressible NS

// SFD to run for incompressible case with scalar field if (m_session->GetSolverInfo("EqType")=="UnsteadyNavierStokes"|| m_session->GetSolverInfo("EqType")=="SteadyNavierStokes") { int nConvectiveFields = m_session->GetVariables().size(); if (boost::iequals(m_session->GetVariable(nConvectiveFields-1),"p")) { nConvectiveFields -= 1; } NumVar_SFD = nConvectiveFields; }

(5) Solvers/IncNavierStrokesSolver/AdvectionTerms/AdjointAdvection.cpp: Line (171-181): Added the following lines to appended related terms required for the analysis of the 'adjoint' stability with a scalar

//Add Tprime*Grad_Tbase in u, v equations
    if (nScalar > 0 && i < ndim)
    {
        for (int s = 0; s < nScalar; ++s)
        {
            Vmath::Vvtvp(nPointsTot, m_gradBase[(ndim + s)*nBaseDerivs + i], 1,
                         scalar[s], 1,
                         outarray[i],1,
                         outarray[i],1);
        }
    }

(6) library/MultiRegions/ExpListHomogeneous1D.cpp: Line (992-994) The following lines are added (from Fix/FC_AddFld by Spencer Sherwin) to resolve problem associated with adding baseflow and disturbance fields in 3D1H with scalar.

   // Zero field since might not be filling in complete
        // expansion into coeffs, i.e. load single mode
		Vmath::Zero(coeffs.size(), coeffs,1);

Note: Some of the modifications already been merged into the master (eg, for 3DH1 flow rate) shown in the original merge request.

Spencer Sherwin, Mohammad Zakir Hossain

Edited by Mohammad Hossain

Merge request reports