Gowdy solver
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
GowdyEvolve Class Reference

GowdyEvolve encapsulates the IVP solver for Gowdy spacetime. More...

Inheritance diagram for GowdyEvolve:
Collaboration diagram for GowdyEvolve:

Public Member Functions

bool setupInitialData ()
 The initial data is prepared by hand (thus not loaded from any file).
 GowdyEvolve (Parameters &params, UniformGrid &ug, MoLIntegrator &integ)
 Creates and configures the Gowdy solver from the given parameters.

Private Member Functions

Realt (Real m, Real n)
Realr (Real m, Real n)
RealP (Real m, Real n)
RealP_t (Real m, Real n)
Real P_r (Real m, Real n)
Real P_rr (Real m, Real n)
RealQ (Real m, Real n)
RealQ_t (Real m, Real n)
Real Q_r (Real m, Real n)
Real Q_rr (Real m, Real n)
RealR (Real m, Real n)
RealR_t (Real m, Real n)
Real R_r (Real m, Real n)
Real R_rr (Real m, Real n)
RealS (Real m, Real n)
RealS_t (Real m, Real n)
Real S_r (Real m, Real n)
Real S_rr (Real m, Real n)
RealL (Real m, Real n)
RealL_t (Real m, Real n)
Real L_r (Real m, Real n)
Real L_rr (Real m, Real n)
RealC (Real m, Real n)
Real eq_P_t (Int m, Int n)
Real eq_Q_t (Int m, Int n)
Real eq_R_t (Int m, Int n)
Real eq_S_t (Int m, Int n)
Real eq_L_t (Int m, Int n)
Real eq_C_violation (Int m, Int n)
virtual void integStep_Prepare (Int m)
 Calculates the dependent variables from the prime state variables which are needed for the integration.
virtual void integStep_CalcEvolutionRHS (Int m)
 Calculate the right-hand side for time evolution.
virtual bool integStep_CheckForNaNs (Int m, Int nFrom, Int nTo)
 At each checkpoint, outputs the grid row every mSkip steps, also reporting the integration time and checking for eventual NaNs.
virtual void integStep_Finalize (Int mNext, Int mPrev)
 Perform the additional steps after each integration step.
virtual void applyLeftBoundaryCondition (Int m)
 Apply the periodic boundary conditions on left.
virtual void applyRightBoundaryCondition (Int m)
 Apply the periodic boundary conditions on right.

Detailed Description

GowdyEvolve encapsulates the IVP solver for Gowdy spacetime.

Definition at line 93 of file gowdy-solver.cpp.


Constructor & Destructor Documentation

GowdyEvolve::GowdyEvolve ( Parameters params,
UniformGrid ug,
MoLIntegrator integ 
) [inline]

Creates and configures the Gowdy solver from the given parameters.

Definition at line 254 of file gowdy-solver.cpp.

References MoLIntegrator::addToEvolution(), fld::gowdyEvolved, MoLIntegrator::keepEvolved(), and slog.

        : GridUser( ug )
    {
        slog << "Gowdy Solver:" << std::endl << std::endl;

        // Sign up for the integration
        //
        integ.addToEvolution( this );

        // Add our grid functions to the evolution
        //
        integ.keepEvolved( fld::gowdyEvolved ); // Evolved
    }

Member Function Documentation

virtual void GowdyEvolve::applyLeftBoundaryCondition ( Int  m) [inline, private, virtual]

Apply the periodic boundary conditions on left.

Implements IntegFace.

Definition at line 200 of file gowdy-solver.cpp.

References L(), GridUser::nGhost, GridUser::nLen, P(), Q(), r(), R(), S(), and t().

    {
        for( Int i = 0; i < nGhost; ++i )
        {
            t(m,i) = t(m,nLen+i);
            r(m,i) = r(m,nLen+i);
            P(m,i) = P(m,nLen+i);
            Q(m,i) = Q(m,nLen+i);
            R(m,i) = R(m,nLen+i);
            S(m,i) = S(m,nLen+i);
            L(m,i) = L(m,nLen+i);
        }
    }
virtual void GowdyEvolve::applyRightBoundaryCondition ( Int  m) [inline, private, virtual]

