00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 char tslice_dirac_max_solve_C[] = "$Header: /cvsroot/Lorene/C++/Source/Time_slice/tslice_dirac_max_solve.C,v 1.16 2010/10/20 07:58:10 j_novak Exp $" ;
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 #include <assert.h>
00100
00101
00102 #include "time_slice.h"
00103 #include "unites.h"
00104 #include "graphique.h"
00105 #include "proto.h"
00106
00107
00108
00109
00110
00111 Scalar Tslice_dirac_max::solve_npsi(const Scalar* p_ener_dens,
00112 const Scalar* p_trace_stress) const {
00113
00114 using namespace Unites ;
00115
00116 const Map& map = npsi().get_mp() ;
00117 Scalar ener_dens(map) ;
00118 if (p_ener_dens != 0x0) ener_dens = *(p_ener_dens) ;
00119 else ener_dens.set_etat_zero() ;
00120
00121 Scalar trace_stress(map) ;
00122 if (p_trace_stress != 0x0) trace_stress = *(p_trace_stress) ;
00123 else trace_stress.set_etat_zero() ;
00124
00125
00126
00127
00128 const Vector& dnpsi = npsi().derive_cov(ff) ;
00129 const Tensor_sym& dhh = hh().derive_cov(ff) ;
00130 const Tensor_sym& dtgam = tgam().cov().derive_cov(ff) ;
00131
00132 Sym_tensor taa = aa().up_down(tgam()) ;
00133
00134 Scalar aa_quad = contract(taa, 0, 1, aa(), 0, 1) ;
00135 Scalar tildeR = 0.25 * contract( dhh, 0, 1, dtgam, 0, 1 ).trace(tgam())
00136 - 0.5 * contract( dhh, 0, 1, dtgam, 0, 2 ).trace(tgam()) ;
00137
00138 Scalar source_npsi = - contract( hh(), 0, 1, dnpsi.derive_cov(ff), 0, 1 ) ;
00139 source_npsi.inc_dzpuis() ;
00140 source_npsi += npsi()*( 0.5*qpig*(ener_dens + 2.*trace_stress )/( psi()*psi() )
00141 + 0.875*aa_quad/( psi4()*psi4() ) + 0.125*tildeR ) ;
00142
00143
00144
00145
00146 Scalar npsi_new = source_npsi.poisson() + 1. ;
00147
00148 if (npsi_new.get_etat() == ETATUN) npsi_new.std_spectral_base() ;
00149
00150 #ifndef NDEBUG
00151
00152 maxabs(npsi_new.laplacian() - source_npsi,
00153 "Absolute error in the resolution of the equation for N") ;
00154 #endif
00155 return npsi_new ;
00156
00157 }
00158
00159
00160
00161
00162
00163
00164
00165 Scalar Tslice_dirac_max::solve_psi(const Scalar* p_ener_dens) const {
00166
00167 using namespace Unites ;
00168
00169 const Map& map = psi().get_mp() ;
00170 Scalar ener_dens(map) ;
00171 if (p_ener_dens != 0x0) ener_dens = *(p_ener_dens) ;
00172 else ener_dens.set_etat_zero() ;
00173
00174
00175
00176
00177 const Vector& dpsi = psi().derive_cov(ff) ;
00178 const Tensor_sym& dhh = hh().derive_cov(ff) ;
00179 const Tensor_sym& dtgam = tgam().cov().derive_cov(ff) ;
00180
00181
00182 Sym_tensor taa = hata().up_down(tgam()) ;
00183
00184 Scalar aa_quad = contract(taa, 0, 1, hata(), 0, 1) ;
00185
00186 Scalar tildeR = 0.25 * contract( dhh, 0, 1, dtgam, 0, 1 ).trace(tgam())
00187 - 0.5 * contract( dhh, 0, 1, dtgam, 0, 2 ).trace(tgam()) ;
00188
00189 Scalar source_psi = -contract( hh(), 0, 1, dpsi.derive_cov(ff), 0, 1 ) ;
00190 source_psi.inc_dzpuis() ;
00191 source_psi -= 0.5*qpig*ener_dens/psi()
00192 + 0.125*( aa_quad*pow(psi(), -7) - tildeR*psi() ) ;
00193
00194
00195
00196
00197 Scalar psi_new = source_psi.poisson() + 1. ;
00198
00199 if (psi_new.get_etat() == ETATUN) psi_new.std_spectral_base() ;
00200
00201 #ifndef NDEBUG
00202
00203 maxabs(psi_new.laplacian() - source_psi,
00204 "Absolute error in the resolution of the equation for Psi") ;
00205 #endif
00206
00207 return psi_new ;
00208 }
00209
00210
00211
00212
00213
00214
00215
00216
00217 Vector Tslice_dirac_max::solve_beta(int method)
00218 const {
00219
00220
00221
00222 Vector source_beta =
00223 - contract(hh(), 0, 1, beta().derive_cov(ff).derive_cov(ff), 1, 2)
00224 - 0.3333333333333333*contract(hh(), 1, beta().divergence(ff).derive_cov(ff), 0) ;
00225
00226 Sym_tensor sym_tmp = 2*nn()*aa() ;
00227 source_beta += sym_tmp.divergence(ff) ;
00228 source_beta.inc_dzpuis() ;
00229
00230
00231
00232
00233 Vector beta_new = source_beta.poisson(0.3333333333333333, ff, method) ;
00234
00235 #ifndef NDEBUG
00236
00237 Vector test_beta = (beta_new.derive_con(ff)).divergence(ff)
00238 + 0.3333333333333333 * (beta_new.divergence(ff)).derive_con(ff) ;
00239 test_beta.inc_dzpuis() ;
00240 maxabs(test_beta - source_beta,
00241 "Absolute error in the resolution of the equation for beta") ;
00242 #endif
00243 return beta_new ;
00244
00245 }
00246
00247