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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...