
[Sponsors] 
March 17, 2015, 13:33 
double derivative with respect to time

#1 
Member
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 10 
Hye i am new user of openFoam i need to calculate double derivative with respect to time of a scalar.
i have a scalar CoMx i tried to find its double derivative by scalar DDTCoMx = d2dt2(CoMx); but i got error error: ‘d2dt2’ was not declared in this scope scalar DDTCoMx = d2dt2(CoMx); please help me... is there any need to add some header file explaining d2dt2???? if yes then where this header file lies and how to add it in make/options??? 

March 18, 2015, 09:00 

#2 
Member
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 13 
hi
the d2dt2 is defined within fvm, fvc,.........etc. to call it you should write fvc::d2dt2(CoMx) if you want to calculate ( which i think is your case) fvm:d2dt2(CoMx) in case you want to generate the coefficient matrix to solve an equation try this and tell me if it works or not. 

March 18, 2015, 11:22 

#3 
Member
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 10 
There is still an error sir
myInterFoamDDT.C: In function ‘int main(int, char**)’: myInterFoamDDT.C:121:34: error: no matching function for call to ‘d2dt2(Foam::scalar&)’ scalar DDTCoMx = fvc::d2dt2 (CoMx); myInterFoamDDT.C:121:34: note: candidates are: In file included from /opt/openfoam231/src/finiteVolume/lnInclude/fvcD2dt2.H:74:0, from /opt/openfoam231/src/finiteVolume/lnInclude/fvc.H:46, from /opt/openfoam231/src/finiteVolume/lnInclude/fvCFD.H:8, from myInterFoamDDT.C:40: /opt/openfoam231/src/finiteVolume/lnInclude/fvcD2dt2.C:44:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::d2dt2(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) d2dt2 /opt/openfoam231/src/finiteVolume/lnInclude/fvcD2dt2.C:44:1: note: template argument deduction/substitution failed: myInterFoamDDT.C:121:34: note: mismatched types ‘const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>’ and ‘Foam::scalar {aka double}’ scalar DDTCoMx = fvc::d2dt2 (CoMx); In file included from /opt/openfoam231/src/finiteVolume/lnInclude/fvcD2dt2.H:74:0, from /opt/openfoam231/src/finiteVolume/lnInclude/fvc.H:46, from /opt/openfoam231/src/finiteVolume/lnInclude/fvCFD.H:8, from myInterFoamDDT.C:40: /opt/openfoam231/src/finiteVolume/lnInclude/fvcD2dt2.C:59:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::d2dt2(const volScalarField&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) d2dt2 /opt/openfoam231/src/finiteVolume/lnInclude/fvcD2dt2.C:59:1: note: template argument deduction/substitution failed: myInterFoamDDT.C:121:34: note: cannot convert ‘CoMx’ (type ‘Foam::scalar {aka double}’) to type ‘const volScalarField& {aka const Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&}’ scalar DDTCoMx = fvc::d2dt2 (CoMx); myInterFoamDDT.C:121:8: warning: unused variable ‘DDTCoMx’ [Wunusedvariable] scalar DDTCoMx = fvc::d2dt2 (CoMx); In file included from myInterFoamDDT.C:61:0: /opt/openfoam231/src/finiteVolume/lnInclude/readTimeControls.H:38:8: warning: unused variable ‘maxDeltaT’ [Wunusedvariable] scalar maxDeltaT = 

March 18, 2015, 11:51 

#4 
Member
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 13 
is CoMx a volScalarField?
could you specify how you define CoMx The code is searching for a version of d2dt2 that matches the type of your CoMx ( I think) but couldn't find one. 

March 18, 2015, 12:06 

#5 
Member
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 10 
sir here is code i have got center of mass and indivisual components of center of mass i want to get its time derivatives
CoM = sum(rho*mesh.V()*mesh.C().dimensionedInternalField ())/sum(rho*mesh.V()); Info << "Center of Mass " << CoM.dimensions() << " = " << CoM << nl << endl; scalar CoMx = CoM.value().x(); Info << "Center of Mass x component = " << CoMx << nl << endl; scalar CoMy = CoM.value().y(); Info << "Center of Mass y component = " << CoMy << nl << endl; scalar CoMz = CoM.value().z(); Info << "Center of Mass z component = " << CoMz << nl << endl; and for time derivative i used scalar DDTCoMx = fvm::d2dt2 (CoMx); but got error 

March 18, 2015, 12:08 

#6 
Member
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 10 
i defined CoMx as scalar and got values but when i tried d2dt2 could not succeed


March 18, 2015, 12:18 

#7 
Member
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 13 
Could you explain your case a little bit more???
what is it you are trying to model here? 

March 18, 2015, 12:25 

#8 
Member
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 10 
i and just trying to calculate center of mass of fluid when fluid moves in damBreak tutorial and then find acceleration of center of mass. acceleration in x y and z direction.


March 18, 2015, 12:29 

#9 
Member
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 13 
well the function called d2dt2 is not appropriate in this case my dear friend.
This function is used to discretize and not to calculate derivatives. You should search for a utility that would do your task; i dont know if one exists or not. but what you can do is simply a=(VnewVold)/dt where V is done in the same manner 

March 18, 2015, 12:53 

#10 
Member
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 10 
ohhh sir it means i will have to apply some numerical method to calculate derivative????


Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
AMI speed performance  danny123  OpenFOAM  21  October 24, 2020 05:13 
Multiple floating objects  CKH  OpenFOAM Running, Solving & CFD  14  February 20, 2019 10:08 
[solidMechanics] solidMechanics gear contact in rotation  nlc  OpenFOAM CC Toolkits for FluidStructure Interaction  3  January 11, 2015 07:41 
Star cd esice solver error  ernarasimman  STARCD  2  September 12, 2014 01:01 
Missing math.h header  Travis  FLUENT  4  January 15, 2009 12:48 