How to use a SuperIdentity3D pointer to pass between two time step
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › How to use a SuperIdentity3D pointer to pass between two time step
- This topic has 9 replies, 2 voices, and was last updated 7 years, 2 months ago by steed188.
-
AuthorPosts
-
June 10, 2017 at 10:06 am #1918steed188Participant
Hi guys,
I wonder that how to use a SuperIdentity Pointer to pass a SuperIdentity value from last collision step time to this.
For example;
SuperIdentity3D <T,T> * superValue; //define a global pointer ;main(…){
for ( int iT = 0; iT <= converter.numTimeSteps( maxT ); ++iT ) {if(iT==0){
AnalyticalConst3D<T,T> coe1( T( 2. ),T( 2. ),T( 2. ));
SuperLatticeFfromAnalyticalF3D<T,DESCRIPTOR> coeffi1 ( coe1, sLattice );
superValue= new SuperIdentity3D <T,T>( coeffi1 )
}If (iT>0 && iT < middleT) {
AnalyticalConst3D<T,T> coe2( T( .5 ),T( .5 ),T( .5 ));
SuperLatticeFfromAnalyticalF3D<T,DESCRIPTOR> coeffi2 ( coe2, sLattice );
superValue = new SuperIdentity3D <T,T> ( (*superValue) * coeffi2 );
}
}
It can be compiled and run, but the result is wrong.
When iT=0, the superValue can be assigned as ( T( 2. ),T( 2. ),T( 2. )),
But when iT=1, the superValue can not get the last time step’s value, resulting that this time step’s result wrong.Did I misuse the SuperIdentity as a pointer?
With best wishes.
Steed188June 12, 2017 at 4:58 pm #2640mathiasKeymasterDear Steed188,
to store data you need to use a superData or superDataF class!
Best
MathiasJune 19, 2017 at 3:55 pm #2645steed188ParticipantDear mathias,
Thank you for your reply.
Would you mind applying some examples that showing how to use superData class to store data?
Thank you very much。steed188
June 19, 2017 at 4:33 pm #2646mathiasKeymasterDear steed188,
it is quite simple, just use the constructor
SuperData3D(SuperF3D<T,BaseType>& rhs);
Please, also use the dogygen docu if you need to know interfaces.By the way, registration for our spring school in 2018 is open!
Best
MathiasJune 20, 2017 at 7:41 am #2647steed188ParticipantDear mathias,
Yeah, I’ve tried SuperData3D. But it seems I did wrong.
For example, I defined a SuperData3D named “Store_VecData” in the main function, then assume that we accumulate the velocity to it every step and then write it to VTK files.
I did it like below.Code:void main(){
….
//define a SuperData
SuperData3D<T,T> Store_VecData ( cuboidGeometry, loadBalancer, 2, 3 );
….
getResults(…,Store_VecData,…)
}void getResults(…,SuperData3D<T,T>& Store_VecData,…){
SuperLatticePhysVelocity3D<T,DESCRIPTOR>velocity_lattice( sLattice, converter );
SuperIdentity3D<double,double> phyVelocity(velocity_lattice);// if iT is 1 then assign the initial value to Store_VecData;
if (iT == 1 ){
SuperData3D <T,T> temp_Data (phyVelocity);
Store_VecData = temp_Data;
}//Othewise I want extract SuperF from SuperData and add
// this time ‘s value, store it to SuperData again.
if (iT > 1){
SuperDataF3D <T,T> last_Data ( Store_VecData );
SuperData3D <T,T> this_Data ( last_Data + phyVelocity );
Store_VecData = this_Data;
}//write SuperData to VTKfiles
SuperDataF3D <T,T> toVTK ( Store_VecData );
vtmWriterTS.write( toVTK ,iT );
}Well. I didn’t work. Always Segmentation fault. 😀
Would you like point out the fault?By the way, thank you for noticing that the spring school. I’ll discuss it with my prof.
steed188.
July 6, 2017 at 7:55 am #2650mathiasKeymasterDear steed188,
your solotion is not the best in terms of efficiency but I do not see why it should not work. If you find out the problem, please let us know.
Best
MathiasJuly 11, 2017 at 5:35 pm #2653steed188ParticipantDear mathias,
Sorry for so late.
Do you mean that my code is correct with the usage of SuperData3D and SuperDataF3D though it was not efficiency?
That is weird that it didnt work.Would you like to share some idea for more efficiency terms?
your best
steed188July 11, 2017 at 5:37 pm #2655mathiasKeymasterCome to the spring school next year and we will have some time to go through that.
July 11, 2017 at 5:47 pm #2657steed188ParticipantYeah. I wish i will get my professor’s permission for that. smile:)
August 5, 2017 at 3:10 pm #2685steed188ParticipantI maybe found the problem.
It seems that the SuperData3d can store data correctly. And I could catch cell data after I convert it into SuperDataF3D. But if I used vtmWriter.addFunctor to write the SuperDataF3D it went wrong.Is wright to write SuperDataF3D to vtk files? Or should I convert it to other functors?
with best wishes,
steed188 -
AuthorPosts
- You must be logged in to reply to this topic.