CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

Execution of setFields changes boundary condition types

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 21, 2019, 04:11
Default Execution of setFields changes boundary condition types
  #1
Senior Member
 
Sita Drost
Join Date: Mar 2009
Location: Arnhem, The Netherlands
Posts: 227
Rep Power: 18
sita is on a distinguished road
Dear all,

I'm playing around with the velocity ramping functionality for multiphase flows (OpenFOAM-dev, build dev-54cb927cee89, on Scientific Linux cluster).

At the moment I'm trying to adapt the DTCHull tutorial case to include a quarter sine velocity ramp at start-up. I've included the required fvOptions file in constant, adapted the simulation parameters to run a transient simulation (the original tutorial uses local time stepping), and added ramping to my inlet and outlet BCs in 0/U.

However, after running setFields, my outlet velocity ramping BC changes back to the original outletPhaseMeanVelocity, without velocity ramping. I've already removed all occurrences of #includeEtc "caseDicts/setConstraintTypes", but still my ramping BC keeps disappearing.

Surely there must be something very silly that I'm overlooking here, but right now I can't find it. Does anyone have experience with this?

Thanks in advance,
Sita
sita is offline   Reply With Quote

Old   May 21, 2019, 05:24
Default Solved
  #2
Senior Member
 
Sita Drost
Join Date: Mar 2009
Location: Arnhem, The Netherlands
Posts: 227
Rep Power: 18
sita is on a distinguished road
Got it: I was using the wrong syntax for the velocity ramping BCs
sita is offline   Reply With Quote

Old   September 29, 2022, 04:07
Default
  #3
New Member
 
Seyfi Girgin
Join Date: Aug 2015
Posts: 12
Rep Power: 10
seyfigirgin is on a distinguished road
Quote:
Originally Posted by sita View Post
Got it: I was using the wrong syntax for the velocity ramping BCs
Hi Sita,

How did you manage to do this. I want to apply setFields command without changing the boundary conditions also
seyfigirgin is offline   Reply With Quote

Old   September 29, 2022, 07:09
Default
  #4
Senior Member
 
Sita Drost
Join Date: Mar 2009
Location: Arnhem, The Netherlands
Posts: 227
Rep Power: 18
sita is on a distinguished road
Ouch, that was a long time ago; I changed jobs in the meantime...

I looked up some old code, here's the contents of the 0/u file, hopefully that'll help you:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  5.x                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      binary;
    class       volVectorField;
    location    "0";
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include		"../constant/refValues";

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

internalField   uniform (0 0 0);

boundaryField
{
    // hull parts
	".*\$_s[0-9]_b[0-9]"
	{
		type			movingWallVelocity;
		value			uniform (0 0 0);
	}
	// symmetry plane
    _ymin
    {
        type            symmetryPlane;
    }
	// atmosphere
    _zmax
    {
        type            pressureInletOutletVelocity;
        value           uniform (0 0 0);
    }
	// outlet
    _xmin
    {
        type            outletPhaseMeanVelocity;
        alpha           alpha.water;
        value           $internalField;
        UnMean          
		{
			value		$Uref;
			type		scale;
			scale
			{
				type		quarterSineRamp;
				start		0;
				duration	$duration; //#calc	"400*$deltaT";
			}
		}
    }
	// far side of box
    _ymax
    {
        type            zeroGradient;
    }
	// bottom of box
    _zmin
    {
        type            zeroGradient;
    }
	// inlet
    _xmax
    {        
		type            uniformFixedValue;
		value			$internalField;
        uniformValue    
		{
			value		(#neg $Uref 0 0);
			type 		scale;
			scale
			{
				type	quarterSineRamp;
				start	0;
				duration $duration; //#calc	"400*$deltaT";
			}
		}
	}
}


// ************************************************************************* //
sita is offline   Reply With Quote

Old   September 29, 2022, 12:29
Default
  #5
New Member
 
Seyfi Girgin
Join Date: Aug 2015
Posts: 12
Rep Power: 10
seyfigirgin is on a distinguished road
Quote:
Originally Posted by sita View Post
Ouch, that was a long time ago; I changed jobs in the meantime...

I looked up some old code, here's the contents of the 0/u file, hopefully that'll help you:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  5.x                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      binary;
    class       volVectorField;
    location    "0";
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include		"../constant/refValues";

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

internalField   uniform (0 0 0);

boundaryField
{
    // hull parts
	".*\$_s[0-9]_b[0-9]"
	{
		type			movingWallVelocity;
		value			uniform (0 0 0);
	}
	// symmetry plane
    _ymin
    {
        type            symmetryPlane;
    }
	// atmosphere
    _zmax
    {
        type            pressureInletOutletVelocity;
        value           uniform (0 0 0);
    }
	// outlet
    _xmin
    {
        type            outletPhaseMeanVelocity;
        alpha           alpha.water;
        value           $internalField;
        UnMean          
		{
			value		$Uref;
			type		scale;
			scale
			{
				type		quarterSineRamp;
				start		0;
				duration	$duration; //#calc	"400*$deltaT";
			}
		}
    }
	// far side of box
    _ymax
    {
        type            zeroGradient;
    }
	// bottom of box
    _zmin
    {
        type            zeroGradient;
    }
	// inlet
    _xmax
    {        
		type            uniformFixedValue;
		value			$internalField;
        uniformValue    
		{
			value		(#neg $Uref 0 0);
			type 		scale;
			scale
			{
				type	quarterSineRamp;
				start	0;
				duration $duration; //#calc	"400*$deltaT";
			}
		}
	}
}


// ************************************************************************* //
Is this your original U file or modified U file to protect your BCs. What did you add to this original U file i don't understand.
seyfigirgin is offline   Reply With Quote

Old   September 29, 2022, 14:25
Default
  #6
Senior Member
 
Sita Drost
Join Date: Mar 2009
Location: Arnhem, The Netherlands
Posts: 227
Rep Power: 18
sita is on a distinguished road
Usually you start by saying something like, hey, thanks for trying to help!

But anyway, this is the original 0/U file, with a working velocity ramping BC at _xmin. The code at the beginning, under // hull parts, contains regex to refer to different hull parts in the mesh file. As I mentioned earlier, I changed jobs in the meantime, so I don't exactly remember all the details of this, and can't test if the file still works under the current version of OpenFOAM. Hope this helps.



P.S. This 0/U file is not the one for the DTCHull tutorial case, but for a very similar ship simulation, hence the different names, but the velocity ramping BC at the domain inlet (called _xmin here) is the same.

Last edited by sita; September 30, 2022 at 05:19.
sita is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cyclic boundary condition in foam-extend 4.0 rellumeister OpenFOAM Pre-Processing 2 March 3, 2020 08:03
Constant mass flow rate boundary condition sahm OpenFOAM 0 June 20, 2018 22:45
Changing Boundary Condition Types via Scheme/UDF RTN3000 Fluent UDF and Scheme Programming 6 November 3, 2015 16:28
External Radiation Boundary Condition for Grid Interface CFD XUE FLUENT 0 July 9, 2010 02:53
External Radiation Boundary Condition (Two sided wall), Grid Interface CFD XUE FLUENT 0 July 8, 2010 06:49


All times are GMT -4. The time now is 17:13.