Exemple #1
0
        /**
         * @brief Set up filter with output file and frequency parameters.
         *
         * @param pSession  Current session.
         * @param pParams   Map of parameters defined in XML file.
         */
        FilterEnergy1D::FilterEnergy1D(
            const LibUtilities::SessionReaderSharedPtr &pSession,
            const std::map<std::string, std::string> &pParams) :
            Filter(pSession),
            m_index(0)
        {
            std::string outName;
            if (pParams.find("OutputFile") == pParams.end())
            {
                outName = m_session->GetSessionName();
            }
            else
            {
                ASSERTL0(!(pParams.find("OutputFile")->second.empty()),
                         "Missing parameter 'OutputFile'.");
                outName = pParams.find("OutputFile")->second;
            }

            if (pParams.find("OutputFrequency") == pParams.end())
            {
                m_outputFrequency = 1;
            }
            else
            {
                m_outputFrequency =
                    atoi(pParams.find("OutputFrequency")->second.c_str());
            }

            outName += ".eny";

            ASSERTL0(pSession->GetComm()->GetSize() == 1,
                     "The 1D energy filter currently only works in serial.");

            m_out.open(outName.c_str());
        }
Exemple #2
0
        FilterAeroForces::FilterAeroForces(
            const LibUtilities::SessionReaderSharedPtr &pSession,
            const std::map<std::string, std::string> &pParams) :
            Filter(pSession)
        {
            if (pParams.find("OutputFile") == pParams.end())
            {
                m_outputFile = m_session->GetSessionName();
            }
            else
            {
                ASSERTL0(!(pParams.find("OutputFile")->second.empty()),
                         "Missing parameter 'OutputFile'.");
                m_outputFile = pParams.find("OutputFile")->second;
            }
            if (!(m_outputFile.length() >= 4
                  && m_outputFile.substr(m_outputFile.length() - 4) == ".fce"))
            {
                m_outputFile += ".fce";
            }

            if (pParams.find("OutputFrequency") == pParams.end())
            {
                m_outputFrequency = 1;
            }
            else
            {
                m_outputFrequency =
                    atoi(pParams.find("OutputFrequency")->second.c_str());
            }


            m_session->MatchSolverInfo("Homogeneous", "1D",
                                       m_isHomogeneous1D, false);

            if(m_isHomogeneous1D)
            {
                if (pParams.find("OutputPlane") == pParams.end())
                {
                    m_outputPlane = 0;
                }
                else
                {
                    m_outputPlane =
                        atoi(pParams.find("OutputPlane")->second.c_str());
                }
            }

            //specify the boundary to calculate the forces
            if (pParams.find("Boundary") == pParams.end())
            {
                ASSERTL0(false, "Missing parameter 'Boundary'.");
            }
            else
            {
                ASSERTL0(!(pParams.find("Boundary")->second.empty()),
                         "Missing parameter 'Boundary'.");
                m_BoundaryString = pParams.find("Boundary")->second;
            }
        }
Exemple #3
0
StdNodalTetExp::StdNodalTetExp(
    const LibUtilities::BasisKey &Ba,
    const LibUtilities::BasisKey &Bb,
    const LibUtilities::BasisKey &Bc,
    LibUtilities::PointsType Ntype):
    StdExpansion  (LibUtilities::StdTetData::getNumberOfCoefficients(
                       Ba.GetNumModes(),
                       Bb.GetNumModes(),
                       Bc.GetNumModes()),
                   3,Ba,Bb,Bc),
    StdExpansion3D(LibUtilities::StdTetData::getNumberOfCoefficients(
                       Ba.GetNumModes(),
                       Bb.GetNumModes(),
                       Bc.GetNumModes()),
                   Ba,Bb,Bc),
    StdTetExp     (Ba,Bb,Bc),
    m_nodalPointsKey(Ba.GetNumModes(),Ntype)
{
    ASSERTL0(Ba.GetNumModes() <= Bb.GetNumModes(),
             "order in 'a' direction is higher than order "
             "in 'b' direction");
    ASSERTL0(Ba.GetNumModes() <= Bc.GetNumModes(),
             "order in 'a' direction is higher than order "
             "in 'c' direction");
    ASSERTL0(Bb.GetNumModes() <= Bc.GetNumModes(),
             "order in 'b' direction is higher than order "
             "in 'c' direction");
}
Exemple #4
0
/**
 * @param       pSession    Session reader for IO
 * @param       pParams     Parameters of filter
 */
