|
[Sponsors] |
Add source term to KEpsilon model in given location |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 24, 2021, 11:37 |
Add source term to KEpsilon model in given location
|
#1 |
Member
Kabir Shariff
Join Date: Oct 2016
Location: France
Posts: 53
Rep Power: 10 |
Hello foamers,
I am simulating tidal turbine using actuator disc concept in OpenFOAM v2006. I want to add a source term of turbulence production term around the disc region only. How can I specify the location where the source term is added??? Thanks |
|
February 24, 2021, 15:15 |
|
#2 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 |
You can use a codedfvOption an include the source term in the k equation. Take a look at the actuator disk model how to specify the locations https://develop.openfoam.com/Develop...tionDiskSource
Best Michael |
|
March 8, 2021, 04:27 |
|
#3 | |
Member
Kabir Shariff
Join Date: Oct 2016
Location: France
Posts: 53
Rep Power: 10 |
Quote:
Hello Michael, I use the coded fvoptions as suggested and I got this error. First of all, I had to compile the coded fv options ( I am using a cluster server v2006) below is my fv options file. I am interested in adding the following term (see attachment please) Code:
codedSource { type scalarCodedSource; selectionMode cellSet; cellSet sourceDisk1; fields (epsilon); name codedSource; codeAddSup #{ const Time& time = mesh().time(); const scalarField& V = mesh_.V(); const scalarField& rh = 1000; const scalarField& eps = 0.06287; const scalarField& kk = 1.215; const scalarField& Cm2 = 0.09; const scalarField & epsilonSource = eqn.source(); forAll(C,i) { epsilonSource[i] += rh*Cm2*pow(eps,2)/kk*V[i]; } Pout << "***codeAddSup***" << endl; #}; codeCorrect #{ #}; codeConstrain #{ #}; sourceTimeCoeffs { // Dummy entry } } Code:
smoothSolver: Solving for Ux, Initial residual = 1, Final residual = 0.0496559290788, No Iterations 4 smoothSolver: Solving for Uy, Initial residual = 0.999999999508, Final residual = 0.0927538575586, No Iterations 3 smoothSolver: Solving for Uz, Initial residual = 0.999999999943, Final residual = 0.0388575837312, No Iterations 3 [125] swak4Foam: Allocating new repository for sampledGlobalVariables GAMG: Solving for p, Initial residual = 1, Final residual = 0.000945134305598, No Iterations 28 time step continuity errors : sum local = 4.29755393053e-06, global = -5.81621224202e-09, cumulative = -5.81621224202e-09 Using dynamicCode for fvOption::codedSource at line 52 in "/dlocal/run/8137670/constant/fvOptions.codedSource" Could not load "/dlocal/run/8137670/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodedSource_80756ad56d8baed425ef1007b62ccf592e79c6c3.so" /dlocal/run/8137670/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodedSource_80756ad56d8baed425ef1007b62ccf592e79c6c3.so: cannot open shared object file: No such file or directory ..... ..... Invoking wmake libso /dlocal/run/8137670/dynamicCode/codedSource wmake libso /dlocal/run/8137670/dynamicCode/codedSource ln: ./lnInclude dep: codedFvOptionTemplate.C Ctoo: codedFvOptionTemplate.C /dlocal/run/8137670/constant/fvOptions.codedSource: In member function ‘virtual void Foam::fv::codedSourceFvOptionscalarSource::addSup(Foam::fvMatrix<double>&, Foam::label)’: /dlocal/run/8137670/constant/fvOptions.codedSource:102:17: error: aggregate ‘std::ofstream file’ has incomplete type and cannot be defined /dlocal/run/8137670/constant/fvOptions.codedSource:103:33: error: incomplete type ‘std::ofstream {aka std::basic_ofstream<char>}’ used in nested name specifier /dlocal/run/8137670/constant/fvOptions.codedSource:103:54: error: incomplete type ‘std::ofstream {aka std::basic_ofstream<char>}’ used in nested name specifier /dlocal/run/8137670/constant/fvOptions.codedSource: In member function ‘virtual void Foam::fv::codedSourceFvOptionscalarSource::addSup(const volScalarField&, Foam::fvMatrix<double>&, Foam::label)’: /dlocal/run/8137670/constant/fvOptions.codedSource:102:17: error: aggregate ‘std::ofstream file’ has incomplete type and cannot be defined /dlocal/run/8137670/constant/fvOptions.codedSource:103:33: error: incomplete type ‘std::ofstream {aka std::basic_ofstream<char>}’ used in nested name specifier /dlocal/run/8137670/constant/fvOptions.codedSource:103:54: error: incomplete type ‘std::ofstream {aka std::basic_ofstream<char>}’ used in nested name specifier make: *** [Make/linux64GccDPInt32Opt/codedFvOptionTemplate.o] Error 1 [0] [0] [0] --> FOAM FATAL IO ERROR: [0] Failed wmake "dynamicCode/codedSource/platforms/linux64GccDPInt32Opt/lib/libcodedSource_80756ad56d8baed425ef1007b62ccf592e79c6c3.so" [0] [0] [0] file: /dlocal/run/8137670/constant/fvOptions.codedSource at line 52. [0] [0] From void Foam::codedBase::createLibrary(Foam::dynamicCode&, const Foam::dynamicCodeContext&) const [0] in file db/dynamicLibrary/codedBase/codedBase.C at line 237. [0] FOAM parallel run exiting [0] application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0 In: PMI_Abort(1, application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0) srun: Job step aborted: Waiting up to 32 seconds for job step to finish. slurmstepd: error: *** STEP 8137670.2 ON my253 CANCELLED AT 2021-03-08T09:09:52 *** srun: error: my261: tasks 112-139: Killed srun: Terminating job step 8137670.2 srun: error: my253: tasks 0-27: Killed srun: error: my254: tasks 28-55: Killed srun: error: my260: tasks 84-111: Killed srun: error: my259: tasks 56-83: Killed Thank you |
||
March 8, 2021, 04:58 |
|
#4 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 |
Seems a problem with the output. Can you comment the Pout line.
In the error the appear some line numbers. Which line number are this? |
|
March 8, 2021, 05:14 |
|
#5 | |
Member
Kabir Shariff
Join Date: Oct 2016
Location: France
Posts: 53
Rep Power: 10 |
Quote:
1./ I have commented the Pout line, but I still have the same problem 2/ The line numbers are for the parallel processors, I am running the simulation on cluster network. |
||
March 8, 2021, 05:20 |
|
#6 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 |
Code:
scalar rh = 1000; scalar eps = 0.06287; scalar kk = 1.215; scalar Cm2 = 0.09; you're assign scalarField to scalars ... but you treat it as scalar inside the for loop |
|
March 8, 2021, 06:42 |
|
#7 | |
Member
Kabir Shariff
Join Date: Oct 2016
Location: France
Posts: 53
Rep Power: 10 |
Quote:
I want to apply the source term to only cells defined in the cellset, not the entire domain I have specified the cellset using topoSet |
||
March 8, 2021, 07:39 |
|
#8 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 |
Code:
forAll(C,i) { epsilonSource[i] += rh*Cm2*pow(eps,2)/kk*V[i]; } you do not define the size either ... this may be your mistake |
|
March 8, 2021, 09:58 |
|
#9 | |
Member
Kabir Shariff
Join Date: Oct 2016
Location: France
Posts: 53
Rep Power: 10 |
Quote:
I found another method to apply scalar fields using the semi-implicit fvOptions below Code:
scalarSource { type scalarSemiImplicitSource; selectionMode cellSet; cellSet sourceDisk1; volumeMode absolute; injectionRateSuSp { k (30.7 0); epsilon (1.5 0); } } Code:
generalSource { type <type>SemiImplicitSource; ... volumeMode absolute; // absolute | specific injectionRateSuSp { <field> (<explicit value> <implicit coefficient>); ... } } |
||
March 8, 2021, 10:30 |
|
#10 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 |
No experience about your function objects. Is there no documentation
|
|
Tags |
actuationdisksource, kepsilonmodel |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM.com] swak4foam compiling issues on a cluster | saj216 | OpenFOAM Installation | 5 | January 17, 2023 17:05 |
How to add Source term (2) for PYROLYSIS - reactingOneDim | Kummi | OpenFOAM | 10 | April 12, 2021 22:11 |
Trouble compiling utilities using source-built OpenFOAM | Artur | OpenFOAM Programming & Development | 14 | October 29, 2013 11:59 |
friction forces icoFoam | ofslcm | OpenFOAM | 3 | April 7, 2012 11:57 |
DxFoam reader update | hjasak | OpenFOAM Post-Processing | 69 | April 24, 2008 02:24 |