CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

timeVaryingMappedFixedValue Boundary Condition

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Martin_Sz

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 21, 2024, 07:14
Default timeVaryingMappedFixedValue Boundary Condition
  #1
New Member
 
Charitha Rangana Dissanayaka
Join Date: Mar 2022
Posts: 6
Rep Power: 4
Charitha_Dissanayaka is on a distinguished road
Hello everyone,

Do anyone know how to use the timeVaryingMappedFixedValue boundary condition with the interFoam solver.
Please be kind enough to give me a solution for this.

following details are alpha.water, p_rgh, and U I used.

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

dimensions [0 0 0 0 0 0 0];

internalField uniform 0;

boundaryField
{
processor
{
type processor;
value $internalField;
}

/*
inlet
{
type timeVaryingMappedFixedValue;
offset 0;
setAverage false;
refValue uniform 0;
refGradient uniform 0;
value uniform 0;
mappedData
{
type points; // or 'surface' if you use a points file
setFormat raw;
fields (alpha.water);
filePattern "#time#/alpha.water"; // Adjust this if your file names are different
offset (0 0 0);
}
}
*/

inlet
{
type timeVaryingMappedFixedValue;
offset 0;
setAverage off;
//mapMethod nearestPatchFace;
//value uniform (0 0 0);
value uniform 1;
}

outlet
{
type zeroGradient;
value uniform 0;
}

bottomSurface
{
type zeroGradient;
}

pileSurface
{
type zeroGradient;
}

leftWall
{
type symmetry;
}
rightWall
{
type symmetry;
}

atmIn
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}

atmTop
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}
}

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


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

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

internalField uniform 0;

boundaryField
{
processor
{
type processor;
value $internalField;
}

inlet
{
// type fixedFluxPressure;
// value uniform 0;

type codedMixed;
refValue uniform 0;
refGradient uniform 0;
valueFraction uniform 0;
redirectType noreflect;

codeInclude
#{
#include "uniformDimensionedFields.H"
#};

code
#{
const scalar H = 0.333;

const uniformDimensionedVectorField& g =
db().lookupObject<uniformDimensionedVectorField>(" g");

const fvPatchField<scalar>& rho =
patch().lookupPatchField<volScalarField, scalar>("rho");

valueFraction() = 0.;
refGrad() = -rho.snGrad()*(g.value() & patch().Cf());

vector gn(g.value()/mag(g).value());

forAll(patch().Cf(), faceI)
{
scalar h(-gn & patch().Cf()[faceI]);

if(h > H)
{
valueFraction()[faceI] = 1.;
refValue()[faceI] = 0.;
}
}
#};
}

outlet
{
type fixedFluxPressure;
value uniform 0;
}

bottomSurface
{
type fixedFluxPressure;
value uniform 0;
}

pileSurface
{
type fixedFluxPressure;
value uniform 0;
}

leftWall
{
type symmetry;
}

rightWall
{
type symmetry;
}


atmIn
{
type totalPressure;
p0 uniform 0;
}

atmTop
{
type totalPressure;
p0 uniform 0;
}
}


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


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField uniform (0 0 0);

boundaryField
{
processor
{
type processor;
value $internalField;
}

inlet
{
//type advective;
//value uniform (0 0 0);
type timeVaryingMappedFixedValue;
offset (0 0 0);
setAverage off;
//mapMethod nearestPatchFace;
//value uniform (0 0 0);
}
/*
inlet
{
type waveVelocity;
value uniform (0 0 0);
}
*/

outlet
{
type inletOutlet;
inletValue uniform (0 0 0);
value $internalField;
}

leftWall
{
type symmetry;
}
rightWall
{
type symmetry;
}

bottomSurface
{
type noSlip;
}

pileSurface
{
type noSlip;
}

atmIn
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}

atmTop
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}
}

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

Last edited by Charitha_Dissanayaka; June 21, 2024 at 07:24. Reason: enter details
Charitha_Dissanayaka is offline   Reply With Quote

Old   June 21, 2024, 07:48
Default
  #2
Senior Member
 
Martin_Sz's Avatar
 
Marcin
Join Date: May 2014
Location: Poland, Swiebodzin
Posts: 313
Rep Power: 13
Martin_Sz is on a distinguished road
The timeVaryingMappedFixedValue boundary condition in OpenFOAM allows you to prescribe values that vary in time and space on a patch. Here's a breakdown of its usage with the interFoam solver:
Implementation:
* Patch Identification: Specify the patch where you want to apply the time-varying boundary condition in your fvPatchFiles dictionary within the controlDict file.
* Boundary Type: Set the type of boundary condition to "timeVaryingMappedFixedValue" for the identified patch.
* Data File: Provide the path to a data file containing the time-varying values in the value sub-dictionary of the boundary condition. This file should contain columns for time and the value you want to prescribe.
Data File Format:
The data file should be a text file with each line representing a time step. The format is:
time value1 value2 ...

