76 real *vt, moy, *vtr, Ntilde, Nround;
77 real invdt, dpinvns, vtemp;
81 vtr= VthetaRes->
Field;
84 #pragma omp parallel for private(j,l, moy, Ntilde, Nround, nitemp, vtemp)
85 for (i = 0; i < nr; i++) {
87 for (j = 0; j < ns; j++) {
93 Nround = floor(Ntilde+0.5);
94 nitemp = (long)Nround;
97 vtemp = (Ntilde-Nround)*
Rmed[i]*invdt*dpinvns;
98 for (j = 0; j < ns; j++) {
100 vtr[l] = vt[l]-
VMed[i];
104 for (j = 0; j < ns; j++) {
116 int i,j,ji,l,li,nr,ns;
121 #pragma omp parallel for private (j,ji,l,li) default(none) shared(nr,ns,Nshift, val, TempShift)
122 for (i = 0; i < nr; i++) {
123 for (j = 0; j < ns; j++) {
125 while (ji < 0) ji += ns;
126 while (ji >= ns) ji -= ns;
131 for (j = 0; j < ns; j++) {
181 real *rho, *lab, *extlab;
186 extlab= ExtLabel->Field;
187 #pragma omp parallel for private(j,l)
188 for (i = 0; i < nr; i++) {
189 for (j = 0; j < ns; j++) {
191 extlab[l] = rho[l]*lab[l];
201 real *rho, *lab, *extlab;
206 extlab= ExtLabel->Field;
207 #pragma omp parallel for private(j,l)
208 for (i = 0; i < nr; i++) {
209 for (j = 0; j < ns; j++) {
211 lab[l] = extlab[l]/rho[l];
236 int i,j,l,lq,lip,lim,nr,ns;
244 #pragma omp parallel for private (i,l,lq,lip,lim,dqm,dqp)
245 for (j = 0; j < ns; j++) {
246 for (i = 0; i < nr; i++) {
251 if ((i == 0) || (i == nr-1))
dq[lq] = 0.0;
256 dq[lq] = 2.0*dqp*dqm/(dqp+dqm);
261 for (i = 0; i < nr; i++) {
267 qs[l] = qb[lim]+(
Rmed[i]-
Rmed[i-1]-vr[l]*dt)*0.5*
dq[lq-1];
269 qs[l] = qb[l]-(
Rmed[i+1]-
Rmed[i]+vr[l]*dt)*0.5*
dq[lq];
271 qs[j] = qs[j+ns*nr] = 0.0;
279 int i,j,l,ljp,ljm,jm,nr,ns;
281 real dqp, dqm,dxtheta,ksi,invdxtheta;
287 #pragma omp parallel for private (dxtheta,invdxtheta,l,j,ljp,ljm,dqm,dqp,jm,ksi)
288 for (i = 0; i < nr; i++) {
290 invdxtheta = 1.0/dxtheta;
291 for (j = 0; j < ns; j++) {
295 if (j == 0) ljm = i*ns+ns-1;
296 if (j == ns-1) ljp = i*ns;
297 dqm = (qb[l]-qb[ljm]);
298 dqp = (qb[ljp]-qb[l]);
300 dq[l] = dqp*dqm/(dqp+dqm)*invdxtheta;
304 for (j = 0; j < ns; j++) {
307 if (j == 0) jm = ns-1;
311 qs[l] = qb[ljm]+(dxtheta-ksi)*
dq[ljm];
313 qs[l] = qb[l]-(dxtheta+ksi)*
dq[l];
321 int i,j,l,lip,ljp,nr,ns;
323 real *rp, *rm, *tp, *tm;
331 tp = ThetaMomP->
Field;
332 tm = ThetaMomM->
Field;
333 #pragma omp parallel for private(j,l,lip,ljp)
334 for (i = 0; i < nr; i++) {
335 for (j = 0; j < ns; j++) {
341 rp[l] = rho[l]*vr[lip];
342 rm[l] = rho[l]*vr[l];
353 int i,j,l,lim,ljm,nr,ns;
355 real *rp, *rm, *tp, *tm;
363 tp = ThetaMomP->
Field;
364 tm = ThetaMomM->
Field;
365 #pragma omp parallel for private(j,l,lim,ljm)
366 for (i = 0; i < nr; i++) {
367 for (j = 0; j < ns; j++) {
376 vr[l] = (rp[lim]+rm[l])/(rho[l]+rho[lim]+1e-20);
389 real *qrs, *rhos, *vr, *qb;
402 #pragma omp parallel for private(j,l,lip,varq) reduction(+ : LostByDisk)
403 for (i = 0; i < nr; i++) {
404 for (j = 0; j < ns; j++) {
407 varq =dt*dtheta*
Rinf[i]*qrs[l]*rhos[l]*vr[l];
408 varq-=dt*dtheta*
Rsup[i]*qrs[lip]*rhos[lip]*vr[lip];
422 real *qrs, *rhos, *vt, *qb;
423 real dxrad, varq, invsurf;
432 #pragma omp parallel for private(dxrad,invsurf,j,l,ljp,varq)
433 for (i = 0; i < nr; i++) {
435 invsurf = 1.0/
Surf[i];
436 for (j = 0; j < ns; j++) {
439 if (j == ns-1) ljp=i*ns;
440 varq = dxrad*qrs[l]*rhos[l]*vt[l];
441 varq -= dxrad*qrs[ljp]*rhos[ljp]*vt[ljp];
442 qb[l] += varq*invsurf;
double real
Definition of the type 'real' used throughout the code.
static PolarGrid * Elongations
void QuantitiesAdvection(PolarGrid *Rho, PolarGrid *Energy, PolarGrid *Vtheta, real dt)
static PolarGrid * RadMomP
static PolarGrid * ThetaMomM
void TransportPebbles(PolarGrid *Rho, PolarGrid *Vrad, PolarGrid *Vtheta, real dt)
An alternative to Transport() function for the 2nd fluid.
PolarGrid * CreatePolarGrid(int Nr, int Ns, char *name)
void ComputeVelocities(PolarGrid *Rho, PolarGrid *Vrad, PolarGrid *Vtheta)
static PolarGrid * ExtLabel
static PolarGrid * ThetaMomP
A structure used to store any scalar fied on the computational domain.
void Transport(PolarGrid *Rho, PolarGrid *Vrad, PolarGrid *Vtheta, PolarGrid *Energy, PolarGrid *Label, real dt)
void ComputeResiduals(PolarGrid *Vtheta, real dt)
void ComputeExtQty(PolarGrid *Rho, PolarGrid *Label, PolarGrid *ExtLabel)
void ComputeLRMomenta(PolarGrid *Rho, PolarGrid *Vrad, PolarGrid *Vtheta)
static PolarGrid * QRStar
int Nrad
Radial size of the grid, in number of zones.
void VanLeerTheta(PolarGrid *Vtheta, PolarGrid *Qbase, real dt)
void QuantitiesAdvectionPebbles(PolarGrid *Rho, PolarGrid *Vtheta, real dt)
An alternative to QuantitiesAdvection() function for the 2nd fluid.
void ComputeStarRad(PolarGrid *Qbase, PolarGrid *Vrad, PolarGrid *QStar, real dt)
void OneWindTheta(PolarGrid *Rho, PolarGrid *Vtheta, PolarGrid *Energy, real dt)
void ComputeStarTheta(PolarGrid *Qbase, PolarGrid *Vtheta, PolarGrid *QStar, real dt)
static PolarGrid * VthetaRes
void AdvectSHIFT(PolarGrid *array)
static PolarGrid * RadMomM
void ComputeSpeQty(PolarGrid *Rho, PolarGrid *Label, PolarGrid *ExtLabel)
real VanLeerRadial(PolarGrid *Vrad, PolarGrid *Qbase, real dt)
void OneWindRad(PolarGrid *Rho, PolarGrid *Vrad, PolarGrid *Energy, real dt)
void OneWindRadPebbles(PolarGrid *Rho, PolarGrid *Vrad, real dt)
An alternative to OneWindRad() function for the 2nd fluid.
Contains all the include directives requested by the code.
void OneWindThetaPebbles(PolarGrid *Rho, PolarGrid *Vtheta, real dt)
An alternative to OneWindTheta() function for the 2nd fluid.