FilterBenchmark::FilterBenchmark(
        const LibUtilities::SessionReaderSharedPtr &pSession,
        const std::map<std::string, std::string> &pParams)
    : Filter(pSession)
{
    ASSERTL0(pParams.find("ThresholdValue") != pParams.end(),
             "Missing parameter 'ThresholdValue'.");
    m_thresholdValue = atof(pParams.find("ThresholdValue")->second.c_str());
    ASSERTL0(pParams.find("InitialValue") != pParams.end(),
             "Missing parameter 'InitialValue'.");
    m_initialValue = atof(pParams.find("InitialValue")->second.c_str());
    ASSERTL0(!(pParams.find("OutputFile")->second.empty()),
             "Missing parameter 'OutputFile'.");
    m_outputFile = pParams.find("OutputFile")->second;

    m_startTime = 0.0;
    if (pParams.find("StartTime") != pParams.end())
    {
        m_startTime = atof(pParams.find("StartTime")->second.c_str());
    }

    m_fld = MemoryManager<LibUtilities::FieldIO>::AllocateSharedPtr(
                                                        pSession->GetComm());

}
Exemple #5
0
    void EulerADCFE::DoOdeProjection(
        const Array<OneD, const Array<OneD, NekDouble> > &inarray,
        Array<OneD,       Array<OneD, NekDouble> > &outarray,
        const NekDouble                                   time)
    {
        int i;
        int nvariables = inarray.num_elements();

        switch(m_projectionType)
        {
            case MultiRegions::eDiscontinuous:
            {
                // Just copy over array
                int npoints = GetNpoints();

                for(i = 0; i < nvariables; ++i)
                {
                    Vmath::Vcopy(npoints, inarray[i], 1, outarray[i], 1);
                }
                SetBoundaryConditions(outarray, time);
                break;
            }
            case MultiRegions::eGalerkin:
            case MultiRegions::eMixed_CG_Discontinuous:
            {
                ASSERTL0(false, "No Continuous Galerkin for Euler equations");
                break;
            }
            default:
                ASSERTL0(false, "Unknown projection scheme");
                break;
        }
    }
Exemple #6
0
 /**
  * @brief Initialize filter.
  */
 void FilterEnergy1D::v_Initialise(
     const Array<OneD, const MultiRegions::ExpListSharedPtr> &pFields,
     const NekDouble &time)
 {
     ASSERTL0(pFields[0]->GetExp(0)->GetNumBases() == 1,
              "The Energy 1D filter is only valid in 1D.");
 }
Exemple #7
0
    void EulerADCFE::SetBoundaryConditions(
        Array<OneD, Array<OneD, NekDouble> > &inarray,
        NekDouble                             time)
    {
        std::string varName;
        int cnt        = 0;

        // loop over Boundary Regions
        for (int n = 0; n < m_fields[0]->GetBndConditions().num_elements(); ++n)
        {
            std::string type = m_fields[0]->GetBndConditions()[n]->GetUserDefined();

            // Wall Boundary Condition
            if (boost::iequals(type,"WallViscous"))
            {
                // Wall Boundary Condition
                ASSERTL0(false, "WallViscous is a wrong bc for the "
                         "Euler equations");
            }
            else
            {
                SetCommonBC(type,n,time, cnt,inarray);
            }

            // no User Defined conditions provided so skip cnt 
            // this line is left in case solver specific condition is added. 
            cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize(); 
        }
    }
