29 real viscosity, rmin, rmax, scale;
44 if ((rad >= rmin) && (rad <= rmax)) {
45 viscosity *= exp((rmax-rad)/(rmax-rmin)*log(
CAVITYRATIO));
53 real aspectratio, rmin, rmax, scale;
61 if ((rad >= rmin) && (rad <= rmax)) {
82 int i,j,l,nr,ns,lip,ljp,ljm,lim,ljmim;
84 real *Drr, *Drp, *Dpp, *divergence;
85 real *Trr, *Trp, *Tpp;
86 real dphi, onethird, invdphi;
101 dphi = 2.0*M_PI/(
real)ns;
105 #pragma omp parallel private(l,lip,ljp,j,ljm,lim)
107 #pragma omp for nowait
108 for (i = 0; i < nr; i++) {
109 for (j = 0; j < ns; j++) {
113 if (j == ns-1) ljp = i*ns;
115 Dpp[l] = (vt[ljp]-vt[l])*invdphi*
InvRmed[i]+0.5*(vr[lip]+vr[l])*
InvRmed[i];
117 divergence[l] += (vt[ljp]-vt[l])*invdphi*
InvRmed[i];
121 for (i = 1; i < nr; i++) {
122 for (j = 0; j < ns; j++) {
125 if (j == 0) ljm = i*ns+ns-1;
128 (vr[l]-vr[ljm])*invdphi*
InvRinf[i]);
132 #pragma omp parallel private(l,ljmim,j,ljm,lim,viscosity)
134 #pragma omp for nowait
135 for (i = 0; i < nr; i++) {
137 for (j = 0; j < ns; j++) {
139 Trr[l] = 2.0*rho[l]*viscosity*(Drr[l]-onethird*divergence[l]);
140 Tpp[l] = 2.0*rho[l]*viscosity*(Dpp[l]-onethird*divergence[l]);
144 for (i = 1; i < nr; i++) {
146 for (j = 0; j < ns; j++) {
150 if (j == 0) ljm = i*ns+ns-1;
152 Trp[l] = 2.0*0.25*(rho[l]+rho[lim]+rho[ljm]+rho[ljmim])*viscosity*Drp[l];
163 int i,j,l,nr,ns,lip,ljp,ljm,lim;
165 real *Trr, *Trp, *Tpp;
176 dphi = 2.0*M_PI/(
real)ns;
182 #pragma omp parallel private(l,j,lip,ljp,ljm,lim)
184 #pragma omp for nowait
185 for (i = 1; i < nr-1; i++) {
186 for (j = 0; j < ns; j++) {
190 if (j == ns-1) ljp = i*ns;
192 if (j == 0) ljm = i*ns+ns-1;
194 (Tpp[l]-Tpp[ljm])*invdphi+\
195 0.5*(Trp[l]+Trp[lip]))/(0.5*(rho[l]+rho[ljm]));
198 #pragma omp for nowait
199 for (i = 1; i < nr; i++) {
200 for (j = 0; j < ns; j++) {
205 if (j == ns-1) ljp = i*ns;
207 (Trp[ljp]-Trp[l])*invdphi-\
208 0.5*(Tpp[l]+Tpp[lim]))/(0.5*(rho[l]+rho[lim]));
218 real VKepIn, VKepOut;
226 #pragma omp parallel private(l,j)
230 VKepIn = sqrt(
G*1.0/
Rmed[0])*\
234 VKepOut = sqrt(
G*1.0/
Rmed[nr-1])*\
240 for (j = 0; j < ns; j++) {
247 for (j = 0; j < ns; j++) {
double real
Definition of the type 'real' used throughout the code.
void UpdateVelocityWithViscousTerms(PolarGrid *Vrad, PolarGrid *Vtheta, PolarGrid *Rho, real DeltaT)
A function derived from the original ViscousTerms().
PolarGrid * CreatePolarGrid(int Nr, int Ns, char *name)
A structure used to store any scalar fied on the computational domain.
int Nrad
Radial size of the grid, in number of zones.
real AspectRatio(real rad)
PolarGrid * DivergenceVelocity
Contains all the include directives requested by the code.
void ImposeKeplerianEdges(PolarGrid *Vtheta)
A function derived from the original ViscousTerms().
real FViscosity(real rad)
void UpdateDivVelocAndStressTensor(PolarGrid *Vrad, PolarGrid *Vtheta, PolarGrid *Rho)
A function derived from the original ViscousTerms().