Apply the periodic boundary conditions on right.

Implements IntegFace.

Definition at line 216 of file gowdy-solver.cpp.

References L(), GridUser::nGhost, GridUser::nLen, P(), Q(), r(), R(), S(), and t().

    {
        for( Int i = 0; i < nGhost; ++i )
        {
            t(m,nGhost+nLen+i) = t(m,nGhost+i);
            r(m,nGhost+nLen+i) = r(m,nGhost+i);
            P(m,nGhost+nLen+i) = P(m,nGhost+i);
            Q(m,nGhost+nLen+i) = Q(m,nGhost+i);
            R(m,nGhost+nLen+i) = R(m,nGhost+i);
            S(m,nGhost+nLen+i) = S(m,nGhost+i);
            L(m,nGhost+nLen+i) = L(m,nGhost+i);
        }
    }
Real& GowdyEvolve::C ( Real  m,
Real  n 
) [private]
Real GowdyEvolve::eq_C_violation ( Int  m,
Int  n 
) [inline, private]

Definition at line 150 of file gowdy-solver.cpp.

References L_r(), P(), P_r(), Q_r(), R(), and S().

Referenced by integStep_CalcEvolutionRHS().

                                        {
        return L_r(m, n) + 2 * P_r(m, n) * R(m, n)
            + 2 * exp(2 * P(m, n)) * Q_r(m, n) * S(m, n);
    }
Real GowdyEvolve::eq_L_t ( Int  m,
Int  n 
) [inline, private]

Definition at line 141 of file gowdy-solver.cpp.

References P(), P_r(), pow2(), Q_r(), R(), S(), and t().

Referenced by integStep_CalcEvolutionRHS().

                                {
        return -pow2(P_r(m, n)) / exp(2 * t(m,n))
            - exp(2 * (P(m, n) - t(m,n))) * pow2(Q_r(m, n))
            - exp(2 * P(m, n)) * pow2(S(m, n))
            - pow2(R(m, n));
    }
Real GowdyEvolve::eq_P_t ( Int  m,
Int  n 
) [inline, private]

Definition at line 121 of file gowdy-solver.cpp.

References R().

Referenced by integStep_CalcEvolutionRHS().

                                {
        return R(m, n);
    }
Real GowdyEvolve::eq_Q_t ( Int  m,
Int  n 
) [inline, private]

Definition at line 125 of file gowdy-solver.cpp.

References S().

Referenced by integStep_CalcEvolutionRHS().

                                {
        return S(m, n);
    }
Real GowdyEvolve::eq_R_t ( Int  m,
Int  n 
) [inline, private]

Definition at line 129 of file gowdy-solver.cpp.

References P(), P_rr(), pow2(), Q_r(), S(), and t().

Referenced by integStep_CalcEvolutionRHS().

                                {
        return P_rr(m, n) / exp(2 * t(m,n))
            - exp(2 * (P(m, n) - t(m,n))) * pow2(Q_r(m, n))
            + exp(2 * P(m, n)) * pow2(S(m, n));
    }
Real GowdyEvolve::eq_S_t ( Int  m,
Int  n 
) [inline, private]

Definition at line 135 of file gowdy-solver.cpp.

References P_r(), Q_r(), Q_rr(), R(), S(), and t().

Referenced by integStep_CalcEvolutionRHS().

                                {
        return Q_rr(m, n) / exp(2 * t(m,n))
            + 2 * P_r(m, n) * Q_r(m, n) / exp(2 * t(m,n))
            - 2 * R(m, n) * S(m, n);
    }
virtual void GowdyEvolve::integStep_CalcEvolutionRHS ( Int  m) [inline, private, virtual]

Calculate the right-hand side for time evolution.

Implements IntegFace.

Definition at line 167 of file gowdy-solver.cpp.