Exemple #8
0
        void StdNodalTriExp::v_GetEdgeInteriorMap(
            const int                  eid,
            const Orientation      edgeOrient,
            Array<OneD, unsigned int> &maparray,
            Array<OneD,          int> &signarray)
        {
            ASSERTL0(eid >= 0 && eid <= 2,
                     "Local Edge ID must be between 0 and 2"); 
            
            const int nEdgeIntCoeffs = GetEdgeNcoeffs(eid)-2;
            
            if (maparray.num_elements() != nEdgeIntCoeffs)
            {
                maparray = Array<OneD, unsigned int>(nEdgeIntCoeffs);
            }

            if (signarray.num_elements() != nEdgeIntCoeffs)
            {
                signarray = Array<OneD, int>(nEdgeIntCoeffs,1);
            }
            else
            {
                fill(signarray.get(), signarray.get()+nEdgeIntCoeffs, 1);
            }
            
            for (int i = 0; i < nEdgeIntCoeffs; i++)
            {
                maparray[i] = eid*nEdgeIntCoeffs+3+i; 
            }  

            if (edgeOrient == eBackwards)
            {
                reverse(maparray.get(), maparray.get()+nEdgeIntCoeffs);
            }
        }
Exemple #9
0
 /// Solve the linear system for given input and output vectors
 /// using a specified local to global map.
 void GlobalLinSysXxt::v_Solve( const Array<OneD, const NekDouble> &in,
                   Array<OneD,       NekDouble> &out,
             const AssemblyMapSharedPtr &pLocToGloMap,
             const Array<OneD, const NekDouble> &pDirForcing)
 {
     ASSERTL0(false, "Not implemented for this GlobalLinSys type.");
 }
Exemple #10
0
 void FilterEnergyBase::v_GetVelocity(
     const Array<OneD, const MultiRegions::ExpListSharedPtr> &pFields,
     const int i,
     Array<OneD, NekDouble> &velocity)
 {
     ASSERTL0(false, "Needs to implemented by subclass");
 }
Exemple #11
0
int StdNodalTetExp::v_GetVertexMap(const int localVertexId,
                                   bool useCoeffPacking)
{
    ASSERTL0(localVertexId >= 0 && localVertexId <= 3,
             "Local Vertex ID must be between 0 and 3");
    return localVertexId;
}
Exemple #12
0
/**
 * @return Shared pointer to the created ThreadManager.
 *
 * An error occurs if this is called before SetThreadingType.
 */
ThreadManagerSharedPtr ThreadMaster::CreateInstance(const ThreadManagerName t,
    unsigned int nThr)
{
    ASSERTL0(!m_threadingType.empty(),
             "Trying to create a ThreadManager before SetThreadingType called");
    return m_threadManagers[t] =
        Thread::GetThreadManagerFactory().CreateInstance(m_threadingType, nThr);
}
Exemple #13
0
	const NormalVector & StdExpansion1D::v_GetVertexNormal(const int vertex) const
    {
         std::map<int, NormalVector>::const_iterator x;
         x = m_vertexNormals.find(vertex);
         ASSERTL0 (x != m_vertexNormals.end(),
				  "vertex normal not computed.");
         return x->second;
    }
Exemple #14
0
    void EulerADCFE::v_InitObject()
    {
        CompressibleFlowSystem::v_InitObject();

        if (m_shockCaptureType == "Smooth")
        {
            ASSERTL0(m_fields.num_elements() == m_spacedim + 3,
                     "Not enough variables for smooth shock capturing; "
                     "make sure you have added eps to variable list.");
            m_smoothDiffusion = true;
        }

        m_diffusion->SetArtificialDiffusionVector(
            &EulerADCFE::GetArtificialDynamicViscosity, this);

        if(m_session->DefinesSolverInfo("PROBLEMTYPE"))
        {
            std::string ProblemTypeStr = m_session->GetSolverInfo("PROBLEMTYPE");
            int i;
            for(i = 0; i < (int) SIZE_ProblemType; ++i)
            {
                if(boost::iequals(ProblemTypeMap[i], ProblemTypeStr))
                {
                    m_problemType = (ProblemType)i;
                    break;
                }
            }
        }
        else
        {
            m_problemType = (ProblemType)0;
        }

        if (m_explicitAdvection)
        {
            m_ode.DefineOdeRhs    (&EulerADCFE::
            DoOdeRhs, this);
            m_ode.DefineProjection(&EulerADCFE::
            DoOdeProjection, this);
        }
        else
        {
            ASSERTL0(false, "Implicit CFE not set up.");
        }
    }
    void FilterCheckpointCellModel::v_Initialise(const Array<OneD, const MultiRegions::ExpListSharedPtr> &pFields, const NekDouble &time)
    {
        ASSERTL0(m_cell.get(), "Cell model has not been set by EquationSystem "
                "class. Use SetCellModel on this filter to achieve this.");

        m_index = 0;
        m_outputIndex = 0;

        v_Update(pFields, 0.0);
    }
