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

double derivative with respect to time

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 17, 2015, 12:33
Default double derivative with respect to time
  #1
Member
 
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0
13msmemusman is on a distinguished road
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???
13msmemusman is offline   Reply With Quote

Old   March 18, 2015, 08:00
Default
  #2
Member
 
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 14
kebsiali is on a distinguished road
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.
kebsiali is offline   Reply With Quote

Old   March 18, 2015, 10:22
Post
  #3
Member
 
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0
13msmemusman is on a distinguished road
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’ [-Wunused-variable]
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’ [-Wunused-variable]
scalar maxDeltaT =
13msmemusman is offline   Reply With Quote

Old   March 18, 2015, 10:51
Default
  #4
Member
 
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 14
kebsiali is on a distinguished road
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.
kebsiali is offline   Reply With Quote

Old   March 18, 2015, 11:06
Default
  #5
Member
 
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0
13msmemusman is on a distinguished road
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
13msmemusman is offline   Reply With Quote

Old   March 18, 2015, 11:08
Default
  #6
Member
 
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0
13msmemusman is on a distinguished road
i defined CoMx as scalar and got values but when i tried d2dt2 could not succeed
13msmemusman is offline   Reply With Quote

Old   March 18, 2015, 11:18
Default
  #7
Member
 
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 14
kebsiali is on a distinguished road
Could you explain your case a little bit more???
what is it you are trying to model here?
kebsiali is offline   Reply With Quote

Old   March 18, 2015, 11:25
Post
  #8
Member
 
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0
13msmemusman is on a distinguished road
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.
13msmemusman is offline   Reply With Quote

Old   March 18, 2015, 11:29
Default
  #9
Member
 
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 14
kebsiali is on a distinguished road
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=(Vnew-Vold)/dt
where V is done in the same manner
kebsiali is offline   Reply With Quote

Old   March 18, 2015, 11:53
Post
  #10
Member
 
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0
13msmemusman is on a distinguished road
ohhh sir it means i will have to apply some numerical method to calculate derivative????
13msmemusman is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
AMI speed performance danny123 OpenFOAM 21 October 24, 2020 04:13
Multiple floating objects CKH OpenFOAM Running, Solving & CFD 14 February 20, 2019 09:08
[solidMechanics] solidMechanics gear contact in rotation nlc OpenFOAM CC Toolkits for Fluid-Structure Interaction 3 January 11, 2015 06:41
Star cd es-ice solver error ernarasimman STAR-CD 2 September 12, 2014 00:01
Missing math.h header Travis FLUENT 4 January 15, 2009 11:48


All times are GMT -4. The time now is 05:48.