|
[Sponsors] |
using codestream to initialize alpha domain with multiple ovals |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 1, 2022, 08:18 |
using codestream to initialize alpha domain with multiple ovals
|
#1 |
Member
Al
Join Date: May 2019
Posts: 37
Rep Power: 6 |
Hello
I am trying to use codestream to create several oval shapes in my alpha domains. These ovals are placed throughout the domain*at various x coordinates, each of which is determined by a for loop with j label, and here's my 0/alpha file. Code:
dimensions [0 0 0 0 0 0 0]; internalField #codeStream { codeInclude #{ #include "fvCFD.H" #}; codeOptions #{ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude #}; codeLibs #{ -lmeshTools \ -lfiniteVolume #}; code #{ const IOdictionary& d = static_cast<const IOdictionary&>(dict); const fvMesh& mesh = refCast<const fvMesh>(d.db()); scalarField alpha(mesh.nCells(), 0); for (label j=0; j <= 10; j++) { scalar lambda = 2.29922953e-3; scalar he = j*lambda; scalar ke = 0.5*lambda; scalar ae = 0.2*lambda; scalar be = 0.1*lambda; forAll(alpha, i) { const scalar x = mesh.C()[i][0]; const scalar y = mesh.C()[i][1]; if ( pow(y-ke,2) <= ((1 - pow(x-he,2)/pow(ae,2) )*pow(be,2)) ) { alpha[i] = 1; } } alpha.writeEntry("", os); } #} ; }; boundaryField { up { type inletOutlet; inletValue uniform 1; value uniform 0; } "wall.*" { type cyclic; } down { type fixedValue; value uniform 0; } frontAndBack { type empty; } } } What is the problem here and what I should do? Thank you! |
|
September 2, 2022, 02:57 |
|
#2 |
Member
Al
Join Date: May 2019
Posts: 37
Rep Power: 6 |
The problem with this codestream was the location of writeEntry. It should be right before #}.
So it will be like Code:
internalField #codeStream { codeInclude #{ #include "fvCFD.H" #}; codeOptions #{ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude #}; codeLibs #{ -lmeshTools \ -lfiniteVolume #}; code #{ const IOdictionary& d = static_cast<const IOdictionary&>(dict); const fvMesh& mesh = refCast<const fvMesh>(d.db()); scalarField alpha(mesh.nCells(), 0); for (label j=0; j <= 10; j++) { scalar lambda = 2.29922953e-3; scalar he = j*lambda; scalar ke = 0.5*lambda; scalar ae = 0.2*lambda; scalar be = 0.1*lambda; forAll(alpha, i) { const scalar x = mesh.C()[i][0]; const scalar y = mesh.C()[i][1]; if ( pow(y-ke,2) <= ((1 - pow(x-he,2)/pow(ae,2) )*pow(be,2)) ) { alpha[i] = 1; } } } alpha.writeEntry("", os); #} ; }; |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Domain size influence in unbounded domains model | Reoyo | Main CFD Forum | 10 | May 4, 2018 08:30 |
multiple fluid domain | Sumedh | CFX | 10 | December 14, 2016 16:36 |
alphaEqn.H in twoPhaseEulerFoam | cheng1988sjtu | OpenFOAM Bugs | 15 | May 1, 2016 16:12 |
OpenFOAM static build on Cray XT5 | asaijo | OpenFOAM Installation | 9 | April 6, 2011 12:21 |
CFX Solver Memory Error | mike | CFX | 1 | March 19, 2008 07:22 |