Exemple #16
0
        FilterEnergyBase::FilterEnergyBase(
            const LibUtilities::SessionReaderSharedPtr &pSession,
            const std::map<std::string, std::string> &pParams,
            const bool pConstDensity)
            : Filter        (pSession),
              m_index       (-1),
              m_homogeneous (false),
              m_planes      (),
              m_constDensity(pConstDensity)
        {
            std::string outName;
            if (pParams.find("OutputFile") == pParams.end())
            {
                outName = m_session->GetSessionName();
            }
            else
            {
                ASSERTL0(!(pParams.find("OutputFile")->second.empty()),
                         "Missing parameter 'OutputFile'.");
                outName = pParams.find("OutputFile")->second;
            }

            m_comm = pSession->GetComm();
            outName += ".eny";
            if (m_comm->GetRank() == 0)
            {
                m_outFile.open(outName.c_str());
                ASSERTL0(m_outFile.good(), "Unable to open: '" + outName + "'");
                m_outFile.setf(ios::scientific, ios::floatfield);
                m_outFile << "# Time                Kinetic energy        "
                          << "Enstrophy"
                          << endl
                          << "# ---------------------------------------------"
                          << "--------------"
                          << endl;
            }
            pSession->LoadParameter("LZ", m_homogeneousLength, 0.0);

            ASSERTL0(pParams.find("OutputFrequency") != pParams.end(),
                     "Missing parameter 'OutputFrequency'.");
            m_outputFrequency = atoi(
                pParams.find("OutputFrequency")->second.c_str());
        }
