Jump to content
Britton Ward

Dynamic Commenting of Template Files

Recommended Posts

Hi,

 

I've been connecting some OpenFOAM files and I wondered if it was possible to dynamically Comment or Uncomment a series of lines in an input file template.

 

For example in the attached U file the specification for the boundary conditions changes depending on the inflow velocity vector.

 

Depending on the value of Yaw I would like to comment/uncomment select lines.

 

Is there a way to implement this type of edit efficiently in CAESES?

 

Britt

 

 

/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.4.x                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volVectorField;
    location    "0";
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
#include        "include/initialConditions"
 
dimensions      [0 1 -1 0 0 0 0];
 
internalField   uniform (0 0 0);
 
boundaryField
{
    minX
    {
        type            zeroGradient;
    }
    maxX
    {
        type            rampedVelocity;
        finalVelocity   $flowVelocity;
        rampingTime     $rampTime;
        rampingScheme   $rampScheme;
        value           $internalField;
    }
    minY
    {
        // yaw <= 0deg
        type            zeroGradient;
 
//         // yaw > 0deg
//         type            rampedVelocity;
//         finalVelocity   $flowVelocity;
//         rampingTime     $rampTime;
//         rampingScheme   $rampScheme;
//         value           $internalField;
    }
    maxY
    {
        // yaw >= 0deg
        type            zeroGradient;
 
//         // yaw < 0deg
//         type            rampedVelocity;
//         finalVelocity   $flowVelocity;
//         rampingTime     $rampTime;
//         rampingScheme   $rampScheme;
//         value           $internalField;
    }
    minZ
    {
        type            zeroGradient;
    }
    maxZ
    {
        type            zeroGradient;
    }
    ship
    {
        type            movingWallVelocity;
        value           uniform (0 0 0);
    }
}
 
 
// ************************************************************************* //

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...