Revision fe53297356da5f02478fe9cafab5d9914a36d2be authored by Thorsten Becker on 14 August 2007, 03:33:21 UTC, committed by Thorsten Becker on 14 August 2007, 03:33:21 UTC
spacing to top and lower layers of shell. The coor_refine=0.1,0.15,0.1,0.2 parameters specify the radius fraction of the bottom layer [0], the fraction of the nodes in this layer [1], the top layer fraction [2], and the top layer node fraction [3]. I.e. the defaults will put 15% of all nz nodes into the 10% lower layer, 20% in the top 10% upper layer, and the rest in between. - renamed gzipped output version with sub-directory storage ascii-gz - built in restart facilities for temperature and tracers when using ascii-gz I/O with vtkio != 2 - added a composition viscosity function, CDEPV, based on two tracer flavors - for this to work, I had to move viscosity_input() *behind* tic_input() and tracer_input() in instructions - added tracer_enriched option for internal heating. If tracer = on and tracer_enriched = on, will reader Q0_enriched and vary the element heat production between Q0 for C = 0 and Q0_enriched for C = 1. I.e. this only works if C varies between 0 and 1. - added an option to write from all processros to a single VTK file, if ascii-gz is activated, and vtkio = 2. The VTK output is of the "legacy", serial, single-file type, and requires that all processors see the same filesystem. This will lead to a bottleneck for large # of CPU computations as each processor has to wait til the previous is done. More efficient I/O should be possible by using the distributed storage version of VTK, but I have no clue how this works. Anyone?
1 parent d6e512c
Drive_solvers.c
/*
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
*<LicenseText>
*
* CitcomS by Louis Moresi, Shijie Zhong, Lijie Han, Eh Tan,
* Clint Conrad, Michael Gurnis, and Eun-seo Choi.
* Copyright (C) 1994-2005, California Institute of Technology.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*</LicenseText>
*
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#include <math.h>
#include <sys/types.h>
#include "element_definitions.h"
#include "global_defs.h"
#include "drive_solvers.h"
double global_vdot();
double vnorm_nonnewt();
/************************************************************/
void general_stokes_solver_setup(struct All_variables *E)
{
int i, m;
if (E->control.NMULTIGRID || E->control.NASSEMBLE)
construct_node_maps(E);
else
for (i=E->mesh.gridmin;i<=E->mesh.gridmax;i++)
for (m=1;m<=E->sphere.caps_per_proc;m++)
E->elt_k[i][m]=(struct EK *)malloc((E->lmesh.NEL[i]+1)*sizeof(struct EK));
return;
}
void general_stokes_solver(struct All_variables *E)
{
void solve_constrained_flow_iterative();
void construct_stiffness_B_matrix();
void velocities_conform_bcs();
void assemble_forces();
void sphere_harmonics_layer();
void get_system_viscosity();
float vmag;
double Udot_mag, dUdot_mag;
int m,count,i,j,k;
double *oldU[NCS], *delta_U[NCS];
const int nno = E->lmesh.nno;
const int nel = E->lmesh.nel;
const int nnov = E->lmesh.nnov;
const int neq = E->lmesh.neq;
const int vpts = vpoints[E->mesh.nsd];
const int dims = E->mesh.nsd;
const int addi_dof = additional_dof[dims];
E->monitor.elapsed_time_vsoln = E->monitor.elapsed_time;
velocities_conform_bcs(E,E->U);
assemble_forces(E,0);
if(E->monitor.solution_cycles==0 || E->viscosity.update_allowed) {
get_system_viscosity(E,1,E->EVI[E->mesh.levmax],E->VI[E->mesh.levmax]);
construct_stiffness_B_matrix(E);
}
solve_constrained_flow_iterative(E);
if (E->viscosity.SDEPV || E->viscosity.PDEPV) {
for (m=1;m<=E->sphere.caps_per_proc;m++) {
delta_U[m] = (double *)malloc((neq+2)*sizeof(double));
oldU[m] = (double *)malloc((neq+2)*sizeof(double));
for(i=0;i<=neq;i++)
oldU[m][i]=0.0;
}
Udot_mag=dUdot_mag=0.0;
count=1;
while (1) {
for (m=1;m<=E->sphere.caps_per_proc;m++)
for (i=0;i<neq;i++) {
delta_U[m][i] = E->U[m][i] - oldU[m][i];
oldU[m][i] = E->U[m][i];
}
Udot_mag = sqrt(global_vdot(E,oldU,oldU,E->mesh.levmax));
dUdot_mag = vnorm_nonnewt(E,delta_U,oldU,E->mesh.levmax);
if(E->parallel.me==0){
fprintf(stderr,"Stress dep. visc./plast.: DUdot = %.4e (%.4e) for iteration %d\n",
dUdot_mag,Udot_mag,count);
fprintf(E->fp,"Stress dep. visc./plast.: DUdot = %.4e (%.4e) for iteration %d\n",
dUdot_mag,Udot_mag,count);
fflush(E->fp);
}
if ((count>50) || (dUdot_mag<E->viscosity.sdepv_misfit))
break;
get_system_viscosity(E,1,E->EVI[E->mesh.levmax],E->VI[E->mesh.levmax]);
construct_stiffness_B_matrix(E);
solve_constrained_flow_iterative(E);
count++;
} /*end while*/
for (m=1;m<=E->sphere.caps_per_proc;m++) {
free((void *) oldU[m]);
free((void *) delta_U[m]);
}
} /*end if SDEPV or PDEPV */
return;
}
void general_stokes_solver_pseudo_surf(struct All_variables *E)
{
void solve_constrained_flow_iterative_pseudo_surf();
void construct_stiffness_B_matrix();
void velocities_conform_bcs();
void assemble_forces_pseudo_surf();
void get_system_viscosity();
void std_timestep();
void get_STD_freesurf(struct All_variables *, float**);
float vmag;
double Udot_mag, dUdot_mag;
int m,count,i,j,k,topo_loop;
double *oldU[NCS], *delta_U[NCS];
const int nno = E->lmesh.nno;
const int nel = E->lmesh.nel;
const int nnov = E->lmesh.nnov;
const int neq = E->lmesh.neq;
const int vpts = vpoints[E->mesh.nsd];
const int dims = E->mesh.nsd;
const int addi_dof = additional_dof[dims];
E->monitor.elapsed_time_vsoln = E->monitor.elapsed_time;
velocities_conform_bcs(E,E->U);
E->monitor.stop_topo_loop = 0;
E->monitor.topo_loop = 0;
if(E->monitor.solution_cycles==0) std_timestep(E);
while(E->monitor.stop_topo_loop == 0) {
assemble_forces_pseudo_surf(E,0);
if(E->monitor.solution_cycles==0 || E->viscosity.update_allowed) {
get_system_viscosity(E,1,E->EVI[E->mesh.levmax],E->VI[E->mesh.levmax]);
construct_stiffness_B_matrix(E);
}
solve_constrained_flow_iterative_pseudo_surf(E);
if (E->viscosity.SDEPV || E->viscosity.PDEPV) {
for (m=1;m<=E->sphere.caps_per_proc;m++) {
delta_U[m] = (double *)malloc((neq+2)*sizeof(double));
oldU[m] = (double *)malloc((neq+2)*sizeof(double));
for(i=0;i<=neq;i++)
oldU[m][i]=0.0;
}
Udot_mag=dUdot_mag=0.0;
count=1;
while (1) {
for (m=1;m<=E->sphere.caps_per_proc;m++)
for (i=0;i<neq;i++) {
delta_U[m][i] = E->U[m][i] - oldU[m][i];
oldU[m][i] = E->U[m][i];
}
Udot_mag = sqrt(global_vdot(E,oldU,oldU,E->mesh.levmax));
dUdot_mag = vnorm_nonnewt(E,delta_U,oldU,E->mesh.levmax);
if(E->parallel.me==0){
fprintf(stderr,"Stress dependent viscosity: DUdot = %.4e (%.4e) for iteration %d\n",dUdot_mag,Udot_mag,count);
fprintf(E->fp,"Stress dependent viscosity: DUdot = %.4e (%.4e) for iteration %d\n",dUdot_mag,Udot_mag,count);
fflush(E->fp);
}
if (count>50 || dUdot_mag<E->viscosity.sdepv_misfit)
break;
get_system_viscosity(E,1,E->EVI[E->mesh.levmax],E->VI[E->mesh.levmax]);
construct_stiffness_B_matrix(E);
solve_constrained_flow_iterative_pseudo_surf(E);
count++;
} /*end while */
for (m=1;m<=E->sphere.caps_per_proc;m++) {
free((void *) oldU[m]);
free((void *) delta_U[m]);
}
} /*end if SDEPV or PDEPV */
E->monitor.topo_loop++;
}
get_STD_freesurf(E,E->slice.freesurf);
return;
}
Computing file changes ...