* time: Represents the simulation time for the corresponding data.
* value1, value2, ...: The values to be applied at the patch, corresponding to the variables you're prescribing (e.g., pressure, velocity components).
Example:
Assuming you want to apply a time-varying pressure boundary condition on a patch named "inlet," here's a snippet from your controlDict file:
fvPatchFiles
{
inlet
{
type timeVaryingMappedFixedValue;
value
{
refValue 0;
table "inlet_pressure.dat";
}
}
}

Additional Notes:
* Ensure the data file format aligns with the number of variables you're prescribing.
* The refValue keyword specifies a reference value for scaling the data in the table.
* Refer to the OpenFOAM documentation for more details and advanced options on the timeVaryingMappedFixedValue boundary condition.
__________________
Quick Tips and Tricks, Tutorials FLuent/ CFX (CFD)
https://howtooansys.blogspot.com/
Martin_Sz is offline   Reply With Quote

Old   June 23, 2024, 21:04
Default
  #3
New Member
 
Charitha Rangana Dissanayaka
Join Date: Mar 2022
Posts: 6
Rep Power: 4
Charitha_Dissanayaka is on a distinguished road
Quote:
Originally Posted by Martin_Sz View Post
The timeVaryingMappedFixedValue boundary condition in OpenFOAM allows you to prescribe values that vary in time and space on a patch. Here's a breakdown of its usage with the interFoam solver:
Implementation:
* Patch Identification: Specify the patch where you want to apply the time-varying boundary condition in your fvPatchFiles dictionary within the controlDict file.
* Boundary Type: Set the type of boundary condition to "timeVaryingMappedFixedValue" for the identified patch.
* Data File: Provide the path to a data file containing the time-varying values in the value sub-dictionary of the boundary condition. This file should contain columns for time and the value you want to prescribe.
Data File Format:
The data file should be a text file with each line representing a time step. The format is:
time value1 value2 ...

* time: Represents the simulation time for the corresponding data.
* value1, value2, ...: The values to be applied at the patch, corresponding to the variables you're prescribing (e.g., pressure, velocity components).
Example:
Assuming you want to apply a time-varying pressure boundary condition on a patch named "inlet," here's a snippet from your controlDict file:
fvPatchFiles
{
inlet
{
type timeVaryingMappedFixedValue;
value
{
refValue 0;
table "inlet_pressure.dat";
}
}
}

Additional Notes:
* Ensure the data file format aligns with the number of variables you're prescribing.
* The refValue keyword specifies a reference value for scaling the data in the table.
* Refer to the OpenFOAM documentation for more details and advanced options on the timeVaryingMappedFixedValue boundary condition.
Hello Sir,

First of all I want to apologize from you for my late reply.
Thank you very much for your kind reply.
I will look at your suggestions and work for it.
Charitha_Dissanayaka is offline   Reply With Quote

Old   June 24, 2024, 22:33
Default To inform about the TimeVaryingMappedFixedValue BC induced case
  #4
New Member
 
Charitha Rangana Dissanayaka
Join Date: Mar 2022
Posts: 6
Rep Power: 4
Charitha_Dissanayaka is on a distinguished road
Hello sir @Martin_Sz,

according to your instructions, I did setup the case.
I used few python codes to prepare my input files.

I am using this TimeVaryingMappedFixedValue boundary condition for the CFD-DEM simulation (Which does not have wave attenuation).

Following is my simulation steps.
1. CFD simulation in OF1806 for the irregular wave
2. Extract data (wave height, alpha.water, U) at pre-defined sections.
3. Setup the CFD-DEM case for monopile erosion observation
4. TimeVaryingMappedFixedValue used boundary condition to input the observed data to the CFD-DEM simulation (Step 2 extracted data).

This is for your kind information please.

later I hope to upload all the case files, and python code files to the GitHub Repository for the learning purpose.
Charitha_Dissanayaka 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
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 08:38
Centrifugal fan j0hnny CFX 13 October 1, 2019 14:55
Accessing multiple boundary patches from a custom boundary condition file ripudaman OpenFOAM Programming & Development 0 October 22, 2014 19:34
Radiation interface hinca CFX 15 January 26, 2014 18:11
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 18:44


All times are GMT -4. The time now is 08:38.