int32 d_piezo_coupling( FMField *out, FMField *strain, FMField *charge_grad, FMField *mtxG, VolumeGeometry *vg ) { int32 ii, dim, nQP, ret = RET_OK; FMField *ge = 0, *gptge = 0; nQP = vg->bfGM->nLev; dim = vg->bfGM->nRow; fmf_createAlloc( &ge, 1, nQP, dim, 1 ); fmf_createAlloc( &gptge, 1, nQP, 1, 1 ); for (ii = 0; ii < out->nCell; ii++) { FMF_SetCell( out, ii ); FMF_SetCell( mtxG, ii ); FMF_SetCell( vg->det, ii ); FMF_SetCell( strain, ii ); FMF_SetCell( charge_grad, ii ); fmf_mulAB_nn( ge, mtxG, strain ); fmf_mulATB_nn( gptge, charge_grad, ge ); fmf_sumLevelsMulF( out, gptge, vg->det->val ); ERR_CheckGo( ret ); } end_label: fmf_freeDestroy( &ge ); fmf_freeDestroy( &gptge ); return( ret ); }
/*! @par Revision history: - c: 23.04.2007, r: 23.01.2008 */ int32 dw_permeability_r( FMField *out, FMField *mtxD, VolumeGeometry *vg, int32 *conn, int32 nEl, int32 nEP, int32 *elList, int32 elList_nRow ) { int32 ii, iel, nQP, ret = RET_OK; FMField *gtd = 0; nQP = vg->bfGM->nLev; fmf_createAlloc( >d, 1, nQP, nEP, 1 ); for (ii = 0; ii < elList_nRow; ii++) { iel = elList[ii]; FMF_SetCell( out, ii ); FMF_SetCell( vg->bfGM, iel ); FMF_SetCell( vg->det, iel ); if (mtxD->nCell > 1) { FMF_SetCell( mtxD, ii ); } fmf_mulATB_nn( gtd, vg->bfGM, mtxD ); fmf_sumLevelsMulF( out, gtd, vg->det->val ); ERR_CheckGo( ret ); } end_label: fmf_freeDestroy( >d ); return( ret ); }
/*! @par Revision history: - c: 21.12.2005, r: 18.01.2008 */ int32 sg_print( SurfaceGeometry *obj, FILE *file, int32 mode ) { int32 ii; fprintf( file, "SurfaceGeometry: mode %d, nFa %d, nQP %d, dim: %d, nFP: %d\n", obj->mode, obj->nFa, obj->nQP, obj->dim, obj->nFP ); fprintf( file, "totalArea: %.5f\n", obj->totalArea ); for (ii = 0; ii < obj->det->nCell; ii++) { FMF_SetCell( obj->normal, ii ); FMF_SetCell( obj->det, ii ); FMF_SetCell( obj->area, ii ); fprintf( file, "%d normal:\n", ii ); fmf_print( obj->normal, file, mode ); fprintf( file, "%d det:\n", ii ); fmf_print( obj->det, file, mode ); fprintf( file, "%d area:\n", ii ); fmf_print( obj->area, file, mode ); if (obj->bfBGM) { FMF_SetCell( obj->bfBGM, ii ); fprintf( file, "%d bfBGM:\n", ii ); fmf_print( obj->bfBGM, file, mode ); } } return( RET_OK ); }
/*! @par Revision history: - 23.01.2006, c - 02.03.2006 - 27.07.2006 */ int32 d_of_nsMinGrad( FMField *out, FMField *grad, FMField *viscosity, VolumeGeometry *vg ) { int32 ii, nQP, ret = RET_OK; float64 aux; FMField *out1 = 0, *gvel2 = 0; nQP = vg->bfGM->nLev; fmf_createAlloc( &out1, 1, 1, 1, 1 ); fmf_createAlloc( &gvel2, 1, nQP, 1, 1 ); FMF_SetFirst( out ); aux = 0.0; for (ii = 0; ii < grad->nCell; ii++) { FMF_SetCell( grad, ii ); FMF_SetCell( viscosity, ii ); FMF_SetCell( vg->det, ii ); fmf_mulATB_nn( gvel2, grad, grad ); fmf_mul( gvel2, viscosity->val ); fmf_sumLevelsMulF( out1, gvel2, vg->det->val ); aux += out1->val[0]; ERR_CheckGo( ret ); } out->val[0] = aux * 0.5; end_label: fmf_freeDestroy( &out1 ); fmf_freeDestroy( &gvel2 ); return( ret ); }
/*! @par Revision history: - 30.07.2007, from dw_hdpm_cache() */ int32 dq_cauchy_strain( FMField *out, FMField *state, int32 offset, VolumeGeometry *vg, int32 *conn, int32 nEl, int32 nEP ) { int32 ii, dim, sym, nQP, ret = RET_OK; FMField *st = 0, *disG = 0; state->val = FMF_PtrFirst( state ) + offset; nQP = vg->bfGM->nLev; dim = vg->bfGM->nRow; sym = (dim + 1) * dim / 2; fmf_createAlloc( &st, 1, 1, nEP, dim ); fmf_createAlloc( &disG, 1, nQP, dim, dim ); for (ii = 0; ii < nEl; ii++) { FMF_SetCell( out, ii ); FMF_SetCell( vg->bfGM, ii ); ele_extractNodalValuesNBN( st, state, conn + nEP * ii ); fmf_mulAB_n1( disG, vg->bfGM, st ); form_sdcc_strainCauchy_VS( out, disG ); /* fmf_print( out, stdout, 0 ); */ /* sys_pause(); */ ERR_CheckGo( ret ); } end_label: fmf_freeDestroy( &st ); fmf_freeDestroy( &disG ); return( ret ); }
/*! @par Revision history: - 11.10.2005, c - 12.10.2005 - 12.10.2006 */ int32 vg_print( VolumeGeometry *obj, FILE *file, int32 mode ) { int32 ii; fprintf( file, "VolumeGeometry: mode %d, nEl %d, nQP %d, dim: %d, nEP: %d\n", obj->mode, obj->nEl, obj->nQP, obj->dim, obj->nEP ); fprintf( file, "totalVolume: %.5f\n", obj->totalVolume ); for (ii = 0; ii < obj->det->nCell; ii++) { FMF_SetCell( obj->bfGM, ii ); FMF_SetCell( obj->det, ii ); FMF_SetCell( obj->volume, ii ); fprintf( file, "%d bfGM:\n", ii ); fmf_print( obj->bfGM, file, mode ); fprintf( file, "%d det:\n", ii ); fmf_print( obj->det, file, mode ); fprintf( file, "%d volume:\n", ii ); fmf_print( obj->volume, file, mode ); } return( RET_OK ); }
/*! @par Revision history: - 21.09.2006, c */ int32 de_cauchy_strain( FMField *out, FMField *strain, VolumeGeometry *vg, int32 mode ) { int32 ii, dim, sym, nQP, ret = RET_OK; nQP = vg->bfGM->nLev; dim = vg->bfGM->nRow; sym = (dim + 1) * dim / 2; for (ii = 0; ii < out->nCell; ii++) { FMF_SetCell( out, ii ); FMF_SetCell( strain, ii ); FMF_SetCell( vg->det, ii ); fmf_sumLevelsMulF( out, strain, vg->det->val ); if (mode == 1) { FMF_SetCell( vg->volume, ii ); fmf_mulC( out, 1.0 / vg->volume->val[0] ); } ERR_CheckGo( ret ); } end_label: return( ret ); }
/*! @par Revision history: - c: 25.03.2008 */ int32 de_cauchy_stress( FMField *out, FMField *strain, FMField *mtxD, VolumeGeometry *vg, int32 mode ) { int32 ii, dim, sym, nQP, ret = RET_OK; FMField *stress = 0; nQP = vg->bfGM->nLev; dim = vg->bfGM->nRow; sym = (dim + 1) * dim / 2; fmf_createAlloc( &stress, 1, nQP, sym, 1 ); for (ii = 0; ii < out->nCell; ii++) { FMF_SetCell( out, ii ); FMF_SetCell( mtxD, ii ); FMF_SetCell( strain, ii ); FMF_SetCell( vg->det, ii ); fmf_mulAB_nn( stress, mtxD, strain ); fmf_sumLevelsMulF( out, stress, vg->det->val ); if (mode == 1) { FMF_SetCell( vg->volume, ii ); fmf_mulC( out, 1.0 / vg->volume->val[0] ); } ERR_CheckGo( ret ); } end_label: fmf_freeDestroy( &stress ); return( ret ); }
/*! @par Revision history: - 04.09.2007, c */ int32 d_mass_scalar( FMField *out, FMField *coef, FMField *stateP, FMField *stateQ, FMField *bf, VolumeGeometry *vg ) { int32 ii, dim, nQP, ret = RET_OK; FMField *qftfp = 0; nQP = vg->bfGM->nLev; dim = vg->bfGM->nRow; fmf_createAlloc( &qftfp, 1, nQP, 1, 1 ); for (ii = 0; ii < out->nCell; ii++) { FMF_SetCell( out, ii ); FMF_SetCell( stateP, ii ); FMF_SetCell( stateQ, ii ); FMF_SetCell( vg->det, ii ); if (coef->nCell > 1) { FMF_SetCell( coef, ii ); } fmf_mulATB_nn( qftfp, stateQ, stateP ); fmf_mul( qftfp, coef->val ); fmf_sumLevelsMulF( out, qftfp, vg->det->val ); ERR_CheckGo( ret ); } end_label: fmf_freeDestroy( &qftfp ); return( ret ); }
int32 dw_lin_prestress( FMField *out, FMField *stress, VolumeGeometry *vg, int32 *elList, int32 elList_nRow, int32 isDiff ) { int32 ii, iel, dim, nQP, nEP, ret = RET_OK; FMField *res = 0; nQP = vg->bfGM->nLev; nEP = vg->bfGM->nCol; dim = vg->bfGM->nRow; fmf_createAlloc( &res, 1, nQP, dim * nEP, 1 ); for (ii = 0; ii < elList_nRow; ii++) { iel = elList[ii]; FMF_SetCell( out, ii ); FMF_SetCell( vg->bfGM, iel ); FMF_SetCell( vg->det, iel ); FMF_SetCell( stress, iel ); form_sdcc_actOpGT_VS3( res, vg->bfGM, stress ); fmf_sumLevelsMulF( out, res, vg->det->val ); ERR_CheckGo( ret ); } end_label: fmf_freeDestroy( &res ); return( ret ); }
int32 dw_lin_prestress( FMField *out, FMField *stress, Mapping *vg ) { int32 ii, dim, nQP, nEP, ret = RET_OK; FMField *res = 0; nQP = vg->bfGM->nLev; nEP = vg->bfGM->nCol; dim = vg->bfGM->nRow; fmf_createAlloc( &res, 1, nQP, dim * nEP, 1 ); for (ii = 0; ii < out->nCell; ii++) { FMF_SetCell( out, ii ); FMF_SetCell( vg->bfGM, ii ); FMF_SetCell( vg->det, ii ); FMF_SetCell( stress, ii ); form_sdcc_actOpGT_VS3( res, vg->bfGM, stress ); fmf_sumLevelsMulF( out, res, vg->det->val ); ERR_CheckGo( ret ); } end_label: fmf_freeDestroy( &res ); return( ret ); }
int32 dw_lin_strain_fib( FMField *out, FMField *mtxD, FMField *mat, Mapping *vg ) { int32 ii, dim, sym, nQP, nEP, ret = RET_OK; FMField *aux1 = 0, *aux2 = 0; nQP = vg->bfGM->nLev; nEP = vg->bfGM->nCol; dim = vg->bfGM->nRow; sym = (dim + 1) * dim / 2; fmf_createAlloc( &aux1, 1, nQP, nEP * dim, sym ); fmf_createAlloc( &aux2, 1, nQP, nEP * dim, 1 ); for (ii = 0; ii < out->nCell; ii++) { FMF_SetCell( out, ii ); FMF_SetCell( mtxD, ii ); FMF_SetCell( mat, ii ); FMF_SetCell( vg->bfGM, ii ); FMF_SetCell( vg->det, ii ); form_sdcc_actOpGT_M3( aux1, vg->bfGM, mtxD ); fmf_mulAB_nn( aux2, aux1, mat ); fmf_sumLevelsMulF( out, aux2, vg->det->val ); ERR_CheckGo( ret ); } end_label: fmf_freeDestroy( &aux1 ); fmf_freeDestroy( &aux2 ); return( ret ); }
/*! @par Revision history: - c: 12.03.2007, r: 23.01.2008 */ int32 d_diffusion( FMField *out, FMField *gradP1, FMField *gradP2, FMField *mtxD, Mapping *vg ) { int32 ii, dim, nQP, ret = RET_OK; FMField *dgp2 = 0, *gp1tdgp2 = 0; nQP = vg->bfGM->nLev; dim = vg->bfGM->nRow; fmf_createAlloc( &dgp2, 1, nQP, dim, 1 ); fmf_createAlloc( &gp1tdgp2, 1, nQP, 1, 1 ); for (ii = 0; ii < out->nCell; ii++) { FMF_SetCell( out, ii ); FMF_SetCell( vg->det, ii ); FMF_SetCell( gradP1, ii ); FMF_SetCell( gradP2, ii ); if (mtxD->nCell > 1) { FMF_SetCell( mtxD, ii ); } fmf_mulAB_nn( dgp2, mtxD, gradP2 ); fmf_mulATB_nn( gp1tdgp2, gradP1, dgp2 ); fmf_sumLevelsMulF( out, gp1tdgp2, vg->det->val ); ERR_CheckGo( ret ); } end_label: fmf_freeDestroy( &dgp2 ); fmf_freeDestroy( &gp1tdgp2 ); return( ret ); }
/*! mode == 0: \int pq mode == 1: \int pq div V Works for both scalars and vectors. @par Revision history: - 24.02.2006, c - 27.02.2006 */ int32 d_sd_volume_dot( FMField *out, FMField *stateP, FMField *stateQ, FMField *divMV, VolumeGeometry *vg, int32 mode ) { int32 ii, nQP, ret = RET_OK; FMField *pq = 0; nQP = vg->bfGM->nLev; fmf_createAlloc( &pq, 1, nQP, 1, 1 ); for (ii = 0; ii < out->nCell; ii++) { FMF_SetCell( out, ii ); FMF_SetCell( stateP, ii ); FMF_SetCell( stateQ, ii ); FMF_SetCell( vg->det, ii ); fmf_mulATB_nn( pq, stateP, stateQ ); if (mode == 1) { FMF_SetCell( divMV, ii ); fmf_mul( pq, divMV->val ); } fmf_sumLevelsMulF( out, pq, vg->det->val ); ERR_CheckGo( ret ); } end_label: fmf_freeDestroy( &pq ); return( ret ); }
/*! @par Revision history: - c: 23.04.2007, r: 23.01.2008 */ int32 dw_diffusion_r( FMField *out, FMField *mtxD, Mapping *vg ) { int32 ii, nQP, nEP, ret = RET_OK; FMField *gtd = 0; nQP = vg->bfGM->nLev; nEP = vg->bfGM->nCol; fmf_createAlloc( >d, 1, nQP, nEP, 1 ); for (ii = 0; ii < out->nCell; ii++) { FMF_SetCell( out, ii ); FMF_SetCell( vg->bfGM, ii ); FMF_SetCell( vg->det, ii ); if (mtxD->nCell > 1) { FMF_SetCell( mtxD, ii ); } fmf_mulATB_nn( gtd, vg->bfGM, mtxD ); fmf_sumLevelsMulF( out, gtd, vg->det->val ); ERR_CheckGo( ret ); } end_label: fmf_freeDestroy( >d ); return( ret ); }
int32 d_surf_lcouple( FMField *out, FMField *stateP, FMField *gradQ, FMField *coef, Mapping *sg ) { int32 ii, dim, nQP, ret = RET_OK; FMField *aux1 = 0, *aux2 = 0; nQP = stateP->nLev; dim = coef->nRow; fmf_createAlloc(&aux1, 1, nQP, dim, 1); fmf_createAlloc(&aux2, 1, nQP, 1, 1); for (ii = 0; ii < out->nCell; ii++) { if (coef->nCell > 1) FMF_SetCell( coef, ii ); FMF_SetCell( out, ii ); FMF_SetCell( sg->det, ii ); FMF_SetCell(stateP, ii); FMF_SetCell(gradQ, ii); fmf_mulAB_nn(aux1, coef, stateP); fmf_mulATB_nn(aux2, gradQ, aux1); fmf_sumLevelsMulF(out, aux2, sg->det->val); ERR_CheckGo( ret ); } end_label: fmf_freeDestroy(&aux1); fmf_freeDestroy(&aux2); return( ret ); }
/*! @par Revision history: - c: 05.03.2008, r: 05.03.2008 */ int32 d_biot_div( FMField *out, float64 coef, FMField *state, FMField *strain, FMField *mtxD, Mapping *vg ) { int32 ii, nQP, ret = RET_OK; FMField *dtgu = 0, *pftdtgu = 0; nQP = vg->bfGM->nLev; /* fmf_print( mtxD, stdout, 0 ); */ fmf_createAlloc( &dtgu, 1, nQP, 1, 1 ); fmf_createAlloc( &pftdtgu, 1, nQP, 1, 1 ); for (ii = 0; ii < out->nCell; ii++) { FMF_SetCell( out, ii ); FMF_SetCell( mtxD, ii ); FMF_SetCell( vg->det, ii ); FMF_SetCell( state, ii ); FMF_SetCell( strain, ii ); fmf_mulATB_nn( dtgu, mtxD, strain ); fmf_mulATB_nn( pftdtgu, state, dtgu ); fmf_sumLevelsMulF( out, pftdtgu, vg->det->val ); ERR_CheckGo( ret ); } // E.g. 1/dt. fmfc_mulC( out, coef ); end_label: fmf_freeDestroy( &dtgu ); fmf_freeDestroy( &pftdtgu ); return( ret ); }
/*! @par Revision history: - 03.08.2006, c - 01.12.2006 */ int32 dw_biot_grad( FMField *out, float64 coef, FMField *pressure_qp, FMField *mtxD, Mapping *svg, Mapping *vvg, int32 isDiff ) { int32 ii, nEPU, nEP, dim, nQP, ret = RET_OK; FMField *dfp = 0, *gtdfp = 0, *gtd = 0, *gtdf = 0; nQP = vvg->bfGM->nLev; dim = vvg->bfGM->nRow; nEPU = vvg->bfGM->nCol; nEP = svg->bf->nCol; /* fmf_print( mtxD, stdout, 0 ); */ if (isDiff == 1) { fmf_createAlloc( >d, 1, nQP, dim * nEPU, 1 ); fmf_createAlloc( >df, 1, nQP, dim * nEPU, nEP ); } else { int32 sym = (dim + 1) * dim / 2; fmf_createAlloc( &dfp, 1, nQP, sym, 1 ); fmf_createAlloc( >dfp, 1, nQP, dim * nEPU, 1 ); } for (ii = 0; ii < out->nCell; ii++) { FMF_SetCell( out, ii ); FMF_SetCell( mtxD, ii ); FMF_SetCell( vvg->bfGM, ii ); FMF_SetCell( vvg->det, ii ); if (isDiff == 1) { FMF_SetCellX1( svg->bf, ii ); form_sdcc_actOpGT_M3( gtd, vvg->bfGM, mtxD ); fmf_mulAB_nn( gtdf, gtd, svg->bf ); fmf_sumLevelsMulF( out, gtdf, vvg->det->val ); } else { FMF_SetCell( pressure_qp, ii ); fmf_mulAB_nn( dfp, mtxD, pressure_qp ); form_sdcc_actOpGT_VS3( gtdfp, vvg->bfGM, dfp ); fmf_sumLevelsMulF( out, gtdfp, vvg->det->val ); } ERR_CheckGo( ret ); } // E.g. 1/dt. fmfc_mulC( out, coef ); end_label: if (isDiff) { fmf_freeDestroy( >d ); fmf_freeDestroy( >df ); } else { fmf_freeDestroy( &dfp ); fmf_freeDestroy( >dfp ); } return( ret ); }
/*! @par Revision history: - 24.10.2007, c */ int32 d_sd_st_grad_div( FMField *out, FMField *divU, FMField *gradU, FMField *divW, FMField *gradW, FMField *divMV, FMField *gradMV, FMField *coef, VolumeGeometry *vg_u, int32 mode ) { int32 ii, nQP, ret = RET_OK; FMField *scalar1 = 0, *scalar2 = 0; nQP = vg_u->bfGM->nLev; fmf_createAlloc( &scalar1, 1, nQP, 1, 1 ); if (mode == 1) { fmf_createAlloc( &scalar2, 1, nQP, 1, 1 ); } for (ii = 0; ii < out->nCell; ii++) { FMF_SetCell( out, ii ); FMF_SetCell( coef, ii ); FMF_SetCell( divU, ii ); FMF_SetCell( divW, ii ); FMF_SetCell( vg_u->det, ii ); if (mode == 0) { // (div u, div w) fmf_mulATB_nn( scalar1, divU, divW ); fmf_mul( scalar1, coef->val ); fmf_sumLevelsMulF( out, scalar1, vg_u->det->val ); } else if (mode == 1) { FMF_SetCell( divMV, ii ); FMF_SetCell( gradU, ii ); FMF_SetCell( gradW, ii ); FMF_SetCell( gradMV, ii ); // div u div w div nu ... fmf_mulATB_nn( scalar1, divU, divW ); fmf_mulATB_nn( scalar2, divMV, scalar1 ); // ... - (gu : gnu^T) div w ... sub_mul_gradddgrad_scalar( scalar2, gradMV, gradU, divW ); // ... - (gw : gnu^T) div u sub_mul_gradddgrad_scalar( scalar2, gradMV, gradW, divU ); fmf_mul( scalar2, coef->val ); fmf_sumLevelsMulF( out, scalar2, vg_u->det->val ); } ERR_CheckGo( ret ); } end_label: fmf_freeDestroy( &scalar1 ); if (mode == 1) { fmf_freeDestroy( &scalar2 ); } return( ret ); }
/*! @par Revision history: - 09.01.2006, c - 10.01.2006 */ int32 vg_getElementDiameters( VolumeGeometry *obj, FMField *out, int32 *edges, int32 edges_nRow, int32 edges_nCol, float64 *coorIn, int32 nNod, int32 dim, int32 *conn, int32 nEl, int32 nEP, int32 *elList, int32 elList_nRow, int32 mode ) { int32 ii, ie, id, iel, nd; float64 val0 = 0.0, val1 = 0.0, vv, aux = 0.0, exponent; if ((mode < 0) && (mode > 2)) { errput( ErrHead "ERR_Switch\n" ); return( RET_Fail ); } /* output( "%d %d %d %d %d %d %d\n", */ /* edges_nRow, edges_nCol, nNod, dim, nEl, nEP, elList_nRow ); */ nd = obj->bfGM->nRow; // Can be <> dim. exponent = 1.0 / ((float64) dim); for (ii = 0; ii < elList_nRow; ii++) { iel = elList[ii]; FMF_SetCell( out, ii ); if ((mode == 0) || (mode == 2)) { val0 = 0.0; for (ie = 0; ie < edges_nRow; ie++) { vv = 0.0; for (id = 0; id < nd; id++) { aux = coorIn[dim*conn[nEP*iel+edges[2*ie+1]]+id] - coorIn[dim*conn[nEP*iel+edges[2*ie+0]]+id]; /* output( "%d %d %d %d %f %f %f\n", ii, iel, ie, id, aux, */ /* coorIn[dim*conn[nEP*iel+edges[2*ie+1]]+id], */ /* coorIn[dim*conn[nEP*iel+edges[2*ie+0]]+id] ); */ /* sys_pause(); */ vv += aux * aux; } /* output("%f\n", sqrt(vv)); */ val0 = Max( val0, vv ); out->val[0] = val0; } } if ((mode == 1) || (mode == 2)) { FMF_SetCell( obj->volume, iel ); val1 = pow( 0.16 * obj->volume->val[0], exponent ); out->val[0] = val1; } if (mode == 2) { out->val[0] = Max( val0, val1 ); } } return( RET_OK ); }
int32 dw_surface_dot_vector( FMField *out, FMField *coef, FMField *val_qp, SurfaceGeometry *rsg, SurfaceGeometry *csg, int32 isDiff ) { int32 ii, dim, nQP, nEPR, nEPC, ret = RET_OK; FMField *ftfu = 0, *ftf1 = 0, *ftf = 0; nQP = rsg->normal->nLev; dim = rsg->normal->nRow; nEPR = rsg->bf->nCol; nEPC = csg->bf->nCol; if (isDiff) { fmf_createAlloc( &ftf, 1, nQP, nEPR * dim, nEPC * dim ); fmf_createAlloc( &ftf1, 1, nQP, nEPR, nEPC ); } else { fmf_createAlloc( &ftfu, 1, nQP, dim * nEPR, 1 ); } for (ii = 0; ii < out->nCell; ii++) { FMF_SetCell( out, ii ); FMF_SetCellX1( coef, ii ); FMF_SetCell( rsg->det, ii ); FMF_SetCellX1( rsg->bf, ii ); if (isDiff) { FMF_SetCellX1( csg->bf, ii ); fmf_mulATB_nn( ftf1, rsg->bf, csg->bf ); bf_buildFTF( ftf, ftf1 ); fmf_mul( ftf, coef->val ); fmf_sumLevelsMulF( out, ftf, rsg->det->val ); } else { FMF_SetCell( val_qp, ii ); bf_actt( ftfu, rsg->bf, val_qp ); fmf_mul( ftfu, coef->val ); fmf_sumLevelsMulF( out, ftfu, rsg->det->val ); } ERR_CheckGo( ret ); } end_label: if (isDiff) { fmf_freeDestroy( &ftf1 ); fmf_freeDestroy( &ftf ); } else { fmf_freeDestroy( &ftfu ); } return( ret ); }
/*! @par Revision history: - 04.05.2007, c - 30.05.2007 */ int32 sg_evaluateBFBGM( SurfaceGeometry *obj, FMField *bfBGR, float64 *coorIn, int32 nNod, int32 dim, int32 *fis, int32 nFa, int32 nFP, int32 *conn, int32 nEl, int32 nEP ) { int32 ii, iel, ifa, inod, idim, pos, nQP, ret = RET_OK; FMField *volCoor0 = 0, *mtxRM = 0, *mtxRMI = 0; nQP = obj->normal->nLev; /* output( "%d %d %d %d\n", dim, nQP, nEP, nNod ); */ fmf_createAlloc( &volCoor0, 1, 1, nEP, dim ); fmf_createAlloc( &mtxRM, 1, nQP, dim, dim ); fmf_createAlloc( &mtxRMI, 1, nQP, dim, dim ); for (ii = 0; ii < nFa; ii++) { iel = fis[ii*nFP+0]; ifa = fis[ii*nFP+1]; FMF_SetCell( obj->bfBGM, ii ); FMF_SetCell( bfBGR, ifa ); for (inod = 0; inod < nEP; inod++) { pos = dim*conn[nEP*iel+inod]; for (idim = 0; idim < dim; idim++ ) { volCoor0->val[dim*inod+idim] = coorIn[idim+pos]; } } fmf_mulAB_n1( mtxRM, bfBGR, volCoor0 ); geme_invert3x3( mtxRMI, mtxRM ); fmf_mulAB_nn( obj->bfBGM, mtxRMI, bfBGR ); /* fmf_mulATBT_1n( mtxRM, volCoor0, bfBGR ); */ /* geme_invert3x3( mtxRMI, mtxRM ); */ /* fmf_mulATB_nn( obj->bfBGM, mtxRMI, bfBGR ); */ /* output( "%d %d %d\n", ii, iel, ifa); */ /* fmf_print( bfBGR, stdout, 0 ); */ /* fmf_print( volCoor0, stdout, 0 ); */ /* fmf_print( obj->bfBGM, stdout, 0 ); */ /* sys_pause(); */ ERR_CheckGo( ret ); } end_label: fmf_freeDestroy( &volCoor0 ); fmf_freeDestroy( &mtxRM ); fmf_freeDestroy( &mtxRMI ); return( RET_OK ); }
/*! @par Revision history: - 20.12.2005, c - 22.03.2006 - 27.07.2006 */ int32 dw_adj_convect2( FMField *out, FMField *stateW, FMField *stateU, VolumeGeometry *vg, int32 isDiff ) { int32 ii, dim, nQP, nEP, ret = RET_OK; FMField *vtg = 0, *ftvtg = 0; FMField *futvtg = 0; nQP = vg->bfGM->nLev; nEP = vg->bfGM->nCol; dim = vg->bfGM->nRow; fmf_createAlloc( &vtg, 1, nQP, dim, nEP * dim ); if (isDiff) { fmf_createAlloc( &ftvtg, 1, nQP, dim * nEP, dim * nEP ); } else { fmf_createAlloc( &futvtg, 1, nQP, 1, dim * nEP ); } for (ii = 0; ii < out->nCell; ii++) { FMF_SetCell( out, ii ); FMF_SetCell( stateU, ii ); FMF_SetCell( vg->bfGM, ii ); FMF_SetCell( vg->det, ii ); convect_build_vtg( vtg, vg->bfGM, stateU ); if (isDiff) { FMF_SetCellX1( vg->bf, ii ); bf_actt( ftvtg, vg->bf, vtg ); fmf_sumLevelsTMulF( out, ftvtg, vg->det->val ); } else { FMF_SetCell( stateW, ii ); fmf_mulATB_nn( futvtg, stateW, vtg ); fmf_sumLevelsTMulF( out, futvtg, vg->det->val ); } ERR_CheckGo( ret ); } end_label: fmf_freeDestroy( &vtg ); if (isDiff) { fmf_freeDestroy( &ftvtg ); } else { fmf_freeDestroy( &futvtg ); } return( ret ); }
/*! @par Revision history: - 15.12.2005, c */ int32 vg_integrate( VolumeGeometry *obj, FMField *out, FMField *in ) { int32 iel; for (iel = 0; iel < obj->bfGM->nCell; iel++) { FMF_SetCell( obj->det, iel ); FMF_SetCell( in, iel ); FMF_SetCell( out, iel ); fmf_sumLevelsMulF( out, in, obj->det->val ); } return( RET_OK ); }
/*! @par Revision history: - c: 03.08.2006, r: 23.01.2008 */ int32 dw_diffusion( FMField *out, FMField *grad, FMField *mtxD, Mapping *vg, int32 isDiff ) { int32 ii, dim, nQP, nEP, ret = RET_OK; FMField *gtd = 0, *gtdg = 0, *dgp = 0, *gtdgp = 0; nQP = vg->bfGM->nLev; nEP = vg->bfGM->nCol; dim = vg->bfGM->nRow; if (isDiff) { fmf_createAlloc( >d, 1, nQP, nEP, dim ); fmf_createAlloc( >dg, 1, nQP, nEP, nEP ); } else { fmf_createAlloc( &dgp, 1, nQP, dim, 1 ); fmf_createAlloc( >dgp, 1, nQP, nEP, 1 ); } for (ii = 0; ii < out->nCell; ii++) { FMF_SetCell( out, ii ); FMF_SetCell( vg->bfGM, ii ); FMF_SetCell( vg->det, ii ); if (mtxD->nCell > 1) { FMF_SetCell( mtxD, ii ); } if (isDiff) { fmf_mulATB_nn( gtd, vg->bfGM, mtxD ); fmf_mulAB_nn( gtdg, gtd, vg->bfGM ); fmf_sumLevelsMulF( out, gtdg, vg->det->val ); } else { FMF_SetCell( grad, ii ); fmf_mulAB_nn( dgp, mtxD, grad ); fmf_mulATB_nn( gtdgp, vg->bfGM, dgp ); fmf_sumLevelsMulF( out, gtdgp, vg->det->val ); } ERR_CheckGo( ret ); } end_label: if (isDiff) { fmf_freeDestroy( >d ); fmf_freeDestroy( >dg ); } else { fmf_freeDestroy( &dgp ); fmf_freeDestroy( >dgp ); } return( ret ); }
int32 dw_surface_s_v_dot_n(FMField *out, FMField *coef, FMField *val_qp, Mapping *rsg, Mapping *csg, int32 isDiff) { int32 ii, dim, nQP, nEPR, nEPC, ret = RET_OK; FMField *aux1 = 0, *aux2 = 0; nQP = rsg->det->nLev; dim = csg->normal->nRow; nEPR = rsg->bf->nCol; nEPC = csg->bf->nCol; if (isDiff) { fmf_createAlloc(&aux2, 1, nQP, nEPR, dim * nEPC); fmf_createAlloc(&aux1, 1, nQP, dim * nEPC, 1); } else { fmf_createAlloc(&aux2, 1, nQP, nEPR, 1); fmf_createAlloc(&aux1, 1, nQP, 1, 1); } for (ii = 0; ii < out->nCell; ii++) { FMF_SetCell(out, ii); FMF_SetCellX1(coef, ii); FMF_SetCell(rsg->det, ii); FMF_SetCellX1(rsg->bf, ii); FMF_SetCell(csg->normal, ii); if (isDiff) { FMF_SetCellX1(csg->bf, ii); bf_actt(aux1, csg->bf, csg->normal); fmf_mulATBT_nn(aux2, rsg->bf, aux1); fmf_mul(aux2, coef->val); fmf_sumLevelsMulF(out, aux2, rsg->det->val); } else { FMF_SetCell(val_qp, ii); fmf_mulATB_nn(aux1, csg->normal, val_qp); fmf_mulATB_nn(aux2, rsg->bf, aux1); fmf_mul(aux2, coef->val); fmf_sumLevelsMulF(out, aux2, rsg->det->val); } ERR_CheckGo( ret ); } end_label: fmf_freeDestroy(&aux1); fmf_freeDestroy(&aux2); return( ret ); }
/*! @par Revision history: - 12.12.2005, c - 14.12.2005 - 22.03.2006 - 27.07.2006 */ int32 dw_adj_convect1( FMField *out, FMField *stateW, FMField *gradU, VolumeGeometry *vg, int32 isDiff ) { int32 ii, dim, nQP, nEP, ret = RET_OK; FMField *gf = 0, *ftgf = 0, *ftgfu = 0; FMField *gfu = 0; nQP = vg->bfGM->nLev; nEP = vg->bfGM->nCol; dim = vg->bfGM->nRow; if (isDiff) { fmf_createAlloc( &gf, 1, nQP, dim, dim * nEP ); fmf_createAlloc( &ftgf, 1, nQP, dim * nEP, dim * nEP ); } else { fmf_createAlloc( &gfu, 1, nQP, dim, 1 ); fmf_createAlloc( &ftgfu, 1, nQP, dim * nEP, 1 ); } for (ii = 0; ii < out->nCell; ii++) { FMF_SetCell( out, ii ); FMF_SetCell( gradU, ii ); FMF_SetCell( vg->det, ii ); FMF_SetCellX1( vg->bf, ii ); if (isDiff) { bf_ract( gf, vg->bf, gradU ); bf_actt( ftgf, vg->bf, gf ); fmf_sumLevelsMulF( out, ftgf, vg->det->val ); } else { FMF_SetCell( stateW, ii ); fmf_mulAB_nn( gfu, gradU, stateW ); bf_actt( ftgfu, vg->bf, gfu ); fmf_sumLevelsMulF( out, ftgfu, vg->det->val ); } ERR_CheckGo( ret ); } end_label: if (isDiff) { fmf_freeDestroy( &gf ); fmf_freeDestroy( &ftgf ); } else { fmf_freeDestroy( &gfu ); fmf_freeDestroy( &ftgfu ); } return( ret ); }
/*! @par Revision history: - 01.02.2008, c */ int32 dw_volume_dot_scalar( FMField *out, FMField *coef, FMField *val_qp, Mapping *rvg, Mapping *cvg, int32 isDiff ) { int32 ii, nQP, nEPR, nEPC, ret = RET_OK; FMField *ftfp = 0, *ftf = 0, *cftf = 0; nQP = rvg->nQP; nEPR = rvg->bf->nCol; nEPC = cvg->bf->nCol; if (isDiff) { fmf_createAlloc( &ftf, 1, nQP, nEPR, nEPC ); fmf_createAlloc( &cftf, 1, nQP, nEPR, nEPC ); } else { fmf_createAlloc( &ftfp, 1, nQP, nEPR, 1 ); } for (ii = 0; ii < out->nCell; ii++) { FMF_SetCell( out, ii ); FMF_SetCell( rvg->det, ii ); FMF_SetCellX1( coef, ii ); FMF_SetCellX1( rvg->bf, ii ); if (isDiff) { FMF_SetCellX1( cvg->bf, ii ); fmf_mulATB_nn( ftf, rvg->bf, cvg->bf ); fmf_mulAF( cftf, ftf, coef->val ); fmf_sumLevelsMulF( out, cftf, rvg->det->val ); } else { FMF_SetCell( val_qp, ii ); bf_actt( ftfp, rvg->bf, val_qp ); fmf_mul( ftfp, coef->val ); fmf_sumLevelsMulF( out, ftfp, rvg->det->val ); } ERR_CheckGo( ret ); } end_label: if (isDiff) { fmf_freeDestroy( &ftf ); fmf_freeDestroy( &cftf ); } else { fmf_freeDestroy( &ftfp ); } return( ret ); }
/*! @par Revision history: - 23.03.2007, c */ int32 d_of_nsSurfMinDPress( FMField *out, FMField *pressure, float64 weight, float64 bpress, SurfaceGeometry *sg, int32 isDiff ) { int32 ii, iqp, nQP, ret = RET_OK; float64 aux; FMField *out1 = 0, *pressQP = 0; nQP = sg->det->nLev; if (isDiff == 0) { fmf_createAlloc( &out1, 1, 1, 1, 1 ); fmf_createAlloc( &pressQP, 1, nQP, 1, 1 ); aux = 0.0; for (ii = 0; ii < pressure->nCell; ii++) { FMF_SetCell( pressure, ii ); FMF_SetCell( sg->det, ii ); for (iqp = 0; iqp < nQP; iqp++) { pressQP->val[iqp] -= pressure->val[iqp] - bpress; } fmf_sumLevelsMulF( out1, pressQP, sg->det->val ); aux += out1->val[0]; ERR_CheckGo( ret ); } out->val[0] = aux * weight; } else { for (ii = 0; ii < out->nCell; ii++) { FMF_SetCell( out, ii ); FMF_SetCell( sg->det, ii ); FMF_SetCellX1( sg->bf, ii ); fmf_sumLevelsTMulF( out, sg->bf, sg->det->val ); ERR_CheckGo( ret ); } fmfc_mulC( out, weight ); } end_label: if (isDiff == 0) { fmf_freeDestroy( &out1 ); fmf_freeDestroy( &pressQP ); } return( ret ); }
/*! @par Revision history: - 01.11.2007, c */ int32 vg_integrateChunk( VolumeGeometry *obj, FMField *out, FMField *in, int32 *elList, int32 elList_nRow ) { int32 ii, iel; for (ii = 0; ii < elList_nRow; ii++) { iel = elList[ii]; FMF_SetCell( obj->det, iel ); FMF_SetCell( out, ii ); FMF_SetCell( in, ii ); fmf_sumLevelsMulF( out, in, obj->det->val ); } return( RET_OK ); }