Changeset 9a2c8c for pcp/src/ions.c
- Timestamp:
- Apr 21, 2008, 2:19:25 PM (17 years ago)
- Children:
- 4782e78
- Parents:
- 8dd187
- git-author:
- Frederik Heber <heber@…> (04/18/08 16:16:38)
- git-committer:
- Frederik Heber <heber@…> (04/21/08 14:19:25)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pcp/src/ions.c
r8dd187 r9a2c8c 733 733 734 734 /** Shifts center of gravity of ion forces IonType::FIon. 735 * First sums up all forces of movable ions to a "force temperature",736 * then reduces each force by this temp , so that all in all735 * First sums up all forces of movable ions for net center of gravity force, 736 * then reduces each force by this temp over Ions#Max_TotalIons, so that all in all 737 737 * the net force is 0. 738 738 * \param *P Problem at hand 739 * \sa CorrectVelocity 740 * \note why is FTemp not divided by number of ions: is probably correct, but this 741 * function was not really meaningful from the beginning. 739 * \sa CorrectVelocity() 742 740 */ 743 741 void CorrectForces(struct Problem *P) … … 746 744 double *FIon; 747 745 double FTemp[NDIM]; 748 int is, ia, d ;746 int is, ia, d, NumIons = 0; 749 747 for (d=0; d<NDIM; d++) 750 FTemp[d] = 0 ;748 FTemp[d] = 0.; 751 749 for (is=0; is < I->Max_Types; is++) { // calculate force temperature for each type ... 752 750 for (ia=0; ia < I->I[is].Max_IonsOfType; ia++) { // .. and each ion of this type ... 753 751 FIon = &I->I[is].FIon[NDIM*ia]; 754 if (I->I[is].IMT[ia] == MoveIon) { // .. if it's movable 752 if (I->I[is].IMT[ia] == MoveIon) { // .. if it's influenced 753 NumIons++; 755 754 for (d=0; d<NDIM; d++) 756 755 FTemp[d] += FIon[d]; … … 758 757 } 759 758 } 759 //if (P->Files.MeOutMes != 1) return; 760 // fprintf(stderr, "TotalForce before: %e\t %e\t %e\n", FTemp[0], FTemp[1], FTemp[2]); 760 761 for (is=0; is < I->Max_Types; is++) { // and then reduce each by this value 761 762 for (ia=0; ia < I->I[is].Max_IonsOfType; ia++) { … … 763 764 if (I->I[is].IMT[ia] == MoveIon) { 764 765 for (d=0; d<NDIM; d++) 765 FIon[d] -= FTemp[d]; // (?) why not -= FTemp[d]/I->Max_TotalIons 766 } 767 } 768 } 766 FIon[d] -= FTemp[d]/NumIons; 767 } 768 } 769 } 770 /* for (d=0; d<NDIM; d++) 771 FTemp[d] = 0.; 772 for (is=0; is < I->Max_Types; is++) { // calculate force temperature for each type ... 773 for (ia=0; ia < I->I[is].Max_IonsOfType; ia++) { // .. and each ion of this type ... 774 FIon = &I->I[is].FIon[NDIM*ia]; 775 if (I->I[is].IMT[ia] == MoveIon) { // .. if it's influenced 776 for (d=0; d<NDIM; d++) 777 FTemp[d] += FIon[d]; 778 } 779 } 780 } 781 if (P->Files.MeOutMes != 1) return; 782 fprintf(stderr, "TotalForce after: %e\t %e\t %e\n", FTemp[0], FTemp[1], FTemp[2]); 783 */ 769 784 } 770 785
Note:
See TracChangeset
for help on using the changeset viewer.