/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2312                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [1 -1 -2 0 0 0 0];

internalField   uniform 100000;

boundaryField
{

    
    piston
    {
       type            zeroGradient;
    }
    
    cylinderWall
    {
        type            zeroGradient;
    }

    topWall
    {
        type            zeroGradient;
    }
    
    inlet 
    {
       
        type            fixedValue;
        value           uniform 1.2e5; 
    }
    
     outlet
     {
        type        zeroGradient;
     }

// inlet
// {
//     type            codedMixed;
//     value           uniform 1e5; 
//     name            timeDependentInletPressure;
//     refGradient     uniform 0;         
//     valueFraction   uniform 0;         
//     refValue        uniform 1.2e5;
//     code            #{
//                         // Get current simulation time
//                         const scalar t = this->db().time().value();
                        
                        
//                         const scalar cyclePeriod = 0.1; 
//                         const scalar suctionTime = 0.02;
                        
//                         // Calculate time within the current cycle
//                         scalar cycleTime = t - floor(t / cyclePeriod) * cyclePeriod;
                        
//                         if (cycleTime <= suctionTime)
//                         {
                            
//                             this->refValue() = 1.2e5; // Pressure value
//                             this->valueFraction() = 1.0; // Fully fixed value
//                         }
//                         else
//                         {
//                             // Wall phase: zero gradient
//                             this->refValue() = 0; // Irrelevant for zero gradient
//                             this->valueFraction() = 0.0; // Fully zero gradient
//                         }
//                     #};

//     codeInclude
//     #{
//         #include "fvCFD.H"
//     #};

//     codeOptions
//     #{
//         -I$(LIB_SRC)/finiteVolume/lnInclude \
//         -I$(LIB_SRC)/meshTools/lnInclude
//     #};

//     codeLibs
//     #{
//         -lfiniteVolume \
//         -lmeshTools
//     #};
//      codeContext             <dict>;
// }

// // outlet
// // {
// //     type            codedMixed;
// //     value           uniform 1e5; 
// //     name            timeDependentInletPressure;
// //     refGradient     uniform 0;         
// //     valueFraction   uniform 0;         
// //     refValue        uniform 0.8e5;
// //     code            #{
// //                         const scalar t = this->db().time().value();
// //                         const scalar cyclePeriod = 0.08;
// //                         const scalar exhaustStart = 0.06;
                        
// //                         scalar cycleTime = t - floor(t / cyclePeriod) * cyclePeriod;
                        
// //                         if (cycleTime >= exhaustStart) {
// //                             // Exhaust phase: fixed pressure at outlet
// //                             this->refValue() = 0.8e5;
// //                             this->valueFraction() = 1.0;
// //                         } else {
// //                             // All other times: zero gradient at outlet
// //                             this->refValue() = 0;
// //                             this->valueFraction() = 0.0;
// //                         }
// //                     #};


// //     codeInclude
// //     #{
// //         #include "fvCFD.H"
// //     #};

// //     codeOptions
// //     #{
// //         -I$(LIB_SRC)/finiteVolume/lnInclude \
// //         -I$(LIB_SRC)/meshTools/lnInclude
// //     #};

// //     codeLibs
// //     #{
// //         -lfiniteVolume \
// //         -lmeshTools
// //     #};
// //      codeContext             <dict>;
// // }
    
    
}



// ************************************************************************* //