Exemple #17
0
ProcessAddFld::ProcessAddFld(FieldSharedPtr f) : ProcessModule(f)
{
    m_config["scale"]   = ConfigOption(false, "1.0", "scale factor");

    m_config["fromfld"] = ConfigOption(false, "NotSet",
                                "Fld file form which to interpolate field");

    ASSERTL0(m_config["fromfld"].as<string>().compare("NotSet") != 0,
             "Need to specify fromfld=file.fld ");

}
Exemple #18
0
    void Bidomain::v_GenerateSummary(SummaryList& s)
    {
        UnsteadySystem::v_GenerateSummary(s);

        /// @TODO Update summary
        ASSERTL0(false, "Update the generate summary");
//
//        out << "\tChi       	: " << m_chi << endl;
//        out << "\tCm       	: " << m_capMembrane << endl;
//        if (m_session->DefinesFunction("IntracellularConductivity", "AnisotropicConductivityX") &&
//            m_session->GetFunctionType("IntracellularConductivity", "AnisotropicConductivityX") == LibUtilities::eFunctionTypeExpression)
//        {
//            out << "\tIntra-Diffusivity-x   : "
//                << m_session->GetFunction("IntracellularConductivity", "AnisotropicConductivityX")->GetExpression()
//                << endl;
//        }
//        if (m_session->DefinesFunction("IntracellularConductivity", "AnisotropicConductivityY") &&
//            m_session->GetFunctionType("IntracellularConductivity", "AnisotropicConductivityY") == LibUtilities::eFunctionTypeExpression)
//        {
//            out << "\tIntra-Diffusivity-y   : "
//                << m_session->GetFunction("IntracellularConductivity", "AnisotropicConductivityY")->GetExpression()
//                << endl;
//        }
//        if (m_session->DefinesFunction("IntracellularConductivity", "AnisotropicConductivityZ") &&
//            m_session->GetFunctionType("IntracellularConductivity", "AnisotropicConductivityZ") == LibUtilities::eFunctionTypeExpression)
//        {
//            out << "\tIntra-Diffusivity-z   : "
//                << m_session->GetFunction("IntracellularConductivity", "AnisotropicConductivityZ")->GetExpression()
//                << endl;
//        }
//        if (m_session->DefinesFunction("ExtracellularConductivity", "AnisotropicConductivityX") &&
//            m_session->GetFunctionType("ExtracellularConductivity", "AnisotropicConductivityX") == LibUtilities::eFunctionTypeExpression)
//        {
//            out << "\tExtra-Diffusivity-x   : "
//                << m_session->GetFunction("ExtracellularConductivity", "AnisotropicConductivityX")->GetExpression()
//                << endl;
//        }
//        if (m_session->DefinesFunction("ExtracellularConductivity", "AnisotropicConductivityY") &&
//            m_session->GetFunctionType("ExtracellularConductivity", "AnisotropicConductivityY") == LibUtilities::eFunctionTypeExpression)
//        {
//            out << "\tExtra-Diffusivity-y   : "
//                << m_session->GetFunction("ExtracellularConductivity", "AnisotropicConductivityY")->GetExpression()
//                << endl;
//        }
//        if (m_session->DefinesFunction("ExtracellularConductivity", "AnisotropicConductivityZ") &&
//            m_session->GetFunctionType("ExtracellularConductivity", "AnisotropicConductivityZ") == LibUtilities::eFunctionTypeExpression)
//        {
//            out << "\tExtra-Diffusivity-z   : "
//                << m_session->GetFunction("ExtracellularConductivity", "AnisotropicConductivityZ")->GetExpression()
//                << endl;
//        }
        m_cell->GenerateSummary(s);
    }
    FilterCheckpointCellModel::FilterCheckpointCellModel(
        const LibUtilities::SessionReaderSharedPtr &pSession,
        const std::map<std::string, std::string> &pParams) :
        Filter(pSession)
    {
        if (pParams.find("OutputFile") == pParams.end())
        {
            m_outputFile = m_session->GetSessionName();
        }
        else
        {
            ASSERTL0(!(pParams.find("OutputFile")->second.empty()),
                     "Missing parameter 'OutputFile'.");
            m_outputFile = pParams.find("OutputFile")->second;
        }
        ASSERTL0(pParams.find("OutputFrequency") != pParams.end(),
                 "Missing parameter 'OutputFrequency'.");
        m_outputFrequency = atoi(pParams.find("OutputFrequency")->second.c_str());
        m_outputIndex = 0;
        m_index = 0;
        m_fld = MemoryManager<LibUtilities::FieldIO>::AllocateSharedPtr(m_session->GetComm());

    }
Exemple #20
0
    /**
     * @brief Compute the projection for the linear advection equation.
     *
     * @param inarray    Given fields.
     * @param outarray   Calculated solution.
     * @param time       Time.
     */
    void UnsteadyAdvection::DoOdeProjection(
        const Array<OneD, const Array<OneD, NekDouble> >&inarray,
              Array<OneD,       Array<OneD, NekDouble> >&outarray,
        const NekDouble time)
    {
        // Counter variable
        int i;

        // Number of fields (variables of the problem)
        int nVariables = inarray.num_elements();

        // Set the boundary conditions
        SetBoundaryConditions(time);

        // Switch on the projection type (Discontinuous or Continuous)
        switch(m_projectionType)
        {
            // Discontinuous projection
            case MultiRegions::eDiscontinuous:
            {
                // Number of quadrature points
                int nQuadraturePts = GetNpoints();

                // Just copy over array
                for(i = 0; i < nVariables; ++i)
                {
                    Vmath::Vcopy(nQuadraturePts, inarray[i], 1, outarray[i], 1);
                }
                break;
            }

            // Continuous projection
            case MultiRegions::eGalerkin:
            case MultiRegions::eMixed_CG_Discontinuous:
            {
                Array<OneD, NekDouble> coeffs(m_fields[0]->GetNcoeffs(),0.0);
                for(i = 0; i < nVariables; ++i)
                {
                    m_fields[i]->FwdTrans(inarray[i], coeffs);
                    m_fields[i]->BwdTrans_IterPerExp(coeffs, outarray[i]);
                }
                break;
            }

            default:
                ASSERTL0(false,"Unknown projection scheme");
                break;
        }
    }
	/**
	 *  Calculates the second term of the weak form (1): \f$
	 *  \left( \frac{\partial \mathbf{F(\mathbf{U})}^{\delta}
	 *  }{\partial x}, \mathbf{\psi}^{\delta} \right)_{\Omega_e}
	 *  \f$
	 *  The variables of the system are $\mathbf{U} = [A,u]^T$
	 *  physfield[0] = A        physfield[1] = u
	 *  flux[0] = F[0] = A*u    flux[1] = F[1] = u^2/2 + p/rho
	 *  p-A-relationship: p = p_ext + beta*(sqrt(A)-sqrt(A_0))
	 */
    void PulseWavePropagation::v_GetFluxVector(const int i, Array<OneD, Array<OneD, NekDouble> > &physfield,
                                               Array<OneD, Array<OneD, NekDouble> > &flux)
    {
        int nq = m_vessels[m_currentDomain*m_nVariables]->GetTotPoints();
        NekDouble p = 0.0;
        NekDouble p_t = 0.0;
	
        switch (i)
        {
        case 0:   // Flux for A equation
            {
                for (int j = 0; j < nq; j++)
                {
                    flux[0][j] = physfield[0][j]*physfield[1][j]; 
                }
            }
            break;
        case 1:  // Flux for u equation
            {
                for (int j = 0; j < nq; j++)
                {
                    ASSERTL0(physfield[0][j]>=0,"Negative A not allowed.");

                    p = m_pext + m_beta[m_currentDomain][j]*
                        (sqrt(physfield[0][j]) - sqrt(m_A_0[m_currentDomain][j]));

                    p_t = (physfield[1][j]*physfield[1][j])/2 + p/m_rho;
                    flux[0][j] =  p_t;
                }
            }
            break;
        default:
            ASSERTL0(false,"GetFluxVector: illegal vector index");
			break;
        }
    }
    /**
     *  Calculates the third term of the weak form (1): numerical flux
     *  at boundary \f$ \left[ \mathbf{\psi}^{\delta} \cdot \{
     *  \mathbf{F}^u - \mathbf{F}(\mathbf{U}^{\delta}) \}
     *  \right]_{x_e^l}^{x_eû} \f$
     */
    void PulseWavePropagation::v_NumericalFlux(Array<OneD, Array<OneD, NekDouble> > &physfield, 
                                               Array<OneD, Array<OneD, NekDouble> > &numflux)
    {		
        int i;
        int nTracePts = GetTraceTotPoints();
        
        Array<OneD, Array<OneD, NekDouble> > Fwd(m_nVariables);
        Array<OneD, Array<OneD, NekDouble> > Bwd(m_nVariables);
        
        for (i = 0; i < m_nVariables; ++i)
        {
            Fwd[i] = Array<OneD, NekDouble>(nTracePts);
            Bwd[i] = Array<OneD, NekDouble>(nTracePts);
        }
	
        // Get the physical values at the trace
        for (i = 0; i < m_nVariables; ++i)
        {
            m_vessels[m_currentDomain*m_nVariables+ i]->
                GetFwdBwdTracePhys(physfield[i],Fwd[i],Bwd[i]);
        }
        
        // Solve the upwinding Riemann problem within one arterial
        // segment by calling the upwinding Riemann solver implemented
        // in this file
        NekDouble Aflux, uflux;
        for (i = 0; i < nTracePts; ++i)
        {
            switch(m_upwindTypePulse)
            {
            case eUpwindPulse:
                {
                    RiemannSolverUpwind(Fwd[0][i],Fwd[1][i],Bwd[0][i],Bwd[1][i],
                                        Aflux, uflux, m_A_0_trace[m_currentDomain][i],
                                        m_beta_trace[m_currentDomain][i],
                                        m_trace_fwd_normal[m_currentDomain][i]);
                }
                break;
            default:
                {
                    ASSERTL0(false,"populate switch statement for upwind flux");
                }
                break;
            }
            numflux[0][i] = Aflux;
            numflux[1][i] = uflux;
        }
    }
Exemple #23
0
    void  LinearSWESolver::v_Solve(
        const Array<OneD, const Array<OneD, NekDouble> > &Fwd,
        const Array<OneD, const Array<OneD, NekDouble> > &Bwd,
              Array<OneD,       Array<OneD, NekDouble> > &flux)
    {

	// extract the forward and backward trace of the depth
  	const Array<OneD, NekDouble> &dFwd = m_scalars["depthFwd"]();
 	const Array<OneD, NekDouble> &dBwd = m_scalars["depthBwd"]();


        if (m_pointSolve)
        {
	  	  
            int expDim = Fwd.num_elements()-1;
            NekDouble vf;

            if (expDim == 1)
            {
                for (int i = 0; i < Fwd[0].num_elements(); ++i)
                {
                    v_PointSolve(
			Fwd [0][i], Fwd [1][i], 0.0, dFwd[i], 
		  	Bwd [0][i], Bwd [1][i], 0.0, dBwd[i],
                        flux[0][i], flux[1][i], vf);
                }
            }
            else if (expDim == 2)
            {
                for (int i = 0; i < Fwd[0].num_elements(); ++i)
                {
		  v_PointSolve(
			Fwd [0][i], Fwd [1][i], Fwd [2][i], dFwd[i],
			Bwd [0][i], Bwd [1][i], Bwd [2][i], dBwd[i],
                        flux[0][i], flux[1][i], flux[2][i]);
                }
            }
            else if (expDim == 3)
            {
	      ASSERTL0(false, "No 3D Shallow water supported.");
	    }
        }
        else
        {
            v_ArraySolve(Fwd, Bwd, flux);
        }
    }
Exemple #24
0
        void BLPoints::CalculatePoints()
        {
            // Allocate the storage for points.
            PointsBaseType::CalculatePoints();
            unsigned int npts = m_pointsKey.GetNumPoints(); 

	    // Derived power coefficient.
            NekDouble r = m_pointsKey.GetFactor();
            ASSERTL0(r != NekConstants::kNekUnsetDouble,
                     "Must set factor in BLPoints key");

            if (fabs(r-1.0) < 1e-6)
            {
                NekDouble tmp = 2.0/(npts-1.0);
                for (unsigned int i = 0; i < npts; ++i)
                {
                    m_points[0][i] = -1.0 + i * tmp;
                }
            }
            else
            {
                NekDouble a = 2.0 * (1.0-r) / (1.0 - pow(r,(double)npts));
                m_points[0][0] = -1.0;
                
                for (unsigned int i = 1; i < npts; ++i)
                {
                    m_points[0][i] = m_points[0][i-1] + a*pow(r,(double)i);
                }

                m_points[0][npts-1] = 1.0;
            }
            
            if (m_pointsKey.GetPointsType() == eBoundaryLayerPointsRev)
            {
                vector<NekDouble> tmp(npts);
                for (unsigned int i = 0; i < npts; ++i)
                {
                    tmp[i] = - m_points[0][npts-1-i];
                }
                
                for (unsigned int i = 0; i < npts; ++i)
                {
                    m_points[0][i] = tmp[i];
                }
            }
        }
    void PulseWavePropagation::v_InitObject()
    {
        PulseWaveSystem::v_InitObject();
	
        m_pressureArea=GetPressureAreaFactory().CreateInstance("Lymphatic",m_vessels,m_session);
        m_pressureArea->DoPressure();
	
        if (m_explicitAdvection)
        {
            m_ode.DefineOdeRhs       (&PulseWavePropagation::DoOdeRhs, this);
            m_ode.DefineProjection   (&PulseWavePropagation::DoOdeProjection, this);
        }
        else
        {
            ASSERTL0(false, "Implicit Pulse Wave Propagation not set up.");
        }
    }
 void PreconditionerDiagonal::v_BuildPreconditioner()
 {
     GlobalSysSolnType solvertype = 
         m_locToGloMap->GetGlobalSysSolnType();
     if (solvertype == eIterativeFull)
     {
         DiagonalPreconditionerSum();
     }
     else if(solvertype == eIterativeStaticCond ||
             solvertype == eIterativeMultiLevelStaticCond)
     {
         StaticCondDiagonalPreconditionerSum();
     }
     else
     {
         ASSERTL0(0,"Unsupported solver type");
     }
 }
