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

Make diskdir time independant

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 24, 2023, 05:07
Question Make diskdir time independant
  #1
New Member
 
Riboulet Baptiste
Join Date: May 2023
Location: Rennes
Posts: 1
Rep Power: 0
baptrib is on a distinguished road
Hello Foamers,

I am using a dynamic mesh to move the actuator disk (AD) in a domain around an axis of rotation. However, when the AD is moving, the normal vector (diskdir defined in actuationDisksource in fvModels) always points in the x direction. So i am trying to make the normal vector from actuationdisk time dependant so that the kinetic energy is transferred normally to the AD even when moving, as follows :
diskdir = =(-cos(teta),-sin(teta),0) with teta = time * rotation_speed_mesh
Please find attached an image illustrating the problem.

I have modified and recompiled with wmake from fvModels and finiteVolume directory the code actuationDisksource.C, fvModels.C and fvModel.C as follows :

At the end of the file depactuationDisksource.C (the modified one) :
Code:
void Foam::fv::actuationDiskSource::updateDiskDir(vector& newDiskDir)
{
	Info << "New diskDir:" << newDiskDir<< " " << "Old diskDir:" << diskDir_<< endl;
	diskDir_ = newDiskDir;
}
In actuationdDiskSource.H :
Code:
virtual void updateDiskDir(vector& newDiskDir);
In fvModels.C :
Code:
void Foam::fvModels::updateDiskDir(vector& newDiskDir)
{
    PtrListDictionary<fvModel>& modelList(*this);

    forAll(modelList, i)
    {
        modelList[i].updateDiskDir(newDiskDir);
    }
}
In fvModel.C :
Code:
void Foam::fvModel::updateDiskDir(vector& newDiskDir)
{}
And adding to fvModel.H and fvModels.H :
Code:
virtual void updateDiskDir(vector& newDiskDir);
Then adding to the pimpleFoam solver in the code deppimpleFoam.C :
Code:
    const scalar omega = 10.0; // before time loop
    scalar t = 0.0; // before time loop
    scalar theta = 0.0; // before time loop
Code:
        t = runTime.value(); // in time loop
        theta = t*omega; //in time loop
And adding to UEqn.H :
Code:
vector newDiskDir(-Foam::cos(theta),-Foam::sin(theta),0);
fvModels.updateDiskDir(newDiskDir);
With this method, the fvModels is reupdated each step time depending on the rotation speed of the actuator disk.
When I am using the modified solver, I have this error :
Code:
Selecting finite volume model type depactuationDiskSource
#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigSegv::sigHandler(int) at ??:?
#2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3  Foam::fvModel::New(Foam::word const&, Foam::dictionary const&, Foam::fvMesh const&) at ??:?
#4  Foam::fvModels::fvModels(Foam::fvMesh const&) at ??:?
#5  ? in "/home/briboulet/OpenFOAM/briboulet-10/platforms/linux64GccDPInt32Opt/bin/deppimpleFoam"
#6  ? in "/home/briboulet/OpenFOAM/briboulet-10/platforms/linux64GccDPInt32Opt/bin/deppimpleFoam"
#7  ? in "/lib/x86_64-linux-gnu/libc.so.6"
#8  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#9  ? in "/home/briboulet/OpenFOAM/briboulet-10/platforms/linux64GccDPInt32Opt/bin/deppimpleFoam"
Erreur de segmentation (core dumped)
I have tried many things but nothing succeeded. It seems to be a problem of definition of the function updateDiskDir in fvModels since error appears just after the line "Selecting finite volume...". It could also be linked to the initialisation of the pointer.
I was also wondering about the validity of compiling the different files but I have recompiled everything from finiteVolume and fvModels including the modification of files .C. The solver recognise the function updatediskdir so I think the compile part is ok. I will also try to compile in debug mode.

Please help me going through this problem, I am not at ease with the C++ syntax from openfoam and the problem should come from what I've written. There are maybe other ways to do this so feel free to suggest other solutions (codedSource ? adding the parameter time in the actuation disk function ?)
Thanks in advance
Attached Files
File Type: pdf problem.pdf (188.2 KB, 4 views)
baptrib is offline   Reply With Quote

Old   June 6, 2023, 06:14
Default
  #2
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 17
hk318i is on a distinguished road
I think an easy way would be changing the time of ``diskDir_`` from ``vector`` to ``function1<vector>`` since it is function of time. Here is an example;

https://github.com/OpenFOAM/OpenFOAM...onSource.H#L89

``function1`` will allow you to have few options as input which would make your code more general.
__________________
@HIKassem | HassanKassem.me
hk318i is offline   Reply With Quote

Reply

Tags
actuatordisk, compilation, diskdir, segmentation error, syntax error


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
somaFoam - And plasma goes weee Destouches OpenFOAM Running, Solving & CFD 9 March 14, 2024 18:40
laplacianFoam with source term Herwig OpenFOAM Running, Solving & CFD 17 November 19, 2019 13:47
Extrusion with OpenFoam problem No. Iterations 0 Lord Kelvin OpenFOAM Running, Solving & CFD 8 March 28, 2016 11:08
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
dynamic Mesh is faster than MRF???? sharonyue OpenFOAM Running, Solving & CFD 14 August 26, 2013 07:47


All times are GMT -4. The time now is 16:56.