public override double LevelSetForm(ref Foundation.XDG.CommonParamsLs cp, double[] U_Neg, double[] U_Pos, double[,] Grad_uA, double[,] Grad_uB, double vA, double vB, double[] Grad_vA, double[] Grad_vB) { double M = ComputeEvaporationMass(cp.ParamsNeg.GetSubVector(2 * D, D + 3), cp.ParamsPos.GetSubVector(2 * D, D + 3), cp.n, cp.jCell); if (M == 0.0) { return(0.0); } double[] VelocityMeanIn = new double[D]; double[] VelocityMeanOut = new double[D]; for (int d = 0; d < D; d++) { VelocityMeanIn[d] = cp.ParamsNeg[D + d]; VelocityMeanOut[d] = cp.ParamsPos[D + d]; } double LambdaIn; double LambdaOut; LambdaIn = LambdaConvection.GetLambda(VelocityMeanIn, cp.n, false); LambdaOut = LambdaConvection.GetLambda(VelocityMeanOut, cp.n, false); double Lambda = Math.Max(LambdaIn, LambdaOut); double uJump = -M * ((1 / rhoA) - (1 / rhoB)) * cp.n[m_d]; double flx = Lambda * uJump * 0.8; return(-flx * (rhoA * vA - rhoB * vB)); }
public double LevelSetForm(ref Foundation.XDG.CommonParamsLs cp, double[] U_Neg, double[] U_Pos, double[,] Grad_uA, double[,] Grad_uB, double vA, double vB, double[] Grad_vA, double[] Grad_vB) { double uAxN = GenericBlas.InnerProd(U_Neg, cp.n); double uBxN = GenericBlas.InnerProd(U_Pos, cp.n); //double s = 0;//cp.ParamsNeg[0]; //if (!MaterialInterface) { // Debug.Assert(cp.ParamsNeg[0] == cp.ParamsPos[0], "The interface velocity must be continuous across the level set!"); // throw new NotImplementedException(); //} double rhoJmp = rhoB - rhoA; // transform from species B to A: we call this the "A-fictitious" value double uAxN_fict; //if(!MaterialInterface) // uAxN_fict = (1 / rhoA) * (rhoB * uBxN + (-s) * rhoJmp); //else uAxN_fict = uBxN; // transform from species A to B: we call this the "B-fictitious" value double uBxN_fict; //if(!MaterialInterface) // uBxN_fict = (1 / rhoB) * (rhoA * uAxN - (-s) * rhoJmp); //else uBxN_fict = uAxN; // compute the fluxes: note that for the continuity equation, we use not a real flux, // but some kind of penalization, therefore the fluxes have opposite signs! double FlxNeg; double FlxPos; if (!weighted) { FlxNeg = -Flux(uAxN, uAxN_fict, 1.0, 1.0); // flux on A-side FlxPos = +Flux(uBxN_fict, uBxN, 1.0, 1.0); // flux on B-side } else { FlxNeg = -Flux(uAxN, uAxN_fict, wB, wA); // flux on A-side FlxPos = +Flux(uBxN_fict, uBxN, wA, wB); // flux on B-side } FlxNeg *= scaleA; FlxPos *= scaleB; return(FlxNeg * vA - FlxPos * vB); }
public override double LevelSetForm(ref Foundation.XDG.CommonParamsLs cp, double[] U_Neg, double[] U_Pos, double[,] Grad_uA, double[,] Grad_uB, double vA, double vB, double[] Grad_vA, double[] Grad_vB) { double M = ComputeEvaporationMass(cp.ParamsNeg.GetSubVector(2 * D, D + 3), cp.ParamsPos.GetSubVector(2 * D, D + 3), cp.n, cp.jCell); if (M == 0.0) { return(0.0); } double Ucentral = 0.0; for (int d = 0; d < D; d++) { Ucentral += 0.5 * (cp.ParamsNeg[d] + cp.ParamsPos[d]) * cp.n[d]; } double uAxN = Ucentral * (-M * (1 / rhoA) * cp.n[m_d]); double uBxN = Ucentral * (-M * (1 / rhoB) * cp.n[m_d]); uAxN += -M * (1 / rhoA) * 0.5 * (U_Neg[0] + U_Pos[0]); uBxN += -M * (1 / rhoB) * 0.5 * (U_Neg[0] + U_Pos[0]); // transform from species B to A: we call this the "A-fictitious" value double uAxN_fict; //uAxN_fict = (1 / rhoA) * (rhoB * uBxN); uAxN_fict = uBxN; // transform from species A to B: we call this the "B-fictitious" value double uBxN_fict; //uBxN_fict = (1 / rhoB) * (rhoA * uAxN); uBxN_fict = uAxN; // compute the fluxes: note that for the continuity equation, we use not a real flux, // but some kind of penalization, therefore the fluxes have opposite signs! double FlxNeg = -Flux(uAxN, uAxN_fict); // flux on A-side double FlxPos = +Flux(uBxN_fict, uBxN); // flux on B-side FlxNeg *= rhoA; FlxPos *= rhoB; double Ret = FlxNeg * vA - FlxPos * vB; return(-Ret); }
public double LevelSetForm(ref Foundation.XDG.CommonParamsLs cp, double[] U_Neg, double[] U_Pos, double[,] Grad_uA, double[,] Grad_uB, double vA, double vB, double[] Grad_vA, double[] Grad_vB) { Debug.Assert(cp.ParamsPos[D] == cp.ParamsNeg[D], "curvature must be continuous across interface"); Debug.Assert(cp.ParamsPos[D + 1] == cp.ParamsNeg[D + 1], "disjoining pressure must be continuous across interface"); //double M = ComputeEvaporationMass_Macro(cp.ParamsNeg.GetSubVector(0, D), cp.ParamsPos.GetSubVector(0, D), cp.n); //double M = ComputeEvaporationMass_Micro(cp.ParamsNeg[D], cp.ParamsPos[D], cp.ParamsNeg[D + 1], cp.ParamsNeg[D + 2]); double M = -0.1; // ComputeEvaporationMass(cp.ParamsNeg, cp.ParamsPos, cp.n, evapMicroRegion[cp.jCell]); if (M == 0.0) { return(0.0); } //Console.WriteLine("mEvap - GeneralizedDivergenceAtLevelSet: {0}", M); double uAxN = -M * (1 / rhoA) * U_Neg[0]; double uBxN = -M * (1 / rhoB) * U_Pos[0]; // transform from species B to A: we call this the "A-fictitious" value double uAxN_fict; //uAxN_fict = (1 / rhoA) * (rhoB * uBxN); uAxN_fict = uBxN; // transform from species A to B: we call this the "B-fictitious" value double uBxN_fict; //uBxN_fict = (1 / rhoB) * (rhoA * uAxN); uBxN_fict = uAxN; // compute the fluxes: note that for the continuity equation, we use not a real flux, // but some kind of penalization, therefore the fluxes have opposite signs! double FlxNeg = -Flux(uAxN, uAxN_fict); // flux on A-side double FlxPos = +Flux(uBxN_fict, uBxN); // flux on B-side FlxNeg *= capA; FlxPos *= capB; double Ret = FlxNeg * vA - FlxPos * vB; return(-Ret); }
/// <summary> /// /// </summary> public double LevelSetForm(ref Foundation.XDG.CommonParamsLs cp, double[] U_Neg, double[] U_Pos, double[,] Grad_uA, double[,] Grad_uB, double vA, double vB, double[] Grad_vA, double[] Grad_vB) { double uAxN = GenericBlas.InnerProd(U_Neg, cp.n); double uBxN = GenericBlas.InnerProd(U_Pos, cp.n); // transform from species B to A: we call this the "A-fictitious" value double uAxN_fict = uBxN; // transform from species A to B: we call this the "B-fictitious" value double uBxN_fict = uAxN; double FlxNeg = (DirichletCond) ? 0.0 : Flux(uAxN, uAxN_fict); // flux on A-side double FlxPos = (DirichletCond) ? 0.0 : Flux(uBxN_fict, uBxN); // flux on B-side return(-(FlxNeg * vA - FlxPos * vB)); }
public override double LevelSetForm(ref Foundation.XDG.CommonParamsLs cp, double[] U_Neg, double[] U_Pos, double[,] Grad_uA, double[,] Grad_uB, double vA, double vB, double[] Grad_vA, double[] Grad_vB) { double M = ComputeEvaporationMass(cp.ParamsNeg, cp.ParamsPos, cp.n, cp.jCell); if (M == 0.0) { return(0.0); } double Tavg = (DirichletCond) ? Tsat : 0.5 * (U_Neg[0] + U_Pos[0]); //double T_sat = 0.0; double uAxN = -M * (1 / rhoA) * (Tavg); double uBxN = -M * (1 / rhoB) * (Tavg); // transform from species B to A: we call this the "A-fictitious" value double uAxN_fict; //uAxN_fict = (1 / rhoA) * (rhoB * uBxN); uAxN_fict = uBxN; // transform from species A to B: we call this the "B-fictitious" value double uBxN_fict; //uBxN_fict = (1 / rhoB) * (rhoA * uAxN); uBxN_fict = uAxN; // compute the fluxes: note that for the continuity equation, we use not a real flux, // but some kind of penalization, therefore the fluxes have opposite signs! double FlxNeg = -Flux(uAxN, uAxN_fict); // flux on A-side double FlxPos = +Flux(uBxN_fict, uBxN); // flux on B-side FlxNeg *= capA; FlxPos *= capB; double Ret = FlxNeg * vA - FlxPos * vB; return(-Ret); }
public double LevelSetForm(ref Foundation.XDG.CommonParamsLs cp, double[] U_Neg, double[] U_Pos, double[,] Grad_uA, double[,] Grad_uB, double vA, double vB, double[] Grad_vA, double[] Grad_vB) { //Debug.Assert(cp.ParamsPos[D + 1] == cp.ParamsNeg[D + 1], "curvature must be continuous across interface"); //Debug.Assert(cp.ParamsPos[D + 2] == cp.ParamsNeg[D + 2], "disjoining pressure must be continuous across interface"); //double M = ComputeEvaporationMass_Macro(cp.ParamsNeg.GetSubVector(0, D), cp.ParamsPos.GetSubVector(0, D), cp.n); //double M = ComputeEvaporationMass_Micro(cp.ParamsNeg[D], cp.ParamsPos[D], cp.ParamsNeg[D + 1], cp.ParamsNeg[D + 2]); double M = -0.1; // ComputeEvaporationMass(cp.ParamsNeg, cp.ParamsPos, cp.n, evapMicroRegion[cp.jCell]); double[] Uint = new double[] { 0.0, 0.0 }; double UintxN = 0.0; double uAxN = 0.0; double uBxN = 0.0; // [[ rho(u*n) ]] {{u}} * {{v}} // ============================ //for (int d = 0; d < D; d++) { // uAxN += rhoA * cp.ParamsNeg[d] * cp.n[d]; // uBxN += rhoB * cp.ParamsPos[d] * cp.n[d]; //} uAxN += -rhoA * UintxN; uBxN += -rhoB * UintxN; double Uaver = 0.5 * (U_Neg[0] + U_Pos[0]); uAxN *= Uaver; uBxN *= Uaver; // {{ rho(u*n) }} [[u]] * {{v}} // ============================ double UnCentral = 0.0; for (int d = 0; d < D; d++) { UnCentral += 0.5 * (rhoA * (cp.ParamsNeg[d] - Uint[d]) + rhoB * (cp.ParamsPos[d] - Uint[d])) * cp.n[d]; } uAxN += UnCentral * (0.0 - (-M * (1 / rhoA) * cp.n[m_d])); uBxN += UnCentral * (0.0 - (-M * (1 / rhoB) * cp.n[m_d])); // ==================================================================== // transform from species B to A: we call this the "A-fictitious" value double uAxN_fict = uBxN; // transform from species A to B: we call this the "B-fictitious" value double uBxN_fict = uAxN; double FlxNeg = -Flux(uAxN, uAxN_fict); // flux on A-side double FlxPos = +Flux(uBxN_fict, uBxN); // flux on B-side double Ret = FlxNeg * vA - FlxPos * vB; return(Ret); }