Exemple #27
0
        void DriverArnoldi::ArnoldiSummary(std::ostream &out)
        {
            if (m_comm->GetRank() == 0)
            {
                if(m_session->DefinesSolverInfo("SingleMode"))
                {
                    out << "\tSingle Fourier mode    : true " << endl;
                    ASSERTL0(m_session->DefinesSolverInfo("Homogeneous"),
                             "Expected a homogeneous expansion to be defined "
                             "with single mode");
                }
                else
                {
                    out << "\tSingle Fourier mode    : false " << endl;
                }
                if(m_session->DefinesSolverInfo("BetaZero"))           
                {
                    out << "\tBeta set to Zero       : true (overrides LHom)" 
                        << endl;
                }
                else
                {
                    out << "\tBeta set to Zero       : false " << endl;
                }

                if(m_timeSteppingAlgorithm)
                {
                    out << "\tEvolution operator     : " 
                        << m_session->GetSolverInfo("EvolutionOperator") 
                        << endl;
                }
                else
                {
                    out << "\tShift (Real,Imag)      : " << m_realShift 
                        << "," << m_imagShift <<  endl;
                }
                out << "\tKrylov-space dimension : " << m_kdim << endl;
                out << "\tNumber of vectors      : " << m_nvec << endl;
                out << "\tMax iterations         : " << m_nits << endl;
                out << "\tEigenvalue tolerance   : " << m_evtol << endl;
                out << "======================================================" 
                    << endl;
            }
        }
Exemple #28
0
        // \brief Read segments (and general MeshGraph) given TiXmlDocument.
        void MeshGraph2D::ReadGeometry(TiXmlDocument &doc)
        {
            // Read mesh first
            MeshGraph::ReadGeometry(doc);
            TiXmlHandle docHandle(&doc);

            TiXmlElement* mesh = NULL;

            /// Look for all geometry related data in GEOMETRY block.
            mesh = docHandle.FirstChildElement("NEKTAR").FirstChildElement("GEOMETRY").Element();

            ASSERTL0(mesh, "Unable to find GEOMETRY tag in file.");
            
            ReadCurves(doc);
            ReadEdges(doc);
            ReadElements(doc);
            ReadComposites(doc);
            ReadDomain(doc);
        }
Exemple #29
0
 StdNodalTriExp::StdNodalTriExp(
     const LibUtilities::BasisKey &Ba, 
     const LibUtilities::BasisKey &Bb, 
     LibUtilities::PointsType Ntype):
     StdExpansion  (LibUtilities::StdTriData::getNumberOfCoefficients(
                        Ba.GetNumModes(),
                        Bb.GetNumModes()),
                    2,Ba,Bb),
     StdExpansion2D(LibUtilities::StdTriData::getNumberOfCoefficients(
                        Ba.GetNumModes(),
                        Bb.GetNumModes()),
                    Ba,Bb),
     StdTriExp     (Ba,Bb),
     m_nodalPointsKey(Ba.GetNumModes(),Ntype)
 {
     ASSERTL0(m_base[0]->GetNumModes() == m_base[1]->GetNumModes(),
              "Nodal basis initiated with different orders in the a "
              "and b directions");   
 }
Exemple #30
0
 /**
  * Initialisation for the transient growth
  */
 void DriverArnoldi::CopyFwdToAdj()
 {
     Array<OneD, MultiRegions::ExpListSharedPtr> fields;
 
     if(m_timeSteppingAlgorithm)
     {
         fields = m_equ[0]->UpdateFields();
         int nq = fields[0]->GetNcoeffs();
     
     
         for (int k=0 ; k < m_nfields; ++k)
         {
             Vmath::Vcopy(nq,  &fields[k]->GetCoeffs()[0], 1,&m_equ[1]->UpdateFields()[k]->UpdateCoeffs()[0], 1);
         
         }
     }
     else
     {
         ASSERTL0(false,"Transient Growth non available for Coupled Solver");
     
     }
 };