October 28, 2020, 05:56
|
Initial and Boundary Conditions in the .C File
|
#1
|
New Member
Mohammad Khojastehmehr
Join Date: Jul 2020
Posts: 20
Rep Power: 6
|
Hey everybody  Hope you are doing great!
I wanted to write a program in which the initial and boundary conditions for the fields depend on some initial calculations.
At first, I thought it would be a good idea to write a C++ program that reads and edits the files in the 0 the folder; then I figured out it is not that easy; so I came to the conclusion that it might be best to try this method but I'm not quite sure yet:
I decided to define the fields in the main file. Is there any way to create a volVectorField or volScalarField in the .C file with defined boundary and initial condition? For example, I want to have something like this in my .C file:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 7
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object eps;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField nonuniform List<scalar>
10
(
0.154467036866835
0.162033854429180
0.135407628800740
0.165665945521539
0.150504310464983
0.163532375941872
0.134619297472226
0.163464960781439
0.147743669796071
0.146223849079981
);
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type zeroGradient;
}
fixedWalls
{
type zeroGradient;
}
}
// ************************************************************************* //
I would be very appreciative If someone could help me with this!
Mohammad
|
|
|