References C(), eq_C_violation(), eq_L_t(), eq_P_t(), eq_Q_t(), eq_R_t(), eq_S_t(), L_t(), GridUser::nGhost, GridUser::nLen, OMP_parallel_for, P_t(), Q_t(), R_t(), and S_t().

    {
        OMP_parallel_for( Int n = nGhost; n < nGhost + nLen; ++n )
        {
            P_t (m,n) = eq_P_t (m,n);
            Q_t (m,n) = eq_Q_t (m,n);
            R_t (m,n) = eq_R_t (m,n);
            S_t (m,n) = eq_S_t (m,n);
            L_t (m,n) = eq_L_t (m,n);

            // Calculate the constraint violation
            C(m,n) = eq_C_violation(m,n);
        }
    }
virtual bool GowdyEvolve::integStep_CheckForNaNs ( Int  m,
Int  nFrom,
Int  nTo 
) [inline, private, virtual]

At each checkpoint, outputs the grid row every mSkip steps, also reporting the integration time and checking for eventual NaNs.

Implements IntegFace.

Definition at line 185 of file gowdy-solver.cpp.

References GF, GridUser::nGhost, and fld::P.

    {
        for( Int n = nFrom; n < nTo; ++n ) {
            if ( std::isnan( GF( fld::P, m, nGhost + n ) ) ) {
                return true;
            }
        }
        return false;
    }
virtual void GowdyEvolve::integStep_Finalize ( Int  mNext,
Int  mPrev 
) [inline, private, virtual]

Perform the additional steps after each integration step.

Implements IntegFace.

Definition at line 195 of file gowdy-solver.cpp.

    {} // Unimplemented IntegFace methods
virtual void GowdyEvolve::integStep_Prepare ( Int  m) [inline, private, virtual]

Calculates the dependent variables from the prime state variables which are needed for the integration.

Implements IntegFace.

Definition at line 162 of file gowdy-solver.cpp.

    {} // Unimplemented
Real GowdyEvolve::L_r ( Real  m,
Real  n 
) [private]

Referenced by eq_C_violation().

Real GowdyEvolve::L_rr ( Real  m,
Real  n 
) [private]
Real& GowdyEvolve::L_t ( Real  m,
Real  n 
) [private]
Real GowdyEvolve::P_r ( Real  m,
Real  n 
) [private]

Referenced by eq_C_violation(), eq_L_t(), and eq_S_t().

Real GowdyEvolve::P_rr ( Real  m,
Real  n 
) [private]

Referenced by eq_R_t().

Real& GowdyEvolve::P_t ( Real  m,
Real  n 
) [private]
Real GowdyEvolve::Q_r ( Real  m,
Real  n 
) [private]

Referenced by eq_C_violation(), eq_L_t(), eq_R_t(), and eq_S_t().

Real GowdyEvolve::Q_rr ( Real  m,
Real  n 
) [private]

Referenced by eq_S_t().

Real& GowdyEvolve::Q_t ( Real  m,
Real  n 
) [private]
Real& GowdyEvolve::r ( Real  m,
Real  n 
) [private]
Real GowdyEvolve::R_r ( Real  m,
Real  n 
) [private]
Real GowdyEvolve::R_rr ( Real  m,
Real  n 
) [private]
Real& GowdyEvolve::R_t ( Real  m,
Real  n 
) [private]
Real GowdyEvolve::S_r ( Real  m,
Real  n 
) [private]
Real GowdyEvolve::S_rr ( Real  m,
Real  n 
) [private]
Real& GowdyEvolve::S_t ( Real  m,
Real  n 
) [private]
bool GowdyEvolve::setupInitialData ( ) [inline]

The initial data is prepared by hand (thus not loaded from any file).

Definition at line 234 of file gowdy-solver.cpp.

References L(), GridUser::nGhost, GridUser::nLen, P(), Q(), r(), R(), and S().

Referenced by main().

    {
        static const double PI = acos(-1.0);

        for( Int n = 0; n < nLen; ++n )
        {
            double x = 2.0 * PI * n / nLen;
            r(0,nGhost+n) = x;
            P(0,nGhost+n) = 0;
            Q(0,nGhost+n) = cosl(x);
            R(0,nGhost+n) = 5 * cosl(x);
            S(0,nGhost+n) = 0;
            L(0,nGhost+n) = 0;
        }

        return true;
    }
Real& GowdyEvolve::t ( Real  m,
Real  n 
) [private]

The documentation for this class was generated from the following file: