CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swak4Foam] how to add an inlet expression using groovyc (https://www.cfd-online.com/Forums/openfoam-community-contributions/192050-how-add-inlet-expression-using-groovyc.html)

m5m5kh August 27, 2017 02:04

how to add an inlet expression using groovyc
 
1 Attachment(s)
Attachment 58006Dear Foamers

I installed swak4foam but I have no idea how to insert my sinusoidal inlet velocity to my inlet boundary in my U file at0 folder.
my velocity profile is
u (y,t)= u(y,t)=2U(1-(y/D)**2)(1+0.2*sin(t))
my geometry is something like the attached file.

Any help is greatly appreciated.
BR,
Mohsen

nimasam August 27, 2017 15:07

it is so easy with groovyBC,
it should be something like this:

Code:

type    groovyBC;
variables  "Uinlet=1;D=1;"
valueExpression "vector(2*Uinlet*(1-pow(pos().y/D,2))*(1+0.2*sin(time())))"

warning: i did not check.

m5m5kh August 28, 2017 14:02

3 Attachment(s)
Dear Nima
Thanks for your help.I do as you said for another case and geometry but something weired happened after using icoFoam.
I attached my case file and I would be grateful if you update me with my mistakes.

Kind Regards,
Mohsen

m5m5kh August 29, 2017 01:51

mohsen@mohsen-SVE14122CVW:~/Desktop/dilate100p$ icoFoam
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 4.1
Exec : icoFoam
Date : Aug 29 2017
Time : 18:00:02
Host : "mohsen-SVE14122CVW"
PID : 20522
Case : /home/mohsen/Desktop/dilate100p
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


PISO: Operating solver in PISO mode

Reading transportProperties

Reading field p

Reading field U



--> FOAM FATAL IO ERROR:
Unknown patchField type groovyBC for patch type patch

Valid patchField types are :

76
(
SRFFreestreamVelocity
SRFVelocity
SRFWallVelocity
activeBaffleVelocity
activePressureForceBaffleVelocity
advective
calculated
codedFixedValue
codedMixed
cyclic
cyclicACMI
cyclicAMI
cyclicSlip
cylindricalInletVelocity
directionMixed
empty
externalCoupled
extrapolatedCalculated
fixedGradient
fixedInternalValue
fixedJump
fixedJumpAMI
fixedMean
fixedNormalInletOutletVelocity
fixedNormalSlip
fixedProfile
fixedValue
flowRateInletVelocity
fluxCorrectedVelocity
freestream
inletOutlet
interstitialInletVelocity
mapped
mappedField
mappedFixedInternalValue
mappedFixedPushedInternalValue
mappedFlowRate
mappedVelocityFlux
mixed
movingWallVelocity
noSlip
nonuniformTransformCyclic
outletInlet
outletMappedUniformInlet
outletPhaseMeanVelocity
partialSlip
pressureDirectedInletOutletVelocity
pressureDirectedInletVelocity
pressureInletOutletParSlipVelocity
pressureInletOutletVelocity
pressureInletUniformVelocity
pressureInletVelocity
pressureNormalInletOutletVelocity
processor
processorCyclic
rotatingPressureInletOutletVelocity
rotatingWallVelocity
sliced
slip
supersonicFreestream
surfaceNormalFixedValue
swirlFlowRateInletVelocity
symmetry
symmetryPlane
timeVaryingMappedFixedValue
translatingWallVelocity
turbulentInlet
uniformFixedGradient
uniformFixedValue
uniformInletOutlet
uniformJump
uniformJumpAMI
variableHeightFlowRateInletVelocity
waveTransmissive
wedge
zeroGradient
)


file: /home/mohsen/Desktop/dilate100p/0/U.boundaryField.inlet from line 30 to line 37.

From function static Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with Type = Foam::Vector<double>]
in file /home/ubuntu/OpenFOAM/OpenFOAM-4.1/src/finiteVolume/lnInclude/fvPatchFieldNew.C at line 134.

FOAM exiting

My OpenFOAM version is 4.1

m5m5kh August 30, 2017 03:08

1 Attachment(s)
I reinstalled groovyBC again and changed my valueExpression and the problem seems to be solved.
--------------------------------------------------------------------------------------------------
inlet
{
type groovyBC;
variables "Uinlet=0.3;D=1;u=6*Uinlet*(pos().y/D)*(1-(pos().y))*(1+(0.1*sin(time())));";
valueExpression "vector(u,0,0)";
}
---------------------------------------------------------------------------------------------------
but there is a problem while the flow enters the domain from upper corner of inlet.however it should enters the domain from the middle of channel.
see the enclosed picture.
How can I correct this?

m5m5kh September 2, 2017 02:06

I missed a parameter in my velocity and it was solved . :)

saddy September 2, 2017 13:32

what exactly did u miss?
could you please share your case setup??
so that we can run and see the results

m5m5kh September 3, 2017 07:41

Sure, I will.:)
Please send your email

Kind regards.

Banbor May 17, 2021 10:44

thankyou

banbor2018@hotmail.com


All times are GMT -4. The time now is 18:03.