|
[Sponsors] |
Force sampling at adjustableRunTime instead of TimeStep |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 5, 2019, 07:03 |
Force sampling at adjustableRunTime instead of TimeStep
|
#1 |
New Member
Jorge Molines
Join Date: Oct 2012
Posts: 11
Rep Power: 13 |
Hello!
I am using OF 1812 with Ubuntu 18.04 and it works perfectly. However, I am trying to measure forces on a patch with a writeInterval equals to 0.05 seconds but the output of the force register is given for each TimeStep. How could I fix it? Below I attach the code of my ControlDict. Code:
/*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.3 | | \\ / A nd | Web: http://www.openfoam.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; location "system"; class dictionary; object controlDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // application interFoam; startFrom latestTime; startTime 0; stopAt endTime; endTime 20; deltaT 0.001; writeControl adjustableRunTime; writeInterval 0.1; purgeWrite 0; writeFormat ascii; writePrecision 6; writeCompression on; timeFormat general; timePrecision 6; runTimeModifiable yes; adjustTimeStep yes; maxCo 0.45; maxAlphaCo 0.45; maxDeltaT 0.05; libs ( "libOpenFOAM.so" ); functions { // Forces on crown wall forceProbeHor { type forces; libs ( "libforces.so" ); writeFields no; writeControl adjustableRunTime; writeInterval 0.05; patches ( Espaldonfrontal ); log false; CofR (18.45 0.02 0.80); // center of rotation // rhoInf 1000; }; forceProbeVer { type forces; libs ( "libforces.so" ); writeFields no; writeControl adjustableRunTime; writeInterval 0.05; patches ( Espaldonbase ); log false; CofR (18.45 0.02 0.80); // center of rotation // rhoInf 1000; }; } |
|
March 8, 2019, 01:18 |
There is no way
|
#2 |
New Member
Join Date: Mar 2016
Posts: 8
Rep Power: 10 |
Hello jormollo:
I do not think that you can order OpenFOAM to just write the postprocessing data each 0.05 seconds in a "de-coupled way" of your timestep. I think that your best alternative is to create a script to read the data and postprocess on your own. Interpolation should do. There are many alternatives, but you can just load the file to a pandas database in python launching the next script from the case folder: HTML Code:
import pandas as pd import numpy as np from pathlib import Path #Get all the forces files. thisCase=Path('.') allForcesFiles=[x for x in thisCase.glob('**/*forces.dat')] allForcesAsDataframes=[] header=['Time', 'Force pressure x','Force pressure y','Force pressure z', 'Force viscous x','Force viscous y','Force viscous z','Force porous x','Force porous y','Force porous z', 'Torque pressure x','Torque pressure y','Torque pressure z', 'Torque viscous x','Torque viscous y','Torque viscous z','Torque porous x','Torque porous y','Torque porous z'] #If there is more than one forces file the addressing of forces files and their names is in allForcesFiles. for file in allForcesFiles: toDrop=[] thisDatabase=pd.read_csv(file, header=None, skiprows=range(3), delimiter="\s+|\(+|\)+",engine='python') for column in thisDatabase: if thisDatabase[column].isnull().values.any(): toDrop.append(column) thisDatabase=thisDatabase.drop(toDrop,axis=1) thisDatabase.columns=header allForcesAsDataframes.append(thisDatabase) Postprocessing aftwerards should be straightforward. Last edited by Eldrael; March 8, 2019 at 01:27. Reason: Added where the script should be launched |
|
March 11, 2019, 02:45 |
There is no way
|
#3 | |
New Member
Jorge Molines
Join Date: Oct 2012
Posts: 11
Rep Power: 13 |
Quote:
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ActuatorDiskExplicitForce in OF2.1. Help | be_inspired | OpenFOAM Programming & Development | 10 | September 14, 2018 11:12 |
timestep variable - fixed sampling interval | vut | OpenFOAM Post-Processing | 0 | December 15, 2014 08:16 |
Force fluent to hold only last timestep | ansys_matt | FLUENT | 3 | August 24, 2014 22:07 |
Force coefficient oscillations for small timestep | Bollonga | FLUENT | 0 | November 8, 2013 13:53 |
Force can not converge | colopolo | CFX | 13 | October 4, 2011